My question is quite simple, but I couldn't get around it for a long time so I'm asking here.
How to hide the ongoing notification's icon, that is displayed in the status bar? I am creating the notification with NotificationCompat.Builder
object. I tried to skip (when the option to show icon is unchecked) the builder.setSmallIcon()
function call, but that resulted in no notification on the notifications screen.
Tap Notifications > App Settings. In some versions of Android, you'll see your list of apps on the Notifications screen. Tap See All. Find the app with the notifications you want to turn off, and tap the toggle to turn off notifications.
Once you're in the app settings, you'll notice the “Notifications” submenu. Open it. There you'll see a ton of notification options on a system level. You can basically choose to minimize status bar notifications for one particular type of notification.
Scrolling down the Quick Menu from the top of the screen, tap the Settings icon > "Display" > "Status bar icon manager" and then you can enable or disable the icons on the status bar.
Since Android 4.1 (API 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.
builder.setPriority(NotificationCompat.PRIORITY_MIN);
As of Android 8.0 Oreo (API level 26) you have to create a NotificationChannel
and set its importance
to IMPORTANCE_MIN
:
NotificationChannel channel =
new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_MIN);
notificationManager.createNotificationChannel(channel);
...
builder.setChannelId(channel.getId());
How to hide the ongoing notifications icon, that is displayed in status bar?
You don't.
I tried to skip (when the option to show icon is unchecked) the builder.setSmallIcon() function call, but that resulted in no notification in notifications screen.
Correct. Since the primary point of raising a Notification
is to put an icon in the status bar, there is no means to not put an icon in the status bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With