这是服务类我showNotification方法:
private void showNotification() {
Notification notification = new Notification(R.drawable.icon,
"New Notification", System.currentTimeMillis());
Intent i = new Intent(this, myActivity.class);
i.putExtra("notification", "MyNotif");
i.putExtra("notifiedby", "NotedBy");
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, 0);
notification.setLatestEventInfo(this, "NotedBy", "MyNotif", contentIntent);
nm.notify(111, notification);
}
所以点击状态栏中的通知后,我会在myActivity结束。
问题是,这些行总是给人在myActivity 假 。
this.getIntent().hasExtra("notification")
this.getIntent().hasExtra("notifiedby")
不putExtra()用的PendingIntent工作吗?