החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הפניה ל-struct של GpsGeofencingInterface
#include <
gps.h
>
ממשק מורחב לתמיכה ב-GPS_Geofencing
ההגדרה מופיעה בשורה
1361
בקובץ
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)
|
מוסיפים אזור גדר גיאוגרפית. בשלב הזה, ה-API הזה תומך במתחמים גיאוגרפיים עגולים. פרמטרים: geofence_id – המזהה של הגדרת הגבול הווירטואלי. אם כבר קיים גדר גיאוגרפית עם המזהה הזה, צריך להחזיר ערך שגיאה (GPS_GEOFENCE_ERROR_ID_EXISTS). latitude, longtitude, radius_meters – קו הרוחב, קו האורך והרדיוס (במטרים) של הגדר הגיאוגרפית. last_transition – המצב הנוכחי של הגדר הגיאוגרפית. לדוגמה, אם המערכת כבר יודעת שהמשתמש נמצא בתוך הגדרת ה-Geofence, הערך יהיה GPS_GEOFENCE_ENTERED. ברוב המקרים, הערך יהיה GPS_GEOFENCE_UNCERTAIN. monitor_transition – אילו מעברים צריך לעקוב אחריהם. או בינארי של GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED ו-GPS_GEOFENCE_UNCERTAIN. notification_responsiveness_ms – מגדיר את התיאור של המאמץ הטוב ביותר לגבי המועד שבו צריך להפעיל את הקריאה החוזרת (callback) כשמתרחש המעבר שמשויך ל
Geofence
. לדוגמה, אם מגדירים 1,000 אלפיות השנייה עם GPS_GEOFENCE_ENTERED, צריך להפעיל את הפונקציה החוזרת 1,000 אלפיות השנייה לאחר הכניסה למתחם הגיאופוני. הפרמטר הזה מוגדר באלפיות שנייה. הערה: אין לבלבל בין התדירות הזו לבין התדירות שבה מתבצע הסקרים של ה-GPS. מותר לשנות באופן דינמי את קצב הדגימה של ה-GPS מסיבות של חיסכון באנרגיה, כך שקצב הדגימה עשוי להיות מהיר או איטי יותר. unknown_timer_ms – מגבלת הזמן שאחריה צריך להפעיל את המעבר לסטטוס UNCERTAIN. הפרמטר הזה מוגדר באלפיות שנייה. הסבר מפורט מופיע למעלה.
ההגדרה מופיעה בשורה
1400
בקובץ
gps.h
.
פתיחת הממשק של הגדרת גבולות גיאוגרפיים ומתן פונקציות ה-callback להטמעה של הממשק הזה.
ההגדרה מופיעה בשורה
1369
בקובץ
gps.h
.
void(* pause_geofence)(int32_t geofence_id)
|
השהיית המעקב אחרי גדר גיאוגרפית מסוימת. פרמטרים: geofence_id – המזהה של הגדרת הגבול הווירטואלי.
ההגדרה מופיעה בשורה
1409
בקובץ
gps.h
.
void(* remove_geofence_area)(int32_t geofence_id)
|
הסרת אזור גדר גיאוגרפית. אחרי שהפונקציה חוזרת, לא אמורות להישלח התראות. פרמטר: geofence_id – המזהה של הגדרת הגבול הווירטואלי.
ההגדרה מופיעה בשורה
1429
בקובץ
gps.h
.
void(* resume_geofence)(int32_t geofence_id, int monitor_transitions)
|
המשך המעקב אחרי גדר גיאוגרפית מסוימת. פרמטרים: geofence_id – המזהה של המכשול הגיאוגרפי. monitor_transitions – המעברים שרוצים לעקוב אחריהם. ביטוי OR בינארי של GPS_GEOFENCE_ENTERED, GPS_GEOFENCE_EXITED ו-GPS_GEOFENCE_UNCERTAIN. הערך הזה מחליף את הערך המשויך שסופק בקריאה add_geofence_area.
ההגדרה מופיעה בשורה
1421
בקובץ
gps.h
.
מוגדר לערך sizeof(GpsGeofencingInterface)
ההגדרה מופיעה בשורה
1363
בקובץ
gps.h
.
התיעוד של המבנה הזה נוצר מהקובץ הבא:
-
hardware/libhardware/include/hardware/
gps.h
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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)"]]