开发者

want to show notification in status bar after posting notification

开发者 https://www.devze.com 2023-03-03 21:37 出处:网络
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...

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

精彩评论

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

关注公众号