【问题标题】:App with FINE_LOCATION installed on devices without GPS?在没有 GPS 的设备上安装了 FINE_LOCATION 的应用程序?
【发布时间】:2017-01-27 10:52:20
【问题描述】:

我的 GPS 应用开始安装在没有 GPS 硬件(例如 Pixel C)的设备上。我特别要求我的应用具有 GPS 级别的精度。

我的build.gradle 文件看起来像

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.1"

  defaultConfig {
    applicationId "my.application.id"
    minSdkVersion 15
    targetSdkVersion 22
  }
}

如何确保我的应用仅安装在 GPS 硬件上?我的应用发生了什么变化?

【问题讨论】:

    标签: android android-location android-gps


    【解决方案1】:

    <uses-feature> page 中所述,如果您的目标是 API 21 或更高版本,ACCESS_FINE_LOCATION 不再暗示 android.hardware.location.gps 功能。

    虽然在大多数情况下这不会成为问题,因为 Wi-Fi 和 Cell-ID 足够准确,但如果您确实需要 GPS 硬件(例如,如果您是 GPS 导航应用或健身应用),您可以明确添加

    <uses-feature android:name="android.hardware.location.gps" />
    

    如同一页所述,ACCESS_COARSE_LOCATION 也已更改为不需要 android.hardware.location.network 功能。

    【讨论】:

      猜你喜欢
      • 2018-02-21
      • 1970-01-01
      • 2015-07-14
      • 1970-01-01
      • 2012-05-16
      • 1970-01-01
      • 2016-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多