If you have this requirement, you may find that when you practice, multiple notifycation will pass the same data when clicked.
Normally we might write this.
Notification Notification = new Notification (r.drawable.ic_launcher_9, Name, System.currenttimemillis ());
Intent Intent = new Intent (Mcontext, Themeinfo.class);
Bundle bundle = new bundle ();
Bundle.putstring ("Apkid", PackageName);
Bundle.putboolean ("Isapplied", false);
Intent.putextra ("bundle", bundle);
Intent.addflags (Intent.flag_activity_new_task);
Pendingintent pendingintent = pendingintent.getactivity (mcontext, 0, intent, 0);
Notification.setlatesteventinfo (Mcontext, name, "Hello", pendingintent);
Notification.flags = Notification.flag_auto_cancel;
LOG.D ("Newthemechooser__:themechangereceiver", "Hascode:" + packagename.hashcode () + "installed" + packageName);
Notificationmanager.notify (Packagename.hashcode (), notification);
What's the reason?
The answer is on the Red font section.
Personally, the whole intent will be serialized into memory via parcel after notifycation click.
The data will be overwritten if the 2nd parameter of Pendingintent Requestcode is the same. Results in the same data being passed.
How to solve it?
It's simple, too.
Pendingintent pendingintent = pendingintent.getactivity (Mcontext, Packagename.hashcode (), intent, 0);
In other words, the 2nd parameter must be unique in different notifycation.
The answer is actually what I found on the StackOverflow. StackOverflow is a good place if you have a problem that you want to solve quickly.