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

Fix title and message for Firebase #806

Merged
merged 2 commits into from
Aug 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@ public class RNPushNotificationListenerService extends FirebaseMessagingService
@Override
public void onMessageReceived(RemoteMessage message) {
String from = message.getFrom();
RemoteMessage.Notification remoteNotification = message.getNotification();

final Bundle bundle = new Bundle();
// Putting it from remoteNotification first so it can be overriden if message
// data has it
if (remoteNotification != null) {
// ^ It's null when message is from GCM
bundle.putString("title", remoteNotification.getTitle());
bundle.putString("message", remoteNotification.getBody());
}

for(Map.Entry<String, String> entry : message.getData().entrySet()) {
bundle.putString(entry.getKey(), entry.getValue());
}
Expand Down