How to use PendingIntent

Here is the API ref


start an activity
start a service
send a broadcast

getActivity
getBroadcast
getService

How use an Android PendingIntent

Search for: How use an Android PendingIntent

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.

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.

related method: filterequals

Two intents are equal if every thing matches ignoring "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.

Are extras sent when a pendingintent is delivered?

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

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.

How to make a pending intent unique based on an extra