建構位置辨識應用程式
行動應用程式的其中一項獨特功能為「位置辨識」。行動裝置使用者會隨身攜帶自己的裝置,因此如果應用程式能加入位置辨識功能,就能為使用者提供更切合情境的體驗。Google Play 服務提供的 Location API 可利用自動位置追蹤、街道方向錯誤偵測、地理圍欄和動作辨識等功能,幫助應用程式加入位置辨識功能。
開發資源
要求適當權限
根據應用程式功能的用途宣告權限並提出要求。
接收位置更新資訊
使用整合式位置預測提供工具,為使用者提供更相關的位置資訊。
最佳化耗電量
提升使用者裝置的電池效能。請遵循背景位置資訊限制相關規範。
在應用程式中新增地圖
在地圖上標示感興趣的地點,讓使用者自行掌控地圖上顯示的內容。
新聞快報
Headspace's Android reboot increases monthly active users by 15%
In order to launch new features on their Android app, Headspace spent 8 months refactoring their architecture and rewriting in Kotlin. Learn how this reboot helped their business grow.
SmartNews reduces lines of code by 20% and improves team morale with Kotlin
SmartNews helps millions of people discover their world everyday by sharing timely news from a diverse set of news sources.
Twitter increases developer productivity and code reliability with Kotlin
Twitter is one of the most widely used social media platforms where users can see what’s happening in the world at any given moment.
Google Home reduces #1 cause of crashes by 33%
The Google Home app helps set up, manage, and control your Google Home, Google Nest, and Chromecast devices—plus thousands of connected home products like lights, cameras, thermostats, and more.
其他資源
如要進一步瞭解如何為應用程式要求位置資訊存取權,請參閱下列其他資源:
程式碼研究室
- 使用 Kotlin 處理 Android 10 中的位置資訊:瞭解如何在搭載 Android 10 的裝置上要求取得位置資訊,包括如何在應用程式使用期間要求位置資訊。