Android sends multiple notification , <span style= "font-size:11.8181819915771px; font-family:arial, Helvetica, Sans-serif; " The ID of the >pendingintent is important. </span>
public void AddNotification (Jsonarray args, Callbackcontext callbackcontext) throws jsonexception {//notification_id = Args.getint (6); notification_id = (int) (Math.random () *10000); try {nm = (Notificationmanager) cordova.getactivity (). Getsystemservice ( Context.notification_service); Intent Intent = new Intent (CX, Cordova.getactivity (). GetClass ()); Intent.putextra (" ClickAction ", args.getstring (4)); String clickactionparams = Args.getjsonobject (5). toString (); Intent.putextra ("Clickactionparams", Clickactionparams ); Pendingintent pintent = pendingintent.getactivity (cx, <strong><span style= "color: #ff0000;" >notification_id</span></strong>, intent,pendingintent.flag_update_current); int version = Android.os.Build.VERSION.SDK_INT; Notification notify;//If the version number is greater than 15. That is, the Notification.builder method, if the version number is less than 15, that is, using the old method, avoid similar manaslu phone problems if (Version >) {notify = New Notification.builder (CX)//set to turn on the notification, the notification automatically disappears. Setautocancel (TRUE)//sets the notification prompt information displayed in the status bar. Setticker (args.getstring (0)) Sets the icon for the notification. SetsmallicOn (R.drawable.icon)//sets the caption of the notification content. Setcontenttitle (args.getstring (0))//Set the notification content. Setcontenttext (args.getstring (1) + notification_id). Setwhen (System.currenttimemillis ())//Set notification to start the program's Intent.setcontentintent (pintent). build (); else {notify = new Notification (R.drawable.icon, args.getstring (0), System.currenttimemillis ()); Notify.setlatesteventinfo (CX, args.getstring (0), args.getstring (1), pintent);} Send notification nm.notify (notification_id, notify);//notification displays x seconds after automatically clearing if (Args.getboolean (2)) {Disappeartime = Args.getlong (3); Handler Handler = new Handler () handler.postdelayed (new Runnable () {public void run () {//TODO auto-generated method stubn M.cancel (notification_id);}}, Disappeartime);}} catch (Jsonexception e) {e.printstacktrace ();} catch (Exception e) {e.printstacktrace ()}}
Android sends multiple notification