Modern Push Notifications
For quite a few versions now Google keeps making changes to push notifications in Android. This update is no different, it brings few changes and updates to how these little pop-downs work and what can be done with them.
This article mainly focused on channels and how you can use them in your app, secondly what’s new in the notification in the newest Android Version Pie.
New Notification channels settings
Android 9 provides granular control to your notification channels for the user. So you should empower the user and clearly, channels are the way to empower them. So now let’s look into that how to them. First of all, they are now required for all the apps. They help you categorise your notifications that help the user to interact with them. And finally, in Android 9 users are allowed to customise their notification settings based on their preferences. For Example, Now users can block groups of channels, when a user does that, a broadcast intent is sent with a new state of notification channel. So when it comes to development, now we have to handle yet another possible exceptional state for our applications.
What’s new with notifications in Android 9.0 Pie
A new and interactive look
Before deep diving into the new features introduced in Android 9.0 Pie’s notifications, we’ll take a look at the visual changes — and there are a few of them.
- Improved readability — To make notifications easier to read and scan through, more padding is added into a single notification which resultant into the notifications shade has been tweaked to look a little more like a card, featuring rounded corners and a new section for each notification.
- Smooth app opening Animation — Instead of closing the notification and opening the app, now the notification transforms or entered into the app, which speeds up the transition more than twice. And the major point you don’t need to put extra effort into this quick transition effect, all you need to do is to make sure that you start the activity directly, in resultant of that your activity starts quickly.
- Enhance messaging experience — Ever since Android 7, we could an action to our displayed notification. Android 9 further enhances these functionalities by introducing Person class once you use API 28, which allows us to identify people involved in a conversation. This class pretty much replaces CharSequence when it comes to creating notifications for chats.
And now if you’re using the messaging style in notification, you can set your avatar using setIcon() method. From now on displaying images or stickers in notifications is easy. By using mentioned Person class one can use setData() to set image for any Message in notification builder.
- An improved version of Direct reply — As a user, you might have faced an issue while direct replying to a notification, and you accidentally tap on the notification, and that will open the app and the response you typing is lost. But from Android 9 this issue can be resolved with a quick fix by retrieving the data as a draft from the extra, So to make the user experience better especially in chatting application don’t forget to add:
- Direct Smart Reply — If you want to delight your user with better user experience you can use the setChoices() API to display them into your notification. In simple words, instead of replying to the notification, user can now tap one of the smart replies to reply.
So at-least let make a quick recap into some major highlighted points while implementing the Messaging Style.
- Use Messaging Style for Push Notification.
- Use setData() to include Images.
- Use setIcon() to show avatars.
- Provide Smart reply for delight and better user experience.
If you found this post useful, it would help others to find it if you could click on the 👏 icon below and also do follow for more articles like this — thanks!
Happy Coding :)