How to use PendingIntent

satya - Saturday, September 12, 2009 9:12:46 AM

Here is the API ref

Here is the API ref

satya - Saturday, September 12, 2009 9:18:13 AM

Given an intent you will not know whether to


start an activity
start a service
send a broadcast

satya - Saturday, September 12, 2009 9:19:26 AM

A PendingIntent encapsulates these through three static methods


getActivity
getBroadcast
getService

satya - Saturday, September 12, 2009 9:19:57 AM

How use an Android PendingIntent

How use an Android PendingIntent

Search for: How use an Android PendingIntent

satya - Saturday, February 26, 2011 10:26:18 AM

some basics

By giving a PendingIntent to another application, you are granting it the right to perform the operation you have specified as if the other application was yourself (with the same permissions and identity). As such, you should be careful about how you build the PendingIntent: often, for example, the base Intent you supply will have the component name explicitly set to one of your own components, to ensure it is ultimately sent there and nowhere else.

A PendingIntent itself is simply a reference to a token maintained by the system describing the original data used to retrieve it. This means that, even if its owning application's process is killed, the PendingIntent itself will remain usable from other processes that have been given it. If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call cancel() to remove it.

satya - Saturday, February 26, 2011 10:28:55 AM

FLAG_UPDATE_CURRENT

if the described PendingIntent already exists, then keep it but its replace its extra data with what is in this new Intent. This can be used if you are creating intents where only the extras change, and don't care that any entities that received your previous PendingIntent will be able to launch it with your new extras even if they are not explicitly given to it.

satya - Saturday, February 26, 2011 10:31:52 AM

related method: filterequals

related method: filterequals

Two intents are equal if every thing matches ignoring "extras"

satya - Saturday, February 26, 2011 10:35:23 AM

PendingIntent and Extras

most likely when a pending intent is created, the extras from the original intent are still there and will be sent when that pending intent is resolved.

However, if you were to create a subsequent pending intent with different extras, unless you use an update flag, the extras will not be part of that intent.

satya - Saturday, February 26, 2011 10:35:44 AM

Are extras sent when a pendingintent is delivered?

Are extras sent when a pendingintent is delivered?

Search for: Are extras sent when a pendingintent is delivered?

satya - Tuesday, May 10, 2011 1:41:48 PM

See this research on PendingIntents and Alarms

See this research on PendingIntents and Alarms

There is a lot of discussion on how pending intents are unique and what happens extras etc. You will also see links to a number of useful posts on pending intents.

satya - Thursday, December 15, 2011 2:32:00 PM

How to make a pending intent unique based on an extra

How to make a pending intent unique based on an extra