The code to send the message is as follows:
Get Notification Manager
Notificationmanager Mnotificationmanager = (notificationmanager) getsystemservice (Context.notification_service);
int icon = Android. R.drawable.stat_notify_chat;
Long when = System.currenttimemillis ();
Create a new notification that specifies its icon and caption
Notification Notification = new Notification (icon, null, when);//The first parameter is an icon, the second argument is a caption, and the third is the notification time
Notification.defaults = notification.default_sound;//emits default sound
Intent openintent = new Intent (this, otheractivity.class);
Pendingintent contentintent = pendingintent.getactivity (this, 0, openintent, 0);//When a message is clicked, the openintent intent is sent to the system
Notification.setlatesteventinfo (This, "title", "I am Content", contentintent);
Mnotificationmanager.notify (0, notification);//The first parameter is a custom notification unique identifier
Excerpted from Lhttp://www.tuicool.com/articles/mjuuzi
Android Learning notes---Send status bar notifications