gpt4 book ai didi

android - 从状态栏单击通知项时如何清除返回堆栈 Activity ?

转载 作者:太空宇宙 更新时间:2023-11-03 11:57:13 25 4
gpt4 key购买 nike

我正在做一个聊天项目。当从 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com