开发者

want to show notification in status bar after posting notification

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜