Push-уведомления не отображаются на переднем плане (когда приложение закрыто) в response-native-firebase - PullRequest
0 голосов
/ 08 мая 2019

React-native-Firebase push-уведомления не могут отображаться на переднем плане, когда приложение было закрыто.Если приложение открыто, то нет проблем с push-уведомлениями, они отображаются нормально.

async createNotificationListeners() {

this.notificationListener = firebase.notifications().onNotification((notification) => {
    const { title, body } = notification;

    const localNotification = new firebase.notifications.Notification({
        sound: 'default',
        show_in_foreground: true,
    }) 
 firebase.notifications().displayNotification(localNotification)
    .catch(err => console.error(err));
});

1 Ответ

0 голосов
/ 09 мая 2019

Вы не предоставили нам много информации, но если вы работаете на Android, вам нужно настроить каналы уведомлений согласно этой документации

    const channel = new firebase.notifications.Android.Channel(
      "main_notification_channel",
      "Main notification Channel",
      firebase.notifications.Android.Importance.Max
    ).setDescription("A natural description of the channel");
    firebase.notifications().android.createChannel(channel);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...