问题
I have my permissions set in my AndroidManifest.xml with no errors, yet when testing is on my device, the permissions are not requested.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="crproductionsptyltd.autoflora">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="login">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AddressActivity"
android:label="GPS">
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>
回答1:
First thing to note here is that Android permissions are no longer asked when the app is installed, but rather when the app has to use them so, you will never see a dialog asking to approve some permissions from Android 6+
. Another note is that the permissions are divided into 2 categories:
- Normal (no need to ask permission for them and are automatically granted by the system when the app is installed), including
android.permission.INTERNET
; - Dangerous (you have to explicitly ask for them), including any permission that has access to user private information or data.
In your case, the permission for INTERNET
will be granted by the system when the app is installed, without notifying the user, but the permission for LOCATION
will appear only when your app will use some functionality regarding this feature (not asking for them will most likely crash the app).
回答2:
Those permissions are not showed on run time, if you want to request permission on run time you should check https://developer.android.com/training/permissions/requesting.html
来源:https://stackoverflow.com/questions/41703214/android-permissions-not-being-requested