前言:
针对弹出来的Notification 进一步处理
===============
1: 创建一个活动,当用户点击后,启动该活动
public class NotificationActivity extends Activity {
protected void onCreate(Bundle instance){
super.onCreate(instance);
setContentView(R.layout.notify_layout);
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
manager.cancel(1);
}
}
2: MainActivity 用来发送该消息
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notify = new Notification(R.drawable.ic_notify, "This is no", System.currentTimeMillis());
Intent intent = new Intent(this, NotificationActivity.class);
PendingIntent pI = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
notify.setLatestEventInfo(this, "222", "text", pI);
manager.notify(1, notify);