Finding permission Group Name from permission Name Android -


i need find permission group name contacts,storage etc permission name. have following code

public arraylist<string> permissiongroup(arraylist<string> permission) {     arraylist<string>grouppermission = new arraylist<>();     packagemanager pm = getpackagemanager();     for(string entry : permission){         permissiongroupinfo info = null;             try {                 info =pm.getpermissiongroupinfo(entry,0);             } catch (packagemanager.namenotfoundexception e) {                 log.w("infoerror ", e.getstacktrace().tostring());             }                 if(info == null){                     log.w("infonull","error");                 }                 else {                     string loadlabelval = info.loadlabel(pm).tostring();                     log.w("groupname ", loadlabelval);                     if (!grouppermission.contains(loadlabelval)) {                         grouppermission.add(loadlabelval);                     }                 }     }     return grouppermission; } 

here input te function arraylist of permissions corresponding group needs found. getting pm.getpermissiongroupinfo(entry,0) null. dont know mistake. pls correct me.

thanks in advance.

to "short name" example "location" can use

packagemanager packagemanager = getapplicationcontext().getpackagemanager(); permissioninfo permissioninfo = packagemanager.getpermissioninfo(manifest.permission.access_fine_location, 0); permissiongroupinfo permissiongroupinfo = packagemanager.getpermissiongroupinfo(permissioninfo.group, 0); log.w("11_app", ""+permissiongroupinfo.loadlabel(packagemanager)); 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -