Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/android/FCMPluginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ public void onStop() {
Log.d(TAG, "==> FCMPluginActivity onStop");
}

}
}
2 changes: 2 additions & 0 deletions src/android/MyFirebaseMessagingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void onMessageReceived(RemoteMessage remoteMessage) {

Map<String, Object> data = new HashMap<String, Object>();
data.put("wasTapped", false);
data.put("title", remoteMessage.getNotification().getTitle());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a null check for " remoteMessage.getNotification()", because you send only data in FCM API , then background notification works - explained here. So in that case, 'remoteMessage.getNotification()' will be null and it will break.

data.put("body", remoteMessage.getNotification().getBody());
for (String key : remoteMessage.getData().keySet()) {
Object value = remoteMessage.getData().get(key);
Log.d(TAG, "\tKey: " + key + " Value: " + value);
Expand Down