The problem that the content extra data in the notification cannot be updated

Recently younger brother when writing a find out about the background data processing service within the PendingIntent NotificationManager to send the Notification of the Intent of the Extra data cannot update, unable to get even, after tests found that the same ID Notification first Intent can only be stored data, even if use the NotificationManager. Cancel also of no help.
Found after examined the related API, use the PendingIntent. GetActivity (mContext, 0, mActivity, 0); After the Notification is opened, the target Activity cannot retrieve any additional data from getIntent(). Set the flag of the getActivity function to either pendingintent.flag_update_current or pendingintent.flag_cancel_current according to the API.
Also put a PendingIntent, getActivity function can be used in several flag value meaning:

0:

Default value, if the described PendingIntent already exists, then keep it without change.

FLAG_CANCEL_CURRENT:

For use with a Flag with the getActivity (Context, int, Intent, int) , getBroadcast (Context, int, Intent, int) , and getService (Context, int, Intent, int) : if the described PendingIntent already exists, the current one is canceled before generating a new one. You can use this to retrieve a new PendingIntent when you are only changing the extra data in the Intent; By canceling the previous pending intent, this ensures that only entities given the new data will be able to launch it. If this assurance is not an issue, consider FLAT_Update_current

Constant Value: 268435456 (0 x10000000)

FLAG_NO_CREATE:

For use with a Flag with the 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.

Constant Value: 536870912 (0 x20000000)

FLAG_ONE_SHOT:

For use with a Flag with the getActivity (Context, int, Intent, int) , getBroadcast (Context, int, Intent, int) , and getService (Context, int, Intent, int) : This PendingIntent can only be used once. If set, after send()

FLAG_UPDATE_CURRENT:

For use with a Flag with the 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. This can be used if you are creating intents where only the extras change, and don't care that any entities that received your previous PendingIntent will be able to launch it with your new extras even if they are not explicitly given to it.

Constant Value: 134217728 (0 x08000000)


Read More: