Background
I'm trying to figure out which application in the office I need to change about my permissions in order to support Android 6 well.
Problem
I found which permission needs confirmation, and which is not, except for one:
<uses-permission android:name=".permission.C2D_MESSAGE"/>
This permission does not seem to be mentioned anywhere that I am looking for, as one that is not automatically granted, and yet I cannot find where the user can include it as confirmation.
What i tried
To determine which permissions are granted by default and which are not, I simply called this code:
private void checkPermissionsOfApp(String packageName) { PackageManager pm = getPackageManager(); try { final ApplicationInfo applicationInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA); Log.d("AppLog", "Listing all permissions of app with PackageName: " + applicationInfo.packageName); PackageInfo packageInfo = pm.getPackageInfo(applicationInfo.packageName, PackageManager.GET_PERMISSIONS); //Get Permissions String[] requestedPermissions = packageInfo.requestedPermissions; if (requestedPermissions != null) { for (String permission : requestedPermissions) { boolean permissionGranted = pm.checkPermission(permission, packageName) == PackageManager.PERMISSION_GRANTED; Log.d("AppLog", "permission:" + permission + " permissionGranted:" + permissionGranted); } } } catch (NameNotFoundException e) { e.printStackTrace(); } }
And the call:
checkPermissionsOfApp(getPackageName());
Using the code above, it is reset for problem resolution, but when using ContextCompat.checkSelfPermission, it says that it is not provided.
Question
How could this be? How can I give the application this permission? Is he mentioned somewhere?
source share