Photo by Noelle Otto from Pexels

Android Notifications in 5 Minutes

Brandon Wever
Atomic Robot
Published in
5 min readJan 31, 2019

--

Notifications are one of the fastest and easiest ways to add more interactivity and engagement to your apps. Notifications provide quick snippets of information that your users need to know right now. Notifications also allow users to quickly take actions on events. We’ll work through all the most used examples of notifications and you’ll be notifying your users in no time.

Building a Notification

The first step to showing a notification to the user is to build the notification object. The Notification is built up using a NotificationCompat.Builder . The minimum information that is needed to display a Notification is: a small icon. That’s it, but its not very useful. Notifications should be useful to the user, so that will usually involve a title and a body. Below is a diagram of a common notification with the important bits labeled.

  • Small icon will be shown in the status bar, and it is important to know that they will be painted over in color. The reason this is important is is you’ll need an icon with alpha. If there is no alpha in the icon, you’ll end up with a great white square instead of your own branding.

--

--

Brandon Wever
Atomic Robot

Senior Mobile Developer. I love to teach the ways of Android and Kotlin.