Skip to content Skip to sidebar Skip to footer

Android M: Can You Programatically Get The Full Set Of Permissions An App Would Like?

This isn't the same as the ones an app has been currently granted - that might be a subset of the ones it would like in total. This shows how to get the currently granted set. Befo

Solution 1:

As @CommonsWare commented, PackageInfo.requestedPermissions contains an "Array of all <uses-permission> tags included under <manifest>, or null if there were none."

I've tested this on a device running Android M, and the output I got included the permissions from all <uses-permission> tags regardless of whether those permissions had been granted or not, just as expected.

A minimal example for testing this:

try {
    PackageInfo pi = getPackageManager().getPackageInfo("com.example.foo", PackageManager.GET_PERMISSIONS);
    for (String perm : pi.requestedPermissions) {
        Log.e("Foo", perm);
    }
} catch (Exception e) {
}

Solution 2:

adb shell dumpsys package packagename will give you the permissions info requested by the app with packagename

Post a Comment for "Android M: Can You Programatically Get The Full Set Of Permissions An App Would Like?"