Search code examples
androidgradlegeolocationgoogle-play-services

Android 6.0+: geolocation disabled for my app (even if enabled in phone settings and manifest)


When I install and launch with Android Studio my app on a device with Android 6.0+, I have got the problem that the location services are disabled in the phone settings specifically for my app even if the location services are enabled on the device in the status bar. Here is the app authorizations menu relative to geolocation :

enter image description here

My manifest:

 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:name="android.hardware.location.gps"
                android:required="false"/>

Gradle dependencies:

compile 'com.google.android.gms:play-services-location:10.0.1'

Any idea about how to solve this issue?


Solution

  • Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app.

    Please, read this article about requesting permissions at runtime: https://developer.android.com/training/permissions/requesting.html