What is pendingIntent in android?

android, android-pendingintent

Solution

A `PendingIntent` is an `Intent` action that you want to perform, but at a later time. Think of it a putting an `Intent` on ice. The reason it's needed is because an `Intent` must be created and launched from a valid `Context` in your application, but there are certain cases where one is not available at the time you want to run the action because you are technically outside the application's context (the two common examples are launching an `Activity` from a `Notification` or a `BroadcastReceiver`.

By creating a `PendingIntent` you want to use to launch, say, an `Activity` while you have the `Context` to do so (from inside another `Activity` or `Service`) you can pass that object around to something external in order for it to launch part of your application on your behalf.

HTH

Problem

What is `pendingIntent` in android ? and when we should use it ? , I tried to read about it in android documentation, but unfortunately I didn't get the answer !

Original source

Related problems