Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the exact difference between intent and pending intent? [duplicate]

Tags:

I am a newbie to Android. I read the Android Documentation but I still need some more clarification. Can anyone tell me what exactly a PendingIntent is?

like image 619
Rakesh Avatar asked May 11 '10 07:05

Rakesh


People also ask

What is the difference between intent and pending intent?

In conclusion, the general and main difference between Intent and PendingIntent is that by using the first, you want to start / launch / execute something NOW, while by using the second entity you want to execute that something in the future.

What is pending intent were do we use pending intent?

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.

What is pending intent in notification?

Android PendingIntent In other words, PendingIntent lets us pass a future Intent to another application and allow that application to execute that Intent as if it had the same permissions as our application, whether or not our application is still around when the Intent is eventually invoked.

How do I use pending intent?

To perform a broadcast via a pending intent so get a PendingIntent via PendingIntent. getBroadcast(). To perform an activity via an pending intent you receive the activity via PendingIntent. getActivity().


1 Answers

A PendingIntent is a token that you give to a foreign application (e.g. NotificationManager, AlarmManager, Home Screen AppWidgetManager, or other 3rd party applications), which allows the foreign application to use your application's permissions to execute a predefined piece of code.

If you give the foreign application an Intent, it will execute your Intent with its own permissions. But if you give the foreign application a PendingIntent, that application will execute your Intent using your application's permission.

like image 98
Lie Ryan Avatar answered Oct 24 '22 09:10

Lie Ryan