系统权限下 自动启动通知使用权

android:sharedUserId="android.uid.system"


clipboard.png

public void setNotificationListenerAccessGranted(NotificationManager mNm,ComponentName componentName,boolean value)throws Exception{

Class claz_notifcation = NotificationManager.class;

Method method = claz_notifcation.getMethod("setNotificationListenerAccessGranted",ComponentName.class,boolean.class);

method.invoke(mNm,componentName,value);

}

public void AuxiliaryPermissionOn(SystemFunction sf){

NotificationManager mNm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

ComponentName componentName = new ComponentName("com.lanjiang.adverfunction","com.lanjiang.download.NotificationService");

try {

setNotificationListenerAccessGranted(mNm,componentName,true);

} catch (Exception e) {

Log.e("TAG","Excetption ",e);

e.printStackTrace();

}

}

你可能感兴趣的:(系统权限下 自动启动通知使用权)