1

Is there anyway to get the list of supported permission of your device/version? Or to check if the permission is supported by the device. I found a code but I think it only compare it on the app permission.

 PackageManager pm = this.getPackageManager();
        int hasPerm = pm.checkPermission(
            android.Manifest.permission.WRITE_EXTERNAL_STORAGE, 
            this.getPackageName());
        if (hasPerm != PackageManager.PERMISSION_GRANTED) {
           // do stuff
            Toast.makeText(this, "Not Supported", Toast.LENGTH_SHORT).show();
        }else{
            Toast.makeText(this, "Supported", Toast.LENGTH_SHORT).show();
        }

do anyone know to to check the permission if its supported by the device not only the application.

any thoughts will be highly appreciated.

Gangnaminmo Ako
  • 577
  • 11
  • 28

2 Answers2

0

Youre code checks if the app has the permission to write to external storage, if I read it right...

To find a list of permissions, those 2 links will help: http://developer.android.com/reference/android/Manifest.permission.html

Where can I get a list of Android permissions

Community
  • 1
  • 1
Manuel Allenspach
  • 12,467
  • 14
  • 54
  • 76
  • yes it is. that's why I'm asking how to check the permission if it is supported by the users devices not the app only – Gangnaminmo Ako Oct 04 '13 at 08:44
  • check the 2 links... Manifest.permissions holds the list of permissions. – Manuel Allenspach Oct 04 '13 at 09:16
  • I unchecked your answer because I think it only get all the permission of all the app installed on the device. Not all the permission that supported by the device. – Gangnaminmo Ako Oct 07 '13 at 07:09
  • Ok, that's bad... I googled a little bit, found some permission-classes like [java.security.permission](http://developer.android.com/reference/java/security/Permission.html), but I don't know what it does – Manuel Allenspach Oct 07 '13 at 17:03
0

In the documentation there's a method of PackageManger

public abstract List<PermissionGroupInfo> getAllPermissionGroups (int flags)

Retrieve all of the known permission groups in the system.

I haven't tried this myself. For a detailed description of the method you can look here.

Ashray Mehta
  • 375
  • 1
  • 7