I create a BroadcastReceiver B which is registered by system_process:
IntentFilter filter = new
IntentFilter(TIME_ALERT_ACTION);
mContext.registerReceiver(this, filter, null, null);
An application A then calls a service of a system. This service after
executes some work then set pending broadcast to B:
PendingIntent sender = PendingIntent.getBroadcast(mContext,
IntentCounter, intent, PendingIntent.FLAG_ONE_SHOT);
...
am.set(AlarmManager.RTC_WAKEUP, time, sender);
However, I got this error:
"Permission Denial: getIntentSender() from pid=248, uid=10009, (need
uid=1000) is not allowed to send as package android".
Can anyone help me with this?
Thanks in advance,
Nga
On Mar 25, 7:23 pm, nguyenvuthiennga <nguyenvuthien...@gmail.com>
wrote:
Try putting this in your binder method implementation, around the code
that sets up the broadcast:
long oldId = Binder.clearCallingIdentity();
// ... code to set up the broadcast here
Binder.restoreCallingIdentity(oldId);
--
chris tate
android framework enginer
> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
>
>
It works! Thanks a lot!
You are so great! :)
Nga
On Mar 29, 4:48 pm, Christopher Tate <ct...@google.com> wrote:
> It sounds like your code in the system process is still running under
> application A's binder identity when trying to set the broadcast
> intent. You've forgotten that binder incalls run with the calling
> process's identity unless your code explicitly clears that state with
> Binder.clearCallingIdentity().
>
> Try putting this in your binder method implementation, around the code
> that sets up the broadcast:
>
> long oldId = Binder.clearCallingIdentity();
> // ... code to set up the broadcast here
> Binder.restoreCallingIdentity(oldId);
>
> --
> chris tate
> android framework enginer
>
> On Thu, Mar 25, 2010 at 10:23 AM, nguyenvuthiennga
>