When we use it ourselves Notification When a message is prompted in the notification bar , We click on the drop-down message , To open it app Specified page , If more information is needed , It can be done through PendingIntent.

In use , There are some problems , Mainly parameters FLAG_CANCEL_CURRENT and FLAG_UPDATE_CURRENT, The summary is as follows :

PendingIntent There is one getActivity method , The first parameter is the context , There's nothing to say , Second parameter  requestCode, This one says at the back , The third parameter is
Intent, Used to store information , The fourth parameter is the operation identifier for the parameter , It is commonly used FLAG_CANCEL_CURRENT and FLAG_UPDATE_CURRENT.


PendingIntent.getActivity(context, 0,
notificationIntent,PendingIntent.FLAG_CANCEL_CURRENT Time );

FLAG_UPDATE_CURRENT Will be updated before PendingIntent
News of , such as , You pushed the message 1, And in it Intent in putExtra Has a value “ABC”, Before clicking the message , Continue pushing the second message , And in it Intent in putExtra Has a value “CBA”, okay , At this time , If you click on a message 1 Or news 2, You'll find out , Both of them Intent All the information read from the “CBA”, That is to say , The second replaces the first


It's still the procedure above , You'll find out at this point , Click on the message 1 Time , No response , The second one can be click .

The reason for the above two problems lies in the second parameter requestCode, When requestCode When the value is the same , The latter will work on previous messages , So in order to avoid affecting the previous information ,requestCode Set different content each time .

©2019-2020 Toolsou All rights reserved,
Final review of database : Summary of comprehensive application questions Laplance operator ( Second derivative ) Simple learning of computer composition principle pyqt Button call python program _PyQt: Link button to function in program How much can you go up once you change jobs ? Today, I saw the ceiling of job hopping python in str Function usage _python in str Usage Summary of built-in functions MySQL trigger web The server nginx---linux Installation and deployment C++ Chapter V polymorphism exercises :( It's coming to an end )python Check built-in functions , How to check python Built in function