Android Notification Is Not Showing As A Message

- 1 answer

The notification it self is working good, but not as I want. It vibrates and shows the icon defined but not as a Watsapp Notification and in the setCategory I put CATEGORY_MESSAGE but still, nothing!

on my App class i put :

        NotificationChannel channel = new NotificationChannel(CHANNEL_ID,CHANNEL_NAME,NotificationManager.IMPORTANCE_HIGH);
        NotificationManager manager = getSystemService(NotificationManager.class);
        assert manager != null;

Fragment :

private void T(String message){
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(),CHANNEL_ID)
    NotificationManagerCompat compat = NotificationManagerCompat.from(getApplicationContext());


This is How I want it to notify :

enter image description here

This is how is current notifying

enter image description here

I'm using the SDK 27



After discussing with OP in chat, here's my best explanation about what could have happened:

A notification channel can only be created once, after which it becomes immutable to the app. It can only be tweaked by the user through the Settings. If someone follows the examples in the official docs first, they might create the channel with IMPORTANCE_DEFAULT. After this, even if they change the code later, the channel will remain at level 'High: Make Sound' and not be set to 'Urgent: Make Sound and pop on screen' as desired. Docs on importance level

The code in the question is perfectly fine, and should create a channel with the 'Urgent' level when installed for the first time. In any case, uninstalling the app manually and then installing it again will recreate the channels, setting the level to whatever is mentioned in the latest code.