我正在开发Wear OS(Android 8)上的独立应用程序,我遇到了通知问题 .
我正在运行 Foreground Service
,正在进行通知 . 正在进行的通知非常有效,并且没有Wear OS的功能(因此代码可以在独立的Android上运行) .
However, whenever I want to display other notifications, it is impossible.
没有错误消息,没有:我的通知没有显示 . 我确保创建单独的 Channels 并启用它们(通过设置) .
这是我的代码,通过 Handler
在 Looper.mainLooper()
中运行 .
final Notification notification = new NotificationCompat.Builder(MonitorService.this, LOGS_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_backup_logs) // vector (doesn't work with png as well)
.setContentTitle(getString(R.string.monitor_service_notification_log_file_backed_up_process))
.setContentText("test")
.setPriority(NotificationCompat.PRIORITY_HIGH)
.build();
notificationManagerCompat.notify(LOGS_ID, notification); // unique final static id
我在这里错过了什么吗?
谢谢您的帮助 !
1 回答
使用此代码