自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
GeofenceOptions 結構體參考資料
#include <
fused_location.h
>
地理圍欄的目前狀態。舉例來說,如果系統已知使用者位於地理圍欄內,就會將此值設為 FLP_GEOFENCE_TRANSITION_ENTERED。在大多數情況下,這會是 FLP_GEOFENCE_TRANSITION_UNCERTAIN。
定義位於檔案
fused_location.h
的
720
行。
轉換為監控。FLP_GEOFENCE_TRANSITION_ENTERED、FLP_GEOFENCE_TRANSITION_EXITED 和 FLP_GEOFENCE_TRANSITION_UNCERTAIN 的位元 OR。
定義位於檔案
fused_location.h
的
727
行。
int notification_responsivenes_ms
|
定義最佳努力描述,說明當與
Geofence
相關聯的轉換觸發時,應在多久後呼叫回呼。舉例來說,如果您將 FLP_GEOFENCE_TRANSITION_ENTERED 設為 1000 毫秒,則應在進入地理圍欄後 1000 毫秒內呼叫回呼。此參數以毫秒為單位。注意:請勿將此與 GPS 輪詢速率混淆。為節省電力,我們可以動態調整 GPS 取樣率,因此取樣率可能會比這更快或更慢。
定義位於檔案
fused_location.h
的
741
行。
這個結構體的說明文件是由下列檔案產生:
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],null,["# Android Hardware Abstraction Layer: GeofenceOptions Struct Reference\n\nGeofenceOptions Struct Reference\n================================\n\n[Data Fields](#pub-attribs) \nGeofenceOptions Struct Reference \n\n`\n#include \u003c\n`[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)`\n\u003e\n`\n\n|----------|-----------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| int | [last_transition](/reference/hal/struct_geofence_options#ac9f3044df5a350d9a141c36631daa4d8) |\n| ||\n| int | [monitor_transitions](/reference/hal/struct_geofence_options#a0c48726615ba0e8f18e47cbe3d6e7873) |\n| ||\n| int | [notification_responsivenes_ms](/reference/hal/struct_geofence_options#a759888e878e11256a8021d3cd3d8e12a) |\n| ||\n| int | [unknown_timer_ms](/reference/hal/struct_geofence_options#a2d1b6a36f124a618cbebc3f79977233b) |\n| ||\n| uint32_t | [sources_to_use](/reference/hal/struct_geofence_options#a352dd652f7b9c6033433ad53089fe281) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\n[Geofence](/reference/hal/struct_geofence)\nOptions\n\n\nDefinition at line\n[714](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\nof file\n[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\n.\n\nField Documentation\n-------------------\n\n\n|---------------------|\n| int last_transition |\n\n\nThe current state of the geofence. For example, if the system already knows that the user is inside the geofence, this will be set to FLP_GEOFENCE_TRANSITION_ENTERED. In most cases, it will be FLP_GEOFENCE_TRANSITION_UNCERTAIN.\n\n\nDefinition at line\n[720](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\nof file\n[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\n.\n\n|-------------------------|\n| int monitor_transitions |\n\n\nTransitions to monitor. Bitwise OR of FLP_GEOFENCE_TRANSITION_ENTERED, FLP_GEOFENCE_TRANSITION_EXITED and FLP_GEOFENCE_TRANSITION_UNCERTAIN.\n\n\nDefinition at line\n[727](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\nof file\n[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\n.\n\n|-----------------------------------|\n| int notification_responsivenes_ms |\n\n\nDefines 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 FLP_GEOFENCE_TRANSITION_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.\n\n\nDefinition at line\n[741](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\nof file\n[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\n.\n\n|-------------------------|\n| uint32_t sources_to_use |\n\n\nThe sources to use for monitoring geofences. Its a BITWISE-OR of FLP_TECH_MASK flags.\n\n\nDefinition at line\n[753](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\nof file\n[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\n.\n\n|----------------------|\n| int unknown_timer_ms |\n\n\nThe time limit after which the UNCERTAIN transition should be triggered. This paramter is defined in milliseconds.\n\n\nDefinition at line\n[747](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\nof file\n[fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [fused_location.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/fused_location.h)"]]