From 699e15b6ee76ac3833e2fda6004196524b5c2a3f Mon Sep 17 00:00:00 2001 From: Robert Arnesson Date: Thu, 27 Oct 2016 10:37:53 -0400 Subject: [PATCH] generate message id if its missing --- src/android/FirebasePluginMessagingService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/android/FirebasePluginMessagingService.java b/src/android/FirebasePluginMessagingService.java index 68f60bd94..3c5c7ecb4 100755 --- a/src/android/FirebasePluginMessagingService.java +++ b/src/android/FirebasePluginMessagingService.java @@ -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);