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 !

- 63,550
- 98
- 229
- 344
2 Answers
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

- 62,780
- 12
- 127
- 139
Kind of Intent which is not called immediately, but after some time like reaction to some action. In other way, you can give your permissions to other application with it.
It is used for example in widgets. When you click button, it performs defined with pending intent.
Continue here: What is an Android PendingIntent?