构建位置感知应用
移动应用的其中一个独特功能是位置感知。移动用户无论走到哪里都会随身携带设备,因此为您的应用添加位置感知功能可给用户带来更契合环境的体验。借助 Google Play 服务中提供的各种地理位置 API,您可以更方便地向应用中添加自动地理位置跟踪、错误街道侧检测、地理围栏和运动状态识别等地理位置感知功能。
开发资源
请求适当的权限
根据应用功能的用例声明权限并发出请求。
接收位置信息更新
使用一体化位置信息提供程序向用户提供相关性更高的位置信息。
优化电量消耗
提高用户设备的电池能效。遵循与后台位置信息限制相关的准则。
将地图添加到您的应用中
在地图上标出感兴趣的地点,允许用户控制地图上显示的内容。
最新资讯
Evernote launches on ChromeOS and sees 3X increase in time spent on larger screen devices
Evernote's mission is to help individuals and groups remember everything, turn ideas into action, and work effortlessly together. Their Android app gives people the tools they need to get organized, take and save notes, and collaborate with others.
Squid boosts their rating with new features in ChromeOS
Squid allows users to take handwritten notes naturally on various devices. With Squid you can write just like you would on paper using an active pen, passive stylus, or your finger and easily mark up PDFs to fill out forms, edit/grade papers, or sign documents.
其他资源
如需详细了解如何在应用中请求访问位置信息,请参阅下列补充资源:
Codelab
- 通过 Kotlin 在 Android 10 中获取位置信息:了解如何在搭载 Android 10 的设备上请求获取位置信息,包括在应用使用期间请求获取位置信息。