How come a GCM permission isn't granted on Android 6? -
background
i'm trying investigate app @ office needs change permissions, in order support android 6 nicely.
the problem
i've found permission needs confirmation , isn't, except 1 :
<uses-permission android:name=".permission.c2d_message"/>
it seems permission isn't mentioned anywhere for, 1 that's not granted automatically , yet can't find user can enable confirmation.
what tried
in order find permissions granted default , aren't , called code:
private void checkpermissionsofapp(string packagename) { packagemanager pm = getpackagemanager(); try { final applicationinfo applicationinfo = pm.getapplicationinfo(packagename, packagemanager.get_meta_data); log.d("applog", "listing permissions of app packagename: " + applicationinfo.packagename); packageinfo packageinfo = pm.getpackageinfo(applicationinfo.packagename, packagemanager.get_permissions); //get permissions string[] requestedpermissions = packageinfo.requestedpermissions; if (requestedpermissions != null) { (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 call:
checkpermissionsofapp(getpackagename());
using above code, crashes problematic permission, when using contextcompat.checkselfpermission says it's not granted.
the question
how be? how can grant app permission? mentioned anywhere?
the documentation, updated in october of 2015, still indicates need signature permission.
see not receiving push notifications gcm (android)
as @commonsware mentioned, not appear part of new runtime permission checking, or @ least not considered "dangerous" permission, , should automatically granted.
Comments
Post a Comment