Pending Intent can be created as follows:
PendingIntent pi= PendingIntent.getActivity(Context context, int requestCode, Intent intent, int flags)
The above line of code retrieves a PendingIntent that will start a new activity, like calling Context.startActivity(Intent)
The last argument is the PendingIntent flag. The flags can take any of the following values:
FLAG_CANCEL_CURRENT -Flag for use withgetActivity(Context, int, Intent, int),getBroadcast(Context, int, Intent, int), andgetService(Context, int, Intent, int): if the described PendingIntent already exists, the current one is canceled before generating a new one.
FLAG_NO_CREATE-Flag for use with getActivity(Context, int, Intent, int), getBroadcast(Context, int, Intent, int), and getService(Context, int, Intent, int): if the described PendingIntent does not already exist, then simply return null instead of creating it.
FLAG_ONE_SHOT-Flag for use with getActivity(Context, int, Intent, int), getBroadcast(Context, int, Intent, int), and getService(Context, int, Intent, int): this PendingIntent can only be used once.
FLAG_UPDATE_CURRENT-Flag for use with getActivity(Context, int, Intent, int), getBroadcast(Context, int, Intent, int), and getService(Context, int, Intent, int): if the described PendingIntent already exists, then keep it but its replace its extra data with what is in this new Intent
No comments:
Post a Comment