2

I'm having trouble showing up the head up notification on android using react native. I have tried many things. Here is the code that I've ended up with:

const channel = new firebase.notifications.Android.Channel('test-channel', 'Test Channel', firebase.notifications.Android.Importance.Max)
                    .setDescription('My apps test channel')
                    .setLockScreenVisibility(firebase.notifications.Android.Visibility.Public)
                    .setSound('default');
    firebase.notifications().android.createChannel(channel);


    this.notificationListener = firebase.notifications().onNotification((notification) => {
        console.log("NOTIFICATION RCEIVED !!!!!!!!!!!!!!!!!!!!!!!!!");
        var notif = new firebase.notifications.Notification()
                    .setNotificationId(notification._notificationId)
                    .setTitle(notification._body)
                    .setBody(notification._body)
                    .android.setChannelId(channel._channelId)
                    .android.setSmallIcon('ic_launcher')
                    .setSound("default");

        firebase.notifications().displayNotification(notif);
    });

The notification are shown in the device tray and the notification badge shows the notification counter but no foreground notifications. What I'm missing ?

Hubert Solecki
  • 2,611
  • 5
  • 31
  • 63

0 Answers0