【发布时间】:2014-07-09 11:50:07
【问题描述】:
我有一个简单的用例。我有如下活动:
A > B > C
现在,我收到了推送通知。
我在我的GCMIntentService 课程中执行以下操作:
在onMessage,
Intent notificationIntent = new Intent(context, A.class);
PendingIntent contentIntent =
PendingIntent.getActivity(context,0, notificationIntent,
PendingIntent.FLAG_CANCEL_CURRENT);
notification.setContentIntent(contentIntent);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP );
我的期望是应该从Activity stack 中删除活动B, C,并且应该将您重定向到活动A。
然而,A 被打开了;但是当你点击返回按钮时,我会再次按该顺序获得C, B, A!
我做错了什么?
这是我尝试过的事情:
我已经尝试过
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);,notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP, Intent.FLAG_ACTIVITY_SINGLE_TOP);我保留了对最后一个前台活动的静态引用,并将其作为
context传递。
似乎没有任何效果。
【问题讨论】:
-
嗨,你可以分享你的电子邮件ID吗?
-
@ArunAntoney:ranjjose@gmail.com
标签: android android-intent android-activity android-notifications android-notification-bar