CodePudding user response:
The building Lord solvedCodePudding user response:
With q!!!!!CodePudding user response:
INotificationManager nm=INotificationManager. Stub. AsInterface (
ServiceManager. GetService (Context. NOTIFICATION_SERVICE));
Boolean enabled=true;//the default on
Try {
Enabled=nm. AreNotificationsEnabledForPackage (mAppEntry. Info. PackageName);
} the catch (android OS. RemoteException ex) {
//this does not bode well
}
CodePudding user response:
Can be invoked through reflectionCodePudding user response:
Upstairs method seems can't find the class INotificationManager, reflection is against this don't you say? Don't know how version support is?CodePudding user response:
How to use ah, send Buddha to the west, to the whole, thanksCodePudding user response:
Take a look at this article http://blog.csdn.net/zcllige/article/details/52444258CodePudding user response:
You can refer to this https://www.jianshu.com/p/28b8c0391c8dPublic static Boolean isEnableV26 (Context Context, String PKG, int uid) {
Try {
NotificationManager NotificationManager=(NotificationManager)
The context. GetSystemService (context. NOTIFICATION_SERVICE);
Method sServiceField=notificationManager. GetClass (). GetDeclaredMethod (" getService ");
SServiceField. SetAccessible (true);
The Object sService=sServiceField. Invoke (notificationManager);
Method Method=sService. GetClass (). GetDeclaredMethod (" areNotificationsEnabledForPackage
", the String class, Integer. TYPE);
Method. SetAccessible (true);
Return (Boolean) method. The invoke (sService and PKG, uid);
} the catch (Exception e) {
return true;
}
}