Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit ccd9edc

Browse files
authored
Merge pull request #806 from Truebill/steelbrain/fix-title-message
Fix title and message for Firebase
2 parents b61ce08 + 150efb0 commit ccd9edc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationListenerService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,17 @@ public class RNPushNotificationListenerService extends FirebaseMessagingService
3030
@Override
3131
public void onMessageReceived(RemoteMessage message) {
3232
String from = message.getFrom();
33+
RemoteMessage.Notification remoteNotification = message.getNotification();
3334

3435
final Bundle bundle = new Bundle();
36+
// Putting it from remoteNotification first so it can be overriden if message
37+
// data has it
38+
if (remoteNotification != null) {
39+
// ^ It's null when message is from GCM
40+
bundle.putString("title", remoteNotification.getTitle());
41+
bundle.putString("message", remoteNotification.getBody());
42+
}
43+
3544
for(Map.Entry<String, String> entry : message.getData().entrySet()) {
3645
bundle.putString(entry.getKey(), entry.getValue());
3746
}

0 commit comments

Comments
 (0)