移动应用的其中一个独特功能是位置感知。移动用户无论走到哪里都会随身携带设备,因此为您的应用添加位置感知功能可给用户带来更契合环境的体验。借助 Google Play 服务中提供的各种地理位置 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 平台示例中的位置信息模块,然后按照说明运行示例。
此示例演示了请求位置信息权限的最佳实践。
此示例演示了获取用户当前位置的最佳实践。
此示例演示了接收位置信息更新的最佳实践。
此示例演示了如何在应用在后台运行时访问位置信息或接收位置信息更新。
此示例演示了如何创建和监控地理围栏。
此示例演示了用户运动状态识别的最佳实践。