Since Android 4.1 (API level 16) it's possible to specify a notification's priority
. If you set that flag to PRIORITY_MIN
the notification icon won't show up on the statusbar.
notification.priority = Notification.PRIORITY_MIN;
Or in case you use a Notification.Builder
:
builder.setPriority(Notification.PRIORITY_MIN);
As of Android 8.0 Oreo (API level 26) you have to set the importance
of the notification's NotificationChannel
to IMPORTANCE_MIN
:
NotificationChannel channel =
new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_MIN);
notificationManager.createNotificationChannel(channel);
...
builder.setChannelId(channel.getId())
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…