Notifications Android Oreo
Artificial Intelligence AI
Data Factory
SendGrid Email Services
API Testing Postman
Legacy-application-modernization
workflow migration
Office 365 Calendar
Azure Serverless
1 2 22

Are you an Android developer? Did you change your application target SDK to 26?  Is the latest update of Android app stopped receiving your notifications? Consider implementing Notifications Android Oreo.

Google brings something new with each version of Android. One of the critical feature/enhancements will be around the way notifications are displayed to the user. The notification allows new interactions and features without even the need of opening the app.

Recently, Google has introduced notification channels to Android Oreo (8.0) which not only brought a cleaner look to the notification shade but also introduced Notification Channels along with other updates to the Notifications APIs.

What is the Android Notification Channel?

Notification Channels allow the application to group or categories the notifications and will enable the user to select the type of notifications they are interested. For instance, for a social networking app, the channels can be likes, comments, etc.

Android 8.0 (API level 26) introduced several new features for both users and developers. Some of the highlights include swift moves, minimizing back group activity, super-fast retrieval of preferences, Picture-in-Picture (PIP) mode and others.

From a developer perspective, with Android Oreo, it is mandatory for all notifications to be assigned to an Android Notification Channel. There are two types of notifications available.

  1. Local – Built and Configured within an app
  2. Remote – Remote notifications are sent remotely, giving developers and marketers the flexibility to send notifications at specified times and to specified groups of users.

How to Create Notification channel:

Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel. For each notification channel, you can set auditory and visual behavior that applied to all notification in that channel. Then, users can change these settings and decide the behavior of the channel.

In any given app, we can have multiple channels based on the functionality developer want to enable. Also, you can customize channels based on user preferences. For example, for messaging app, you can enable a channel for group of chats.

The user settings for notification channels are available for each app in the system settings, as shown in the figure below

 Notifications Android Oreo

Image Courtesy: Android Developer – Notification settings for the Clock app and one of its channels

Android Oreo Notification Channel

Creating Multiple vs Single Notification for an App:

Are you receiving single notification? However, your notification push server is sending multiple notifications? Please check for Pending Intent get activity parameter.

Notification Channels android

Your app should create distinct request ids instead of single id. This will change your result for multiple notifications.

Set Notification Importance:

Developers can configure app notification importance using notification manager.

notification channels

Below is list of importance options we have in notification channel.

IMPORTANCE_HIGH: Urgent
Makes a sound and appears as a heads-up notification

IMPORTANCE_DEFAULT

Makes a sound

IMPORTANCE_LOW

No sound

IMPORTANCE_MIN

No sound and does not appear in the status bar

Bypass Do Not Disturb (DnD) Option:

Android mobiles have the option to enable Do Not Disturb mode. This will stop the user from Vibrate, Audio, visual disturbances. With the notification channel, the developer has the opportunity to bypass the DnD option on app notifications.

android 8.0 notification channels

Badge Count:

Apps start show dots on app icons. When user long press on the icon, notification details will be shown to the user. Users can now enable/disable badge dots from app specific settings.

Below code, stop showing badge count on the app

notification channels apis

Conclusion:

The new notification channels in Android Oreo provides users with an improved experience and helps developers to be more decent in use of notifications. Notification channel is mandated implementation for Android apps when we change target SDK to 26, which is mandate compliance from Google to enhance security and performance effective from 1, Nov 2018.

Ramakrishna
Ramakrishna
Sr. Technical Lead