移动应用的其中一个独特功能是位置感知。移动用户无论走到哪里都会随身携带设备,因此为您的应用添加位置感知功能可给用户带来更契合环境的体验。借助 Google Play 服务中提供的各种地理位置 API,您可以更方便地向应用中添加自动地理位置跟踪、错误街道侧检测、地理围栏和运动状态识别等地理位置感知功能。

开发资源

根据应用功能的用例声明权限并发出请求。
使用一体化位置信息提供程序向用户提供相关性更高的位置信息。
提高用户设备的电池能效。遵循与后台位置信息限制相关的准则。
在地图上标出感兴趣的地点,允许用户控制地图上显示的内容。

最新资讯

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 helps millions of people discover their world everyday by sharing timely news from a diverse set of news sources.

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.

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.

其他资源

如需详细了解如何在应用中请求访问位置信息,请参阅下列补充资源:

示例

位置信息示例属于 Android OS 平台示例。请参阅 Android OS 平台示例中的位置信息模块,然后按照说明运行示例。
此示例演示了请求位置信息权限的最佳实践。
此示例演示了获取用户当前位置的最佳实践。
此示例演示了接收位置信息更新的最佳实践。
此示例演示了如何在应用在后台运行时访问位置信息或接收位置信息更新。
此示例演示了如何创建和监控地理围栏。
此示例演示了用户运动状态识别的最佳实践。