Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release
, bukan aosp-main
, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Referensi Struct GpsGeofencingInterface
#include <
gps.h
>
Antarmuka yang diperluas untuk dukungan GPS_Geofencing
Definisi di baris
1361
file
gps.h
.
void(* add_geofence_area)(int32_t geofence_id, double latitude, double longitude, double radius_meters, int last_transition, int monitor_transitions, int notification_responsiveness_ms, int unknown_timer_ms)
|
Tambahkan area pembatasan wilayah. API ini saat ini mendukung pembatasan wilayah melingkar. Parameter: geofence_id - ID untuk pembatasan wilayah. Jika pembatasan wilayah dengan ID ini sudah ada, nilai error (GPS_GEOFENCE_ERROR_ID_EXISTS) akan ditampilkan. latitude, longtitude, radius_meters - Lintang, bujur, dan radius (dalam meter) untuk pembatasan wilayah last_transition - Status pembatasan wilayah saat ini. Misalnya, jika sistem sudah mengetahui bahwa pengguna berada di dalam pembatasan wilayah, nilai ini akan ditetapkan ke GPS_GEOFENCE_ENTERED. Dalam sebagian besar kasus, nilainya adalah GPS_GEOFENCE_UNCERTAIN. monitor_transition - Transisi yang akan dipantau. OR Bitwise dari GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, dan GPS_GEOFENCE_UNCERTAIN. notification_responsiveness_ms - Menentukan deskripsi upaya terbaik tentang seberapa cepat callback harus dipanggil saat transisi yang terkait dengan
Pembatasan wilayah
dipicu. Misalnya, jika ditetapkan ke 1.000 milidetik dengan GPS_GEOFENCE_ENTERED, callback harus dipanggil 1.000 milidetik setelah memasuki pembatasan wilayah. Parameter ini ditentukan dalam milidetik. CATATAN: Jangan sampai keliru dengan kecepatan polling GPS. Anda dapat mengubah frekuensi pengambilan sampel GPS secara dinamis karena alasan penghematan daya; sehingga frekuensi pengambilan sampel dapat lebih cepat atau lebih lambat dari ini. unknown_timer_ms - Batas waktu setelah transisi UNCERTAIN dipicu. Parameter ini ditentukan dalam milidetik. Lihat di atas untuk penjelasan mendetail.
Definisi di baris
1400
dari file
gps.h
.
Membuka antarmuka pembatasan wilayah dan menyediakan rutinitas callback ke penerapan antarmuka ini.
Definisi di baris
1369
dari file
gps.h
.
void(* pause_geofence)(int32_t geofence_id)
|
Menjeda pemantauan pembatasan wilayah tertentu. Parameter: geofence_id - ID untuk pembatasan wilayah.
Definisi di baris
1409
dari file
gps.h
.
void(* remove_geofence_area)(int32_t geofence_id)
|
Menghapus area pembatasan wilayah. Setelah fungsi ditampilkan, tidak ada notifikasi yang akan dikirim. Parameter: geofence_id - ID untuk pembatasan wilayah.
Definisi di baris
1429
dari file
gps.h
.
void(* resume_geofence)(int32_t geofence_id, int monitor_transitions)
|
Melanjutkan pemantauan pembatasan wilayah tertentu. Parameter: geofence_id - ID untuk pembatasan wilayah. monitor_transitions - Transisi yang akan dipantau. Bitwise OR dari GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED, dan GPS_GEOFENCE_UNCERTAIN. Nilai ini menggantikan nilai yang terkait yang diberikan dalam panggilan add_geofence_area.
Definisi di baris
1421
dari file
gps.h
.
ditetapkan ke sizeof(GpsGeofencingInterface)
Definisi di baris
1363
dari file
gps.h
.
Dokumentasi untuk struct ini dibuat dari file berikut:
-
hardware/libhardware/include/hardware/
gps.h
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# Android Hardware Abstraction Layer: GpsGeofencingInterface Struct Reference\n\nGpsGeofencingInterface Struct Reference\n=======================================\n\n[Data Fields](#pub-attribs) \nGpsGeofencingInterface Struct Reference \n\n`\n#include \u003c\n`[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)`\n\u003e\n`\n\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| size_t | [size](/reference/hal/struct_gps_geofencing_interface#a854352f53b148adc24983a58a1866d66) |\n| ||\n| void(\\* | [init](/reference/hal/struct_gps_geofencing_interface#a4504d0e82b1d377fa32d56ec5004774f) )( [GpsGeofenceCallbacks](/reference/hal/struct_gps_geofence_callbacks) \\*callbacks) |\n| ||\n| void(\\* | [add_geofence_area](/reference/hal/struct_gps_geofencing_interface#add2c5bdb0d1496ac9ee6a2460fb12a08) )(int32_t geofence_id, double latitude, double longitude, double radius_meters, int last_transition, int monitor_transitions, int notification_responsiveness_ms, int unknown_timer_ms) |\n| ||\n| void(\\* | [pause_geofence](/reference/hal/struct_gps_geofencing_interface#a850b900b8eabf9328ec853978936ed4f) )(int32_t geofence_id) |\n| ||\n| void(\\* | [resume_geofence](/reference/hal/struct_gps_geofencing_interface#af409f9b64a5b9b42a5417ae381fabc88) )(int32_t geofence_id, int monitor_transitions) |\n| ||\n| void(\\* | [remove_geofence_area](/reference/hal/struct_gps_geofencing_interface#a4cff265eb49bb5d94d9be5a4c55ceea7) )(int32_t geofence_id) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nExtended interface for GPS_Geofencing support\n\n\nDefinition at line\n[1361](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\nField Documentation\n-------------------\n\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| void(\\* add_geofence_area)(int32_t geofence_id, double latitude, double longitude, double radius_meters, int last_transition, int monitor_transitions, int notification_responsiveness_ms, int unknown_timer_ms) |\n\n\nAdd a geofence area. This api currently supports circular geofences. Parameters: geofence_id - The id for the geofence. If a geofence with this id already exists, an error value (GPS_GEOFENCE_ERROR_ID_EXISTS) should be returned. latitude, longtitude, radius_meters - The lat, long and radius (in meters) for the geofence last_transition - The current state of the geofence. For example, if the system already knows that the user is inside the geofence, this will be set to GPS_GEOFENCE_ENTERED. In most cases, it will be GPS_GEOFENCE_UNCERTAIN. monitor_transition - Which transitions to monitor. Bitwise OR of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and GPS_GEOFENCE_UNCERTAIN. notification_responsiveness_ms - Defines the best-effort description of how soon should the callback be called when the transition associated with the\n[Geofence](/reference/hal/struct_geofence)\nis triggered. For instance, if set to 1000 millseconds with GPS_GEOFENCE_ENTERED, the callback should be called 1000 milliseconds within entering the geofence. This parameter is defined in milliseconds. NOTE: This is not to be confused with the rate that the GPS is polled at. It is acceptable to dynamically vary the rate of sampling the GPS for power-saving reasons; thus the rate of sampling may be faster or slower than this. unknown_timer_ms - The time limit after which the UNCERTAIN transition should be triggered. This parameter is defined in milliseconds. See above for a detailed explanation.\n\n\nDefinition at line\n[1400](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|--------------------------------------------------------------------------------------------------|\n| void(\\* init)( [GpsGeofenceCallbacks](/reference/hal/struct_gps_geofence_callbacks) \\*callbacks) |\n\n\nOpens the geofence interface and provides the callback routines to the implementation of this interface.\n\n\nDefinition at line\n[1369](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|----------------------------------------------|\n| void(\\* pause_geofence)(int32_t geofence_id) |\n\n\nPause monitoring a particular geofence. Parameters: geofence_id - The id for the geofence.\n\n\nDefinition at line\n[1409](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|----------------------------------------------------|\n| void(\\* remove_geofence_area)(int32_t geofence_id) |\n\n\nRemove a geofence area. After the function returns, no notifications should be sent. Parameter: geofence_id - The id for the geofence.\n\n\nDefinition at line\n[1429](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|------------------------------------------------------------------------|\n| void(\\* resume_geofence)(int32_t geofence_id, int monitor_transitions) |\n\n\nResume monitoring a particular geofence. Parameters: geofence_id - The id for the geofence. monitor_transitions - Which transitions to monitor. Bitwise OR of GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED and GPS_GEOFENCE_UNCERTAIN. This supersedes the value associated provided in the add_geofence_area call.\n\n\nDefinition at line\n[1421](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n|-------------|\n| size_t size |\n\n\nset to sizeof(GpsGeofencingInterface)\n\n\nDefinition at line\n[1363](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\nof file\n[gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [gps.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h)"]]