Search code examples
androidandroid-locationandroid-gps

App with FINE_LOCATION installed on devices without GPS?


My GPS app started installing on devices that don't have GPS hardware such as the Pixel C. I specifically require GPS level accuracy for my app.

My build.gradle file looks like

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.1"

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

How can I ensure that my app is only installed on with GPS hardware? What changed that this is happening to my app?


Solution

  • As noted on the <uses-feature> page, ACCESS_FINE_LOCATION no longer implies the android.hardware.location.gps feature if you target API 21 or higher.

    While in most cases this won't be an issue since Wi-Fi and Cell-ID is accurate enough, if you really need GPS hardware (such as if you are a GPS navigation app or fitness app), you can explicitly add

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

    As noted on that same page, ACCESS_COARSE_LOCATION was also changed to not require the android.hardware.location.network feature either.