gpt4 book ai didi

Android 通知 FLAG_AUTO_CANCEL 不工作

转载 作者:搜寻专家 更新时间:2023-11-01 07:40:28 25 4
gpt4 key购买 nike

大家好

我想使用下面的代码取消点击通知,但由于某些原因它总是在通知区域的正在进行的部分显示通知并且无法清除......

  NOTIFICATION_ID = NOTIFICATION_ID + 1;
Intent intent1 = new Intent(this, MyClass.class);
PendingIntent pii = PendingIntent.getActivity(this, 1, intent1, 0);
Notification notification1 = new Notification(R.drawable.icon, "test",
System.currentTimeMillis());

notification1.setLatestEventInfo(this,
"test", "test", pii);

notification1.flags |= Notification.FLAG_AUTO_CANCEL;
startForeground(NOTIFICATION_ID, notification1);

谢谢

最佳答案

FLAG_AUTO_CLEAR 不适用于 startForeground()

关于Android 通知 FLAG_AUTO_CANCEL 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4561521/

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