diff --git a/docs/PAYLOAD.md b/docs/PAYLOAD.md index 6acf4367e..c10d4c7f0 100644 --- a/docs/PAYLOAD.md +++ b/docs/PAYLOAD.md @@ -60,6 +60,8 @@ The following flowchart attempts to give you a picture of what happens when a pu - If the app is running in the background the push plugin then checks to see if `content-available` exists in the push data. - If `content-available` is set to `1`, then the plugin calls all of your `notification` event handlers. +> Note: if `count` is given as `0` then all notifications are first cleared: always on Android, and if the `count` has gone down on iOS + ## User clicks on notification in notification center - The app starts. diff --git a/src/android/com/adobe/phonegap/push/FCMService.java b/src/android/com/adobe/phonegap/push/FCMService.java index af9ebb028..db1738a72 100644 --- a/src/android/com/adobe/phonegap/push/FCMService.java +++ b/src/android/com/adobe/phonegap/push/FCMService.java @@ -329,6 +329,10 @@ private void showNotificationIfPossible(Context context, Bundle extras) { Log.d(LOG_TAG, "count =[" + badgeCount + "]"); PushPlugin.setApplicationIconBadgeNumber(context, badgeCount); } + if (badgeCount == 0) { + NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + mNotificationManager.cancelAll(); + } Log.d(LOG_TAG, "message =[" + message + "]"); Log.d(LOG_TAG, "title =[" + title + "]");