我正在做一个聊天项目。当从 GCM 收到推送通知时,我需要导航到聊天联系人列表并清除我的应用程序之前打开的 Activity 。
最佳答案
在 GCMIntent 服务中传递挂起的 Intent 时,需要为 Intent 设置标志。 代码如下。如果有人在这个概念上苦苦挣扎,请使用它。
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, MainActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TASK), 0);
关于android - 从状态栏单击通知项时如何清除返回堆栈 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26023809/