Javatpoint Logo

what is pending intent with proper example?

By: dgoyal*** On: Sat Jun 22 13:15:59 EDT 2013     Question Reputation6 Answer Reputation5 Quiz Belt Series Points0  11Blank User
What is pending intent?
and how it is different from intent?
what is the use of pending intent?
with proper example.......

thanks.....
Up2Down

 
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, and that application sends/broadcasts the Intent you gave, they will execute the Intent with their own permissions. But if you instead give the foreign application a PendingIntent you created using your own permission, that application will execute the contained Intent using your application's permission.


NotificationManager notificationManager;
PendingIntent pendingIntent;

Updater() {
notificationManager = (NotificationManager) UpdaterService.this
.getSystemService(Context.NOTIFICATION_SERVICE);
notification = new Notification( android.R.drawable.stat_sys_download,
"MyTwitter", System.currentTimeMillis());
pendingIntent = PendingIntent.getActivity(UpdaterService.this, 0,
new Intent(UpdaterService.this, Timeline.class), 0);
}


----------------------------------------------------------


Intent English meaning is intended, pending said the impending advent of things.
The PendingIntent class is used to deal with is going to happen. For example, in the notification Notification for the jump page, but not immediately jump.

Intent is the timely start of the intent with which activity disappear and disappear.
PendingIntent can be seen as the intent of packaging, usually through getActivity, getBroadcast, getService get pendingintent instance, the current activity does not start immediately it contains intent, but in external execution pendingintent, call intent. Saved the Context of the current App pendingintent so that it gives the external App a capability the external App can be the same as the current App Intent pendingintent, even in the implementation of the current App no ??longer exists, but also through the presence the Context pendingintent still perform Intent. In addition, the operation can also handle after execution of intent. Often used together and alermanger and notificationmanager.
Intent is generally used as the Activity between Sercvice BroadcastReceiver pass data Pendingintent, generally used in the Notification, can be understood to delay the implementation of the intent PendingIntent to a packaging Intent.



Image Created0Down

By: [email protected] On: Sun Jun 23 03:16:46 EDT 2013 Question Reputation0 Answer Reputation392 Belt Series Points0 392User Image
Are You Satisfied :6Yes7No