行動應用程式的其中一項獨特功能為「位置辨識」。行動裝置使用者會隨身攜帶自己的裝置,因此如果應用程式能加入位置辨識功能,就能為使用者提供更切合情境的體驗。Google Play 服務提供的 Location API 可利用自動位置追蹤、街道方向錯誤偵測、地理圍欄和動作辨識等功能,幫助應用程式加入位置辨識功能。

開發資源

根據應用程式功能的用途宣告權限並提出要求。
使用整合式位置預測提供工具,為使用者提供更相關的位置資訊。
提升使用者裝置的電池效能。請遵循背景位置資訊限制相關規範。
在地圖上標示感興趣的地點,讓使用者自行掌控地圖上顯示的內容。

新聞快報

Device orientation, or attitude, is used as an input signal for many use cases: virtual or augmented reality, gesture detection, or compass and navigation – any time the app needs the orientation of a device in relation to its surroundings. We’ve

Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development. Today, we’re covering updates from the top three things in Google Play at I/O 2023, Pixel Fold and Pixel Tablet, AndroidX releases, what it

At Android, we want to make it as easy as possible for developers to create the most helpful apps for their users. That’s why we aim to provide the best location experience with our APIs like the Fused Location Provider API (FLP). However, we’ve

Today, we’re unwrapping the Beta release for Android 11 as well as the latest updates for developers from Kotlin coroutines, to progress on the Jetpack Compose toolkit, to faster builds in Android Studio, even a refreshed experience for the Play

其他資源

如要進一步瞭解如何為應用程式要求位置資訊存取權,請參閱下列其他資源:

範例

位置範例屬於 Android OS 平台範例的一部分。請參閱 Android OS 平台範例中的位置模組,並按照操作說明執行範例。
要求位置存取權的最佳做法示例。
擷取使用者目前位置的最佳做法示例。
接收位置更新通知的最佳做法示例。
示範如何在背景執行應用程式時,存取位置資訊或接收位置更新通知。
建立及監控地理圍欄的示例。
使用者動作辨識的最佳做法示例。