diff --git a/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java b/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java index f97a4696..c014b263 100644 --- a/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java +++ b/packages/messaging/android/src/main/java/io/invertase/firebase/messaging/ReactNativeFirebaseMessagingReceiver.java @@ -26,6 +26,11 @@ public class ReactNativeFirebaseMessagingReceiver extends BroadcastReceiver { RemoteMessage remoteMessage = new RemoteMessage(intent.getExtras()); ReactNativeFirebaseEventEmitter emitter = ReactNativeFirebaseEventEmitter.getSharedInstance(); + // Add a RemoteMessage if the message contains a notification payload + if (remoteMessage.getNotification() != null) { + notifications.put(remoteMessage.getMessageId(), remoteMessage); + } + // |-> --------------------- // App in Foreground // ------------------------ @@ -39,11 +44,6 @@ public class ReactNativeFirebaseMessagingReceiver extends BroadcastReceiver { // App in Background/Quit // ------------------------ - // Add a RemoteMessage if the message contains a notification payload - if (remoteMessage.getNotification() != null) { - notifications.put(remoteMessage.getMessageId(), remoteMessage); - } - try { Intent backgroundIntent = new Intent(context, ReactNativeFirebaseMessagingHeadlessService.class); backgroundIntent.putExtra("message", remoteMessage);