gpt4 book ai didi

android - "D/Notification: allPendingIntents"更新通知时记录

转载 作者:行者123 更新时间:2023-12-05 00:05:39 27 4
gpt4 key购买 nike

我在更新进度时更新通知,每次我收到不在我的代码中的日志时:

D/通知:allPendingIntents

通知创建代码:

mProgressNotifBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setPriority(Notification.PRIORITY_HIGH)
.setContentTitle(notifTitle)
.setAutoCancel(false)
.setProgress(MAX_PROGRESS, 0, true)
.setContentIntent(getPendingIntent());
setOfflineNotificationChannelId();
Notification notification = mProgressNotifBuilder.build();
startForeground(NOTIF_ID, notification);
mNotificationManager.notify(NOTIF_ID, notification);

更新通知代码:

private void updateNotificationProgress(int present) {
mProgressNotifBuilder.setProgress(MAX_PROGRESS, present, false);
mNotificationManager.notify(NOTIF_ID, mProgressNotifBuilder.build());
}

这个日志是什么意思,我该如何解决?

最佳答案

希望能帮到你,我最近一直有这个问题,我觉得你需要补充一下:

.setChannelId(NOTIFICATION_CHANNEL_ID)

在您的代码中。另请查看此链接:https://developer.android.com/training/notify-user/channels并观看视频。

所以你的代码应该是这样的;

mProgressNotifBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setPriority(Notification.PRIORITY_HIGH)
.setContentTitle(notifTitle)
.setAutoCancel(false)
.setChannelId(NOTIFICATION_CHANNEL_ID) // <---- add this
.setProgress(MAX_PROGRESS, 0, true)
.setContentIntent(getPendingIntent());
setOfflineNotificationChannelId();
Notification notification = mProgressNotifBuilder.build();
startForeground(NOTIF_ID, notification);
mNotificationManager.notify(NOTIF_ID, notification);

关于android - "D/Notification: allPendingIntents"更新通知时记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58409069/

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