我有一個簡單的用例。我有如下活動: A > B > C
FLAG_ACTIVITY_CLEAR_TOP不能從通知部分工作
現在,我得到一個推送通知。
我做我的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);
我的期望是,活動B, C
應從Activity stack
被刪除,你應該重新定向到活動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:[email protected] – ranjjose