I found that the new ChannelNotification approach does not replace the old logic; it adds another level of control for notifications. So, now we have 2 scenarios, see screenshot:

You can determine if notifications are enabled:
NotificationManagerCompat.from(context).areNotificationsEnabled();
You can determine if your notification is visible to the user:
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel notificationChannel = notificationManager.getNotificationChannel(channelId); int importance = notificationChannel.getImportance();
If the value is NotificationManager.IMPORTANCE_NONE , the user will not see the notification, but there is a notification, so you can use it using the Foreground service, and you must reject it. If the value of NotificationManager.IMPORTANCE_MIN or higher, the user will see a notification.
source share