Core Locationbutton

  
最近更新时间 稳定版 候选版 Beta 版 Alpha 版
2026 年 6 月 17 日 - - - -

声明依赖项

如需添加 Core Locationbutton 的依赖项,您必须将 Google Maven 制品库添加到项目中。如需了解详情,请参阅 Google 的 Maven 制品库

在应用或模块的 build.gradle 文件中添加所需工件的依赖项:

Groovy

dependencies {
    implementation "androidx.core.locationbutton:locationbutton:"
    implementation "androidx.core.locationbutton:locationbutton-compose:"
    implementation "androidx.core.locationbutton:locationbutton-testing:"
}

Kotlin

dependencies {
    implementation("androidx.core.locationbutton:locationbutton:")
    implementation("androidx.core.locationbutton:locationbutton-compose:")
    implementation("androidx.core.locationbutton:locationbutton-testing:")
}

如需详细了解依赖项,请参阅添加 build 依赖项

反馈

您的反馈将帮助我们改进 Jetpack。如果您发现了新问题,或对此库有任何改进建议,请告诉我们。创建新问题前,请先查看此库中的现有问题。您可以点击星标按钮,为现有问题投票。

创建新问题

如需了解详情,请参阅问题跟踪器文档

版本 1.0

版本 1.0.0-alpha01

2026 年 6 月 17 日

发布了 androidx.core.locationbutton:locationbutton:1.0.0-alpha01androidx.core.locationbutton:locationbutton-compose:1.0.0-alpha01androidx.core.locationbutton:locationbutton-testing:1.0.0-alpha01。版本 1.0.0-alpha01 中包含 这些提交内容

新功能

LocationButton 的 AndroidX 实现的初始 Alpha 版,可让基于 View 和 Compose 的应用轻松请求一次性精确位置信息权限。对于搭载 Android 16(API 36)或更低版本的设备,该库通过默认使用标准位置信息权限提示提供自动向后兼容性。

API 变更

  • 添加了 LocationButton View 作为基于 View 的应用的入口点。
  • 添加了 LocationButton 可组合项作为基于 Compose 的应用的入口点。
  • 添加了 OnPermissionResultListenerOnErrorListenerOnRequestPermissionsListener 以进行回调处理。
  • 添加了 TestLocationButtonProvider,以允许应用测试依赖于安全 LocationButton 的流程。