gpt4 book ai didi

android - 奥利奥 : Stop notification from getting removed on swipe

转载 作者:行者123 更新时间:2023-11-29 16:34:12 25 4
gpt4 key购买 nike

我的代码:

mNotifyBuilder.setSmallIcon(R.drawable.ic_status_bar)
.setContentTitle("")
.setOngoing(true)
.setAutoCancel(false)
.setTicker("")
.setColor(ContextCompat.getColor(mContext, R.color.folderlist_bg_music))
.setChannelId(CHANNEL_ID)
.setContent(remoteViews).build();

在其他手机上工作正常,但在 Vivo V7 上不工作。第一次滑动时,通知被删除并重新出现。但是在第二次滑动时,它完全消失了。

最佳答案

选项 1:您需要按照以下方式进行操作:

builder.setOngoing(true);

选项 2:

Notification notification = new Notification(icon, tickerText, when);
notification.flags = Notification.FLAG_ONGOING_EVENT;

选项 3:

NotificationCompat.Builder mBuilder =

new NotificationCompat.Builder(this)

.setSmallIcon(R.drawable.ic_service_launcher)

.setContentTitle("My title")

.setOngoing(true)

.setContentText("Small text with details");

关于android - 奥利奥 : Stop notification from getting removed on swipe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53042254/

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