Android &引用;D/通知:所有待决事项”;更新通知时记录日志
我正在更新通知,而进度正在更新,每次我收到代码中没有的日志时:Android &引用;D/通知:所有待决事项”;更新通知时记录日志,android,logging,notifications,android-notifications,android-pendingintent,Android,Logging,Notifications,Android Notifications,Android Pendingintent,我正在更新通知,而进度正在更新,每次我收到代码中没有的日志时: D/通知:所有待定内容 通知创建代码: mProgressNotifBuilder=newnotificationcompat.Builder(此为通知通道ID) .setSmallIcon(R.drawable.ic_通知) .setPriority(通知。优先级高) .setContentTitle(notifTitle) .setAutoCancel(错误) .setProgress(最大进度,0,真) .setContent
D/通知:所有待定内容
通知创建代码:
mProgressNotifBuilder=newnotificationcompat.Builder(此为通知通道ID)
.setSmallIcon(R.drawable.ic_通知)
.setPriority(通知。优先级高)
.setContentTitle(notifTitle)
.setAutoCancel(错误)
.setProgress(最大进度,0,真)
.setContentIntent(getPendingIntent());
setOfflineNotificationChannelId();
Notification Notification=mProgressNotifBuilder.build();
启动前(不通知ID,通知);
mNotificationManager.notify(NOTIF_ID,通知);
更新通知代码:
private void updateNotificationProgress(int-present){
mProgressNotifBuilder.setProgress(最大进度,当前,false);
mNotificationManager.notify(NOTIF_ID,mProgressNotifBuilder.build());
}
此日志是什么意思?我如何解决它?我希望我能帮助您,我最近一直遇到此问题,我想您需要添加: .setChannelId(通知通道ID) 在你的代码中。 也请查看此链接: 然后看录像 所以你的代码应该是这样的
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);
mProgressNotifBuilder=newnotificationcompat.Builder(此为通知通道ID)
.setSmallIcon(R.drawable.ic_通知)
.setPriority(通知。优先级高)
.setContentTitle(notifTitle)
.setAutoCancel(错误)
.setChannelId(NOTIFICATION\u CHANNEL\u ID)//在通知到达时单击通知时是否关闭通知?嘿,找到解决方案了吗?@biscuite不,还没有!如果你有同样的问题,请投票。