Service:private Notificationmanager Manager;manager = (notificationmanager) getsystemservice (Context.NOTIFICATION_ SERVICE); private void Shownotification (String beaconid) {Taskstackbuilder Stackbuilder = taskstackbuilder.create (getApplica Tioncontext ()); Adds the back Stack stackbuilder.addparentstack (mainactivity.class); Adds the Intent to the top of the stack Intent resultintent = new Intent (Getapplicationcontext (), mainactivity.c LASS); Bundle bundle = new bundle (); Bundle.putstring ("Bid", Beaconid); Resultintent.putextras (bundle); Stackbuilder.addnextintent (resultintent); Gets a pendingintent containing the entire back stack pendingintent resultpendingintent = Stackbuilder.getpendin Gintent (0, pendingintent.flag_update_current); Notification Notification = new Notification.builder (Getapplicationcontext ()). Setlargeicon (Bitmapfactory.d Ecoderesource (getresources(), R.drawable.ic_launcher)). Setsmallicon (R.drawable.ic_launcher). Setticker ("Buzz Exhibiti On "). Setcontentinfo (" Go "). Setcontenttitle (" exhibit Information "). Setcontenttext (String.fo Rmat ("You are viewing the exhibits no.%s, please click for details", Beaconid)). Setcontentintent (resultpendingintent). Setautocan Cel (True). SetDefaults (Notification.default_all). build (); Manager.notify (0, notification); }mainactivity:bundle Bundle = This.getintent (). Getextras (); if (bundle! = null) {if (Bundle.containskey ("bid")) {ShowImage (bundle.getstring ("bid")); } }
Summary and analysis of Ref:android Notification
Ref:android Notice of notification
Ref:android Notification Full Parse
Android Service Notification back to APP