Android - 跟踪通知onclicked

时间:2011-11-08 17:19:50

标签: android notifications

我希望在用户点击通知时启动活动但是没有用于通知的onclicked事件(?),那么我们怎么知道点击通知的时间?

谢谢!

2 个答案:

答案 0 :(得分:3)

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

查看那里的PendingIntent设置。

单击通知时将调用PendingIntent。

答案 1 :(得分:2)

Intent notificationIntent = new Intent(this, MyClass.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
单击通知时将调用

notificationIntent