简体   繁体   中英

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 :

在此处输入图片说明

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM