Help. Android Push Notifications received but not displayed.

Project is Bare(ejected) using SDK 42

Hello,
I’m currently stuck on an issue of displaying push notifications on Android physical device. I am using “expo-notifications”. I have gone through the setup for FCM/Firebase/expo-notifications.

When sending a push notification through expo push API, expo “Push notifications tool”, or Firebase console no push notification is being displayed BUT…

If app in foreground log (logcat) displays:
"D/RNFirebaseMsgReceiver: broadcast received for message"

If app in background log (logcat) displays:
"W/ReactNativeJS: No task registered for key ReactNativeFirebaseMessagingHeadlessTask"
or
"E/RNFirebaseMsgReceiver: Background messages only work if the message priority is set to ‘high’"

If app killed/quit log (logcat) displays:
"E/RNFirebaseMsgReceiver: Background messages only work if the message priority is set to ‘high’"

Any help is appreciated.

Thanks

Hey @jsonhoward, can you share the device(s)/android version(s) that this is occurring on? Also, can you share the configuration you’re sending the push notifications with?

Cheers,
Adam

Thanks for the reply. The device used for testing is a moto g(6)play running android version 9, it’s the only android device I have for testing purposes.

I’m sending the messages via AWS Lambda function:

...
messages.push({
        to: token,
        title,
        body,
        sound: "default",
        priority: "high",
        channelId: "imagine",
        data: {
          "content-available": 1,
        },
      })
...

The rest of the code is the same as documentation suggests for sending expo notifications.

Using this code in useEffect of App component register for token and to log incoming foreground notifications:

React.useEffect(() => {
    // Register for push Expo push token
    registerForPushNotificationsAsync().catch((error) => console.log(error));

    const unsubscribe = messaging().onMessage(async (message) => {
      console.log("Message handled in the foreground!", message);
    });

    return unsubscribe;
  }, []);

Using the following code in Index.js to log background notifications:

messaging().setBackgroundMessageHandler(async (remoteMessage) => {
  console.log("Message handled in the background!", remoteMessage);
});

Also, now if I send a test message via Firebase console, I now can receive BACKGROUND messages/notifications, with logcat displaying:
"W/FirebaseMessaging: Missing Default Notification Channel metadata in AndroidManifest. Default value will be used."

But still nothing if send through expo api.