Philipp
Philipp

Reputation: 11813

Default priority of notification channel on Android 8

I am in the process of changing the target SDK version to 26 and trying to use notification channels. I have some notifications for which I would like to hide the icon in the notification bar. Is this possible by default using Notification channels? Even if I set the channel's importance (and the notification's priority to MIN), the icon is displayed. I can then long click the notification and go to the system settings for notifications in my app. Then click the notification channel and then importance, which has "Medium" (German "Mittel", might as well be called "Default" in English) selected. Shouldn't this importance be "low"?

This is how I set up the channel (using Mono for Android):

            string name = GetString(Resource.String.DbQuicklockedChannel_name);
            string desc = GetString(Resource.String.DbQuicklockedChannel_desc);
            NotificationChannel mChannel =
                new NotificationChannel(NotificationChannelIdQuicklocked, name, NotificationImportance.Min);
            mChannel.Description = desc;
            mChannel.EnableLights(false);
            mChannel.EnableVibration(false);
            mNotificationManager.CreateNotificationChannel(mChannel);

Upvotes: 4

Views: 2961

Answers (1)

Philipp
Philipp

Reputation: 11813

It turned out that this is not respected because I am starting the notification with StartForeground. This is documented on https://developer.android.com/reference/android/app/NotificationManager.html#IMPORTANCE_MIN.

Upvotes: 3

Related Questions