gpt4 book ai didi

android - 如何确保通知一目了然(而不是单挑)

转载 作者:行者123 更新时间:2023-11-29 18:35:10 25 4
gpt4 key购买 nike

我有一个在 I/O 任务期间弹出的通知,我想查看它以便用户知道详细信息在其他地方(状态栏)。在旧设备上,我的代码有效,但在新设备上,通知不会消失到状态栏,它变成了一个永久性的提醒。我希望在较新的设备上,通知更新(当前文件)会导致 peek 重置。任何人都知道一种方法可以确保通知是快速浏览,而不是提醒?

我的应用是全屏的,这就是为什么默认优先查看的原因。

    Util.createNotificationChannel(
applicationContext,
"copy",
"Copying...",
"Notifications for copy tasks.")

val builder = Util.createNotification(
applicationContext,
"copy",
applicationContext.getString(R.string.copyingImages),
applicationContext.getString(R.string.preparing))

val notifications = NotificationManagerCompat.from(applicationContext)
notifications.notify(builder.build())

...
(loop)

builder
.setProgress(images.size, index, false)
.setContentText(value.name)
.priority = NotificationCompat.PRIORITY_DEFAULT
notifications.notify(builder.build())

最佳答案

我相信Notification.Builder.setOnlyAlertOnce()将得到您期望的结果。

关于android - 如何确保通知一目了然(而不是单挑),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54681138/

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