自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
AGpsInterface 結構體參考資料
#include <
gps.h
>
延伸介面可支援 AGPS,可用於傳遞額外的 APN 資料。
定義位於檔案
gps.h
的
921
行。
int(* data_conn_closed)()
|
int(* data_conn_failed)()
|
int(* data_conn_open)(const char *apn)
|
已淘汰。如果 HAL 支援 AGpsInterface_v2,這個 API 就不會使用,詳情請參閱 data_conn_open_with_apn_ip_type。
定義位於檔案
gps.h
的
935
行。
int(* data_conn_open_with_apn_ip_type)(const char *apn,
ApnIpType
apnIpType)
|
通知系統可使用資料連線,並設定 APN 名稱和 IP 類型,以便用於 SUPL 連線。
定義位於檔案
gps.h
的
953
行。
開啟 AGPS 介面,並為此介面的實作提供回呼例程式。
定義位於檔案
gps.h
的
929
行。
int(* set_server)(
AgpsType
type, const char *hostname, int port)
|
設定 AGPS 伺服器的主機名稱和通訊埠。
定義位於檔案
gps.h
的
947
行。
設為 sizeof(AGpsInterface)
定義位於檔案
gps.h
的
923
行。
這個結構體的說明文件是由下列檔案產生:
-
hardware/libhardware/include/hardware/
gps.h
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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: AGpsInterface Struct Reference\n\nAGpsInterface Struct Reference\n==============================\n\n[Data Fields](#pub-attribs) \nAGpsInterface 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_a_gps_interface#a854352f53b148adc24983a58a1866d66) |\n| ||\n| void(\\* | [init](/reference/hal/struct_a_gps_interface#a72feb2719b8809d7064eac96b4a5fb8f) )( [AGpsCallbacks](/reference/hal/struct_a_gps_callbacks) \\*callbacks) |\n| ||\n| int(\\* | [data_conn_open](/reference/hal/struct_a_gps_interface#a591c421c92b4628d493f1ae55a1ab6d9) )(const char \\*apn) |\n| ||\n| int(\\* | [data_conn_closed](/reference/hal/struct_a_gps_interface#aa413d6d9fe05cd2bd9c1f531c3f37bf7) )() |\n| ||\n| int(\\* | [data_conn_failed](/reference/hal/struct_a_gps_interface#a5b66d04a0b8ab39e01d3f3ec4e6e0c97) )() |\n| ||\n| int(\\* | [set_server](/reference/hal/struct_a_gps_interface#a9723f353ecadc2b585cd58f0c60012ae) )( [AGpsType](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h) type, const char \\*hostname, int port) |\n| ||\n| int(\\* | [data_conn_open_with_apn_ip_type](/reference/hal/struct_a_gps_interface#a19322cf8f0b053595e62cbd79cc9d00d) )(const char \\*apn, [ApnIpType](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h) apnIpType) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nExtended interface for AGPS support, it is augmented to enable to pass extra APN data.\n\n\nDefinition at line\n[921](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| int(\\* data_conn_closed)() |\n\n\nNotifies that the AGPS data connection has been closed.\n\n\nDefinition at line\n[939](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| int(\\* data_conn_failed)() |\n\n\nNotifies that a data connection is not available for AGPS.\n\n\nDefinition at line\n[943](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| int(\\* data_conn_open)(const char \\*apn) |\n\n\nDeprecated. If the HAL supports AGpsInterface_v2 this API will not be used, see data_conn_open_with_apn_ip_type for more information.\n\n\nDefinition at line\n[935](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| int(\\* data_conn_open_with_apn_ip_type)(const char \\*apn, [ApnIpType](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h) apnIpType) |\n\n\nNotifies that a data connection is available and sets the name of the APN, and its IP type, to be used for SUPL connections.\n\n\nDefinition at line\n[953](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)( [AGpsCallbacks](/reference/hal/struct_a_gps_callbacks) \\*callbacks) |\n\n\nOpens the AGPS interface and provides the callback routines to the implementation of this interface.\n\n\nDefinition at line\n[929](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| int(\\* set_server)( [AGpsType](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/gps.h) type, const char \\*hostname, int port) |\n\n\nSets the hostname and port for the AGPS server.\n\n\nDefinition at line\n[947](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(AGpsInterface)\n\n\nDefinition at line\n[923](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)"]]