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) code>,
getBroadcast (Context, int, Intent, int) code>, and
getService (Context, int, Intent, int) code> : 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) code>,
getBroadcast (Context, int, Intent, int) code>, and
getService (Context, int, Intent, int) code> : 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 FLAG_UPDATE_CURRENT: For use with a Flag with the Constant Value: 134217728 (0 x08000000) getActivity (Context, int, Intent, int) code>,
getBroadcast (Context, int, Intent, int) code>, and
getService (Context, int, Intent, int) code> : This PendingIntent can only be used once. If set, after
send()
getActivity (Context, int, Intent, int) code>,
getBroadcast (Context, int, Intent, int) code>, and
getService (Context, int, Intent, int) code> : 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.
Read More:
- The reason and solution of Android intent value not updated
- Android can’t transfer value when using extras, bundle and intent
- The intent solution cannot be updated in onrestart method
- Tensorflow with tf.Session The usage of () as sess
- Android android.intent.category Purpose and use of. Launcher
- Uncaught Error: _registerComponent(…): Target container is not a DOM element
- Android: Web access activity error: error unknown URL scheme
- Network Error (dns_unresolved_hostname) -postman
- URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
- Gles2.0 Chinese API glgeterror
- Javabinder:
- Non system disk or disk error
- [$ injector:unpr ] Unknown provider:–angular.module () function solution
- Use XMLHttpRequest of JavaScript to send data to the background
- socket error 10035
- JS prompt cannot read property ‘style’ of undefined
- Ctfhub error injection
- Tensorflow in function tf.Print Method of outputting intermediate value
- there was an error running the selected code generator unable to retrieve metadata for
- can’t set headers after they are sent