With the below code my notification are only added to the notification bar, no popup style message is displayed like if you would receive a whatsapp message when you\'re in
If you want use Heads-up Notifications like this:

You must change Notification priority or NotificationChannel importance.
The notification priority, set by setPriority(). The priority determines how intrusive the notification should be on Android 7.1 and lower. (For Android 8.0 and higher, you must instead set the channel importance)
On Android 7.1 (API level 25) and lower:
NotificationCompat.PRIORITY_HIGH or NotificationCompat.PRIORITY_MAX.setDefaults(Notification.DEFAULT_ALL)Android 8.0 (API level 26) and higher:
NotificationManager.IMPORTANCE_HIGHNotification:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.drawable.ic_wald_poi)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_poi))
.setColor(getResources().getColor(R.color.primary))
.setContentTitle(getString(R.string.hello))
.setContentIntent(notificationPendingIntent)
.setContentText(String.format(getString(R.string.notification), viewObject.getTitle()))
.setDefaults(NotificationCompat.DEFAULT_ALL)
.setStyle(bigText)
.setPriority(NotificationCompat.PRIORITY_HIGH) // or NotificationCompat.PRIORITY_MAX
Notification channel:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Create the NotificationChannel
val name = getString(R.string.notification_channel_name)
val descriptionText = getString(R.string.notification_channel_description)
val importance = NotificationManager.IMPORTANCE_HIGH
val mChannel = NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance)
mChannel.description = descriptionText
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(mChannel)
}
Important
If you'd like to further customize your channel's default notification behaviors, you can call methods such as
enableLights(),setLightColor(), andsetVibrationPattern()on theNotificationChannel. But remember that once you create the channel, you cannot change these settings and the user has final control of whether these behaviors are active. Other option is to uninstall and install application again. Read more
Examples of conditions that may trigger heads-up notifications include:
- The user's activity is in fullscreen mode (the app uses fullScreenIntent).
- The notification has high priority and uses ringtones or vibrations on devices running Android 7.1 (API level 25) and lower.
- The notification channel has high importance on devices running Android 8.0 (API level 26) and higher.
Priority:
Notification.PRIORITY_HIGHandNotification.PRIORITY_MAXwas deprecated in API level 26. useNotificationCompatinstead.
Here is more info :-)