Reputation: 41
I get the NotificationListenerService to intercept the Notification and clear, and then want to intercept the Notification of the PendingIntent saved to the database, but PendingIntent not serialized, so I would like to obtain PendingIntend internal Intent and then use intent.toUri () method of serialization preservation To the database, but this time there is a problem, when I desynchronize Intent after calling startActivity (intent) when there is an exception:
Process: com.example.joee.cleardatademo, PID: 20441
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.VIEW flg=0x14008000 cmp=com.skype.raider/com.skype.android.app.main.HubActivity (has extras) } from ProcessRecord{4596be88 20441:com.example.joee.cleardatademo/u0a1647} (pid=20441, uid=11647) not exported from uid 11028
at android.os.Parcel.readException(Parcel.java:1474)
at android.os.Parcel.readException(Parcel.java:1427)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2104)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1419)
at android.app.ContextImpl.startActivity(ContextImpl.java:1065)
at android.app.ContextImpl.startActivity(ContextImpl.java:1047)
at com.example.joee.cleardatademo.activity.NotificationManagerActivity$2$1.onClick(NotificationManagerActivity.java:110)
at android.view.View.performClick(View.java:4569)
at android.view.View$PerformClick.run(View.java:18570)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5151)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
at dalvik.system.NativeStart.main(Native Method)
I/Process: Sending signal. PID: 20441 SIG: 9
Disconnected from the target VM, address: 'localhost:8633', transport: 'socket'
how can i save PendingIntent into database?Or other methods to achieve and save PendingIntent the same effect?
Upvotes: 4
Views: 945
Reputation: 41510
I think you misunderstand the purpose of PendingIntent
. It is supposed to be used to fire the Intent
it contains in the application different than the original one, but with the same permissions. This is how you can launch activities internal to other applications.
The way it does that is by having a connection with the original target via the binder mechanism in Android. Even if you save a PendingIntent
to a Parcel
, it will still have the connection to the original object when you restore the PendingIntent
back because it saves the connection token.
What you did, however, is tear out the Intent
from the PendingIntent
and try to launch it. It attempts to launch an activity from the original application, to which you don't have access. Unfortunately, I don't see a way for you to save the PendingIntent
to the database because you'd need to save the token I mentioned, and there isn't a reliable way to obtain it. It isn't even stored in Java code.
Upvotes: 1