0

I have a NodeJS Server and when my React Native app receive a Push Notification from the Server, the app stop working.

In the Emulator the app just close and in the Cellphone with a Release APK isntalled the app close and show an alert saying that the application stop working.

Here I can show some configuration I added in my Android Application

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'

Notifications Listeners

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);
});

I attached a debugger in the AVM and no error was throw

Connected to the target VM, address: 'localhost:8624', transport: 'socket'

Disconnected from the target VM, address: 'localhost:8624', transport: 'socket'

Note

I do not know what happened in iOS because the app is not configured to use iOS

Eugenio Valeiras
  • 980
  • 1
  • 9
  • 30

1 Answers1

-1

The problem was that I had another dependency that was using the Push Notifications. I removed it and everything works perfect

Eugenio Valeiras
  • 980
  • 1
  • 9
  • 30