Android Push Notification Channels

Updated 9 May 2018

Save

Android Push Notification Channels were introduced in Android Oreo (Android 8.0 / API Level 26) to provide a system to help users manage the notifications. Users can now change preferences for an individual notification channel ( like opt-outs, vibration etc.) instead of changing it for all the notifications from a specific app.

What are notification channels?

When an app pushes notifications, you may want to only allow a certain type of notifications, for example, important notifications related to certain activities, to appear in the notification panel.

Prior to Android Oreo 8.0, you can enable or disable notifications for individual apps. You can also silence notification for individual apps.

But you cannot selectively disable or enable some notifications of an app.

In Android Oreo, developers can group notifications of their apps into different notification channels (aka notification categories). The user can disable or enable individual notification channel based on his/her preferences. For example, you can allow notifications from a specific notification channel to bypass do not disturb.

What do you need to do?

If your app targets Android Oreo and above, you must implement one or more notification channels to display notifications to your users. If you don’t target Android 8.0 but your app is used on devices running Android 8.0, your app behaves the same as it would on devices running Android 7.1 or lower.

The main feature of channels is that users will be presented with options to control them, rather than toggling all of the app’s notifications. That way, you’ll be able to reduce your opt-out rate by segmenting your notifications. Here’s how the system UI looks like:

How to create notification channel?

To create a notification channel, follow these steps:

  1. Construct a Notification Channel object with a unique channel ID, a user-visible name, and an importance level.
  2. Register the notification channel by passing it to createNotificationChannel().

How to push notification according to notification channels?

There is a function setChannel() which is used to create the notification according to the channels. After you receive the notification from firebase you can generate it according to channels and the user will be able to manage to see the notification according to his her needs.

That’s all you need to make your notifications perfectly work with Android Oreo.

Thank you very much. This is Vedesh Kumar signing off.

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • J. Brin
    • Vedesh Kumar (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home