Using official AVD rev. 3
Calling this:
ActivityCompat.requestPermissions(activity, new String[]{"android.permission.USE_CREDENTIALS"}, REQUEST_PERMISSION_CREDENTIALS);
Fires immediately:
onRequestPermissionsResult (int requestCode, String[] permissions, int[] grantResults)
And resulting code is PackageManager.PERMISSION_DENIED
Anyone has a fix?
UPDATE: Known to be affected:
Manifest.permission.CHANGE_NETWORK_STATE
Manifest.permission.WRITE_SETTINGS (solved, see Sam's answer)
android.permission.USE_CREDENTIALS (solved, read Update 2)
READ_SMS
UPDATE 2: See excellent accepted answer. Essentially, USE_CREDENTIALS is a safe permission now. Beats me why sdk not simply return PERMISSION_GRANTED for it...
In case one or more permissions are not granted, ActivityCompat. requestPermissions() will request permissions and the control goes to onRequestPermissionsResult() callback method. You should check the value of shouldShowRequestPermissionRationale() flag in onRequestPermissionsResult() callback method.
Refer to these pages: permissions by protection level and protection level definitions.
Manifest.permission.CHANGE_NETWORK_STATE
Manifest.permission.WRITE_SETTINGS
These fall under the protection level "signature|appop|pre23|preinstalled" which means that only same-signature apps (system signed basically), app operators, apps that target below API level 23 and presintalled apps can have these.
android.permission.USE_CREDENTIALS
This is only needed on API level 22 and below. See this.
Also you should check out the Behavior Changes.
Regarding WRITE_SETTINGS
, CommonsGuy has provided a workaround here: https://stackoverflow.com/a/32083622/238753
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With