Question

Here's a part of my manifest file:

<permission-group
    android:name="groupPerm"
    android:description="@string/perm_get_desc"
    android:icon="@drawable/ic_launcher"
    android:label="@string/perm_label" />

<permission
    android:name="bla.bla.GET_PHOTOS"
    android:description="@string/perm_get_desc"
    android:label="Access photos"
    android:permissionGroup="groupPerm"
    android:protectionLevel="dangerous" />
<permission
    android:name="bla.bla.DELETE_PHOTOS"
    android:description="@string/perm_delete_desc"
    android:label="Delete photos"
    android:permissionGroup="groupPerm"
    android:protectionLevel="dangerous" />

This doesn't give me any error. However, when I find in the Application manager this application and I go to Permissions, the two custom permissions show in the group Default, instead of the group I just declared above. Does anyone see what I am doing wrong?

Était-ce utile?

La solution

So here is the solution to my own question.

<permission-group
    android:name="bla.bla.groupPerm"
    android:description="@string/perm_get_desc"
    android:icon="@drawable/ic_launcher"
    android:label="@string/perm_label" />

<permission
    android:name="bla.bla.GET_PHOTOS"
    android:description="@string/perm_get_desc"
    android:label="Access photos"
    android:permissionGroup="bla.bla.groupPerm"
    android:protectionLevel="dangerous" />
<permission
    android:name="bla.bla.DELETE_PHOTOS"
    android:description="@string/perm_delete_desc"
    android:label="Delete photos"
    android:permissionGroup="bla.bla.groupPerm"
    android:protectionLevel="dangerous" />

Apparently, the permission group name should contain the package name also and not just the permission name, as in my previous example: groupPerm. I.e., the correct name should be: bla.bla.groupPerm, where bla.bla is the namespace. If you don't do this, the permissions will show under Default group and would be listed: bla.bla.DELETE_PHOTOS and bla.bla.GET_PHOTOS.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top