Affiliate links on Android Authority may earn us a commission.Learn more.

How to create a simple Android notification

August 23, 2025

Notifications are a powerful tool in the Android developer’s toolkit, helping to keep your users up-to-date on events that are happening inside your application, even when they’re not looking at your app directly. A well-timed and useful notification is also a great way to tempt the user into launching your application – particularly if they haven’t visited your app in a while!

In this article, I’m going to show you how to get started with notifications by creating a very simple and straightforward notification that, when tapped, launches the user’s browser and boots up a website (bonus points if you can guess what that website is going to be!)

create simple android notification

What goes into a notification?

As a bare minimum even the most simple of notificationsmustcontain the following:

There’sloadsof other notification settings you can use, and although some of them are pretty important (such as using a PendingIntent to define what happens when the user taps the notification) they are all optional. These three things are all you technically need, in order to create a fully-functioning notification.

notification app UI

Creating your notification

Like everything in Android, notifications have evolved over time. If you want to take advantage of some of the newer notification features while remaining backwards compatible with Android 3.0 and earlier, you’ll need to use NotificationCompat and its subclasses. NotificationCompat is available as part of the Android Support Library, so the first step is opening your project’s module-level build.gradle file and adding the support library to the dependencies section:

Once you’ve added the support library, you’re ready to create a basic notification:

notification

To help you test that this notification is working correctly, open your project’s activity_main.xml file and create the following layout:

Now it’s time to put your notification to the test! Install your project on either a physical Android device or an AVD (Android Virtual Device).

notification log

To trigger the notification, simply give the button a tap – you should see a new ‘Hello World’ notification.

Define your notification’s action

At this point, our notificationlooksthe part but if you tap the notification then things fall apart, as this notification doesn’t actuallydoanything. This is a problem, because if you tap pretty much any other notification on your Android smartphone or tablet, then something will happen – usually, thissomethinginvolves launching an Activity that’s related to the notification’s content, for example tapping on a ‘New email’ notification will launch the Gmail app.

While adding an action to your notification is optional, the reality is that the vast majority of applications add actions to their notifications, so it’s become a sort of unwritten rule – if a user taps your app’s notification and nothing happens, then chances are they’re going to be left feeling disappointed.

For this reason it’s highly recommended that you add at least one action to your notifications, so that’s exactly what we’re going to do.

You define a notification action using a PendingIntent. In this instance, I’m going to update our basic notification with a PendingItent that launches the user’s default browser app and boots up a website. Here’s the complete code:

Make these changes to your code, then re-install the updated project on your Android smartphone, tablet or emulator. Trigger the notification again, but this time verify to open the notification drawer and give the notification a tap – your device’s default browser should launch and take you directly to the Android Authority website (you’re welcome!)

Setting your notification priorities

Do you feel like multiple notifications are always vying for your attention? Maybe your smartphone is constantly buzzing, ringing, or flashing its LED lights, to the point where new notifications aren’t even something you get excited about anymore?

With us all installing more apps, and doing more activities on our Android devices than ever before, it’s easy to feel bombarded by notifications. So when you’re developing an app, how do you ensure that your most important notifications don’t get lost in the crowd? The answer is simple: notification priorities.

These handy new methods help Android devices sort their notifications more intelligently, so the most urgent notifications always end up on top of the pile.

The lower a notification’s priority, the more likely it is to be hidden from the user in certain situations (such as when they’re interacting with another application), whereas higher-priority notifications appear in a floating ‘heads-up’ window that interrupts whatever the user is currently doing. Notifications that have a high priority (specifically MAX, HIGH or DEFAULT) should also light up the Android device’s LED lights, making them even more difficult for the user to ignore.

If you don’t assign a priority to your notification, it’ll automatically be assigned PRIORITY_DEFAULT. Alternatively, you may let the Android system know exactly how important your notification is, using the setPriority() method. For example:

Going from highest priority to lowest priority, your options are:

And that’s a wrap. Of course, in this post we’ve only covered the basics of creating and employing Android notifications. Depending on what kind of functionality you’re aiming to achieve in your app, you can go much deeper, but whether you’re using basic notifications or more advanced ones, make sure to be thoughtful when using this powerful tool.

Do you have any tips for creating Android notifications? Please share them in the comments below!

Thank you for being part of our community. Read ourComment Policybefore posting.