I am trying to check for permissions being granted/revoked by user in Android Marshmallow. Unfortunately ContextCompat.checkSelfPermission()
(which is a warpper around Context.checkCallingOrSelfPermission
) seems to always return PackageManager.PERMISSION_GRANTED
(0) if you have included that specific permission in your manifest regardless of the current state of the permission (e.g. if the user has revoked the permission). I also tried someContext.checkCallingOrSelfPermission()
, but the result is the same.
Has anyone experienced this? I am using Android Marshmallow on nVidia Shield console (using nVidia's Beta program).
As it turns out, The targetSdkVersion in the manifest must be 23, mine was 22. If your target SDK is 23 (Android 6), all of the permissions (in your manifest) are disabled by default, whereas if your target SDK is 22 (Android 5.1) and your app is running on Android 6, all of the permissions are enabled by default when the user installs the app, and even if the user revokes the permissions later on, the mentioned API returns incorrect value (which is a bug in my opinion).
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