Android Service Notification back to APP

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.