How to show Android Notifications on screen as well as status bar icon?

All things considered, it's a really good idea to use NotificationCompat.Builder over Notification.Builder, let alone creating a Notification manually. It gives you nice backwards compatibility with graceful degradation (all the way back to API Level 4, otherwise known as "gadzooks, that's old"). AFAIK, it's the only way to get some of the Android Wear stuff going, when used in concert with NotificationManagerCompat. And, in this case, it seems to be happier with the newer Android 5.0+ features.

In this case, setPriority(NotificationCompat.PRIORITY_HIGH) on a NotificationCompat.Builder, used with NotificationManagerCompat, will give you the heads-up notification on Android 5.0+.


Another point, make sure the 'importance' of the notification channel you have set up for your notification is set to NotificationManager.IMPORTANCE_HIGH.

This configures how visually intrusive notifications posted to this channel are and 'high' will allow it to peek. If you have this set to NotificationManager.IMPORTANCE_DEFAULT then it won't!

Bear in mind when configuring a notification channel, once the code has ran on your device, you won't be able to alter this again. So if you need to change the importance you will need to uninstall the app and then re-run and you should see the notification on your screen!