在没有GPS的设备上安装FINE_LOCATION的应用程序?

时间:2016-09-19 17:02:42

标签: android android-location android-gps

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

我的build.gradle文件看起来像

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.1"

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

如何确保我的应用程序仅安装在GPS硬件上?是什么改变了我的应用程序?

1 个答案:

答案 0 :(得分:3)

正如<uses-feature> page所述,ACCESS_FINE_LOCATION如果您的目标是API 21或更高版本,则不再暗示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功能。

相关问题