tags:

views:

196

answers:

1

Hi, I tried to understand from the api the porpese of PendingIntent, coz sometimes some method i use requires this, i still didnt get the idea right, anyone could exaplin? why cant i juse use context?

thanks,

moshik

+2  A: 

A PendingIntent is a combination of a gross action (start an activity? start a service? send a broadcast?), the action details (in the form of an Intent), and a Context. The PendingIntent is handed to the operating system, which will perform the gross action on the Intent at some future point (hence, "pending"). The Context is for security -- Android will execute the PendingIntent with only the permissions of the Context, so a PendingIntent cannot access things that the Context requesting it cannot.

CommonsWare
So if iam getting it right, i would use Pending Intent on regular Intent on cases when i wanna make sure i am accessing things that the context can access?
Moshik
You use a `PendingIntent` when you need one for a method parameter.
CommonsWare