android - Android 6.0+:我的应用禁用了地理位置定位(即使在手机设置和 list 中启用了地理位置定位)

标签 android gradle geolocation google-play-services

当我在装有Android 6.0及更高版本的设备上使用Android Studio安装和启动我的应用程序时,出现了一个问题,即即使状态为在设备上启用了位置服务,在专门针对我的应用程序的电话设置中也会禁用位置服务酒吧。这是与地理位置相关的应用授权菜单:

enter image description here

我的 list :

 <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依赖项:
compile 'com.google.android.gms:play-services-location:10.0.1'

关于如何解决此问题的任何想法?

最佳答案

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



请阅读本文有关在运行时请求权限的文章:
https://developer.android.com/training/permissions/requesting.html

关于android - Android 6.0+:我的应用禁用了地理位置定位(即使在手机设置和 list 中启用了地理位置定位),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41804041/

相关文章:

android - Google Play 结算包在哪里?

android - 在 TextView 中动态加载 AnimationDrawable

android - 最新支持库v26.0.0-beta1中面临的问题

reactjs - 使用 React 更新基于地理位置的 Google map

带有选项卡的 Android studio actionBar

java - Android单元测试如何创建ContentResolver stub ?

java - 用gradle排除compileOnly依赖项中已经包含的包

java - 使用Gradle时抽象模式类型未知

node.js - 查询附近纬度/经度数据库的最佳方式?

javascript - 地理位置 : Is there are way to find if someone is going up in the altitude