Notifications in Android

Source: Internet
Author: User

General mobile phone has a status bar, showing battery power, signal strength, missed calls, SMS ... There is also a status bar above the Android screen. The notice here is that the notification is displayed on this status bar.

The steps to send notifications are as follows:
1). Get Notification Manager

Notificationmanager Mnotificationmanager = (notificationmanager)     

2). Create a new notification that specifies its icon and caption

inticon =Android. R.drawable.stat_notify_chat;Longwhen =System.currenttimemillis ();//The first parameter is an icon, the second argument is a caption, and the third is the notification timeNotification Notification =NewNotification (Icon,NULL, when); Intent openintent=NewIntent ( This, Otheractivity.class);//openintent Intent is sent to the system when a message is clickedPendingintent contentintent = pendingintent.getactivity ( This, 0, openintent, 0); Notification.setlatesteventinfo ( This, "title", "Content", contentintent); mnotificationmanager.notify (0, notification);

Notifications in Android

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.