Skip to content

Commit

Permalink
generate message id if its missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Arnesson committed Oct 27, 2016
1 parent 31b9aa1 commit 699e15b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/android/FirebasePluginMessagingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ public void onMessageReceived(RemoteMessage remoteMessage) {
title = remoteMessage.getData().get("title");
text = remoteMessage.getData().get("text");
id = remoteMessage.getData().get("id");

}

if(TextUtils.isEmpty(id)){
Random rand = new Random();
int n = rand.nextInt(50) + 1;
id = Integer.toString(n);
}

Log.d(TAG, "From: " + remoteMessage.getFrom());
Log.d(TAG, "Notification Message id: " + id);
Log.d(TAG, "Notification Message Title: " + title);
Expand Down

0 comments on commit 699e15b

Please sign in to comment.