i want to show the notification in the status开发者_StackOverflow社区 bar after posting the notification from the user. What should i have to do?
for notification in status bar...
final NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification note = new Notification(R.drawable.msg,"New Message",System.currentTimeMillis());
PendingIntent i = PendingIntent.getActivity(this, 0, new Intent(this,notification.class), 0);
note.setLatestEventInfo(this,"NewMessage","You Receive "+count+" New Message", i);
mgr.notify(Notify,note);
There's a tutorial for that in the android dev guide: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
And the API reference pages are:
Notification: http://developer.android.com/reference/android/app/Notification.html
PendingIntent: http://developer.android.com/reference/android/app/PendingIntent.html
精彩评论