response-native-firebase - сбой приложения после получения push-уведомления (Android)

У меня есть NodeJS-сервер, и когда мое приложение React Native получает Push-уведомление от сервера, приложение перестает работать.

В эмуляторе приложение просто закрывается, а в мобильном телефоне с Release APK не закрывается приложение и отображается предупреждение о том, что приложение перестало работать.

Здесь я могу показать некоторые настройки, которые я добавил в свое приложение для Android

андроид / build.gradle

classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'

build.gradle

implementation project(':react-native-firebase')
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'

Слушатели уведомлений

export const configureMessaging = async () => {
  try {
    const enabled = await FirebaseMessaging.hasPermission();
    log('Push Notifications enabled?', enabled);
    return enabled;
  } catch (err) {
    return false;
  }
}; // This is returning true

export const configureOnNotificationDisplayed = () => FirebaseNotifications.onNotificationDisplayed((notification) => {
  // Process your notification as required
  // ANDROID: Remote notifications do not contain the channel ID.
  // You will have to specify this manually if you'd like to re-display the notification.
  console.log(notification);
});

export const configureOnNotification = () => FirebaseNotifications.onNotification((notification) => {
  // Process your notification as required
  console.log(notification);
});

export const configureOnNotificationOpened = () => FirebaseNotifications.onNotificationOpened((notificationOpen) => {
  // Get the action triggered by the notification being opened
  // Get information about the notification that was opened
  console.log(notification);
});

Я подключил отладчик в AVM и не было ошибки

Подключен к целевой ВМ, адрес: "localhost:8624", транспорт: "сокет"

Отключен от целевой виртуальной машины, адрес: "localhost:8624", транспорт: "сокет"

Заметка

Я не знаю, что произошло в iOS, потому что приложение не настроено на использование iOS

1 ответ

Решение

Проблема была в том, что у меня была другая зависимость, которая использовала Push-уведомления. Я удалил его, и все работает отлично

Другие вопросы по тегам