标签:
###通知’
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.ic_launcher, "你来了一个通知", System.currentTimeMillis());
notification.setLatestEventInfo(this, "通知的标题", "正文 ", null);
manager.notify(1, notification);
###通知’----------制作可点击的通知--------例:打开一个新的通知
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.ic_launcher, "你来了一个通知", System.currentTimeMillis());
Intent intent = new Intent(this,ToActivity.class);//此意图是打开TonActivity活动
PendingIntent pi = PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
notification.setLatestEventInfo(this, "标题", "我是正文(*^__^*", pi);
manager.notify(1, notification);
标签:
原文地址:http://www.cnblogs.com/tangwanzun/p/5702270.html