Android Local Notifications

Source: Internet
Author: User

 Notificationmanager manager = (Notificationmanager) getsystemservice (Notification_service);                Notificationcompat.builder Mbuilder = new Notificationcompat.builder (demo10activity.this); Mbuilder.setcontenttitle ("test title")//Set the notification bar header. Setcontenttext ("Test Content"). Setticker ("Test notifications come Up")//notifications first appear in the notification bar, with an upward animation effect. Setwhen (System.currenttimemillis ())//notification of the time generated, will be displayed in the notification information, generally is the system acquired SetPriority (Notification.priority_default)//Set this notification priority//. Setautocancel (TRUE)//Set this flag when the user clicks the panel to let Notifications are automatically canceled. setongoing (false)//ture, set him as an in-progress notification. They are usually used to denote a background task where the user is actively involved (such as playing music) or is waiting in some way, thus occupying the device (such as a file download, synchronous operation, active network connection). SetDefaults (Notification.defau Lt_vibrate)//The simplest and most consistent way to add sound, strobe, and vibration effects to notifications is to use the current user default settings, using the Defaults property, which can be combined//notification.default_all N Otification. Default_sound add sound//requires vibrate permission. Setsmallicon (r.drawabLe.ic_launcher);//settings Notification small icon Intent Intent = new Intent (demo10activity.this,demo9activity.class);                Pendingintent pendingintent = pendingintent.getactivity (demo10activity.this, 0, intent, 0);                Mbuilder.setcontentintent (pendingintent);                Notification Notification = Mbuilder.build ();                Notification.flags = Notification.flag_auto_cancel; Manager.notify (1,notification);

Android Local Notifications

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.