java.lang.SecurityException: Permission Denial: getIntentSender() from pid=1484, uid=10151, (need uid=1000)

空扰寡人 提交于 2019-12-10 19:24:50

问题


I am getting this error specifically on HTC DESIRE 626GPLUS DUAL SIM with Android 4.4.2

java.lang.SecurityException: Permission Denial: getIntentSender() from pid=1484, uid=10151, (need uid=1000) is not allowed to send as package android
       at android.os.Parcel.readException(Parcel.java:1472)
       at android.os.Parcel.readException(Parcel.java:1426)
       at android.app.INotificationManager$Stub$Proxy.cancelAllNotifications(INotificationManager.java:271)
       at android.app.NotificationManager.cancelAll(NotificationManager.java:220)
       at com.bakar.GcmIntentService.onHandleIntent(GcmIntentService.java:92)
       at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
       at android.os.Handler.dispatchMessage(Handler.java:110)
       at android.os.Looper.loop(Looper.java:193)
       at android.os.HandlerThread.run(HandlerThread.java:61)

回答1:


Try adding a try-catch to your code, like this :

NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
try {
    nMgr.cancelAll();
} catch (Exception e) {
    e.printStackTrace();
}

as cancelAll() may not be supported by the device model you mentioned.




回答2:


You cant request userid 1000 as this is system userid



来源:https://stackoverflow.com/questions/32228896/java-lang-securityexception-permission-denial-getintentsender-from-pid-1484

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!