mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 17:42:24 +08:00
feat(messaging,android): save notification payload for messages that arrive in the foreground (#3896)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user