This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
clearAll notifications on Android if count zero when in background #2521
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Update FCMService notification handler for Android when in background so count==0 initially clears all existing notifications, closely matching iOS functionality. Note that iOS only clears notifications if the count has gone down eg from 1 to 0. Notifications are not cleared if count not given.
Update payload documentation with note to explain behaviour on Android and iOS.
Please change or move the note if required.
Related Issue
#2520
Motivation and Context
If notification(s) are no longer relevant then they should be removed, even if app not running.
This can be signalled by setting badge count to zero.
This was not happening in Android.
Note that after all current notifications have been cleared (a) a new notification will be created if a message or title is given and (b) the notification event handlers are called if the app is running.
How Has This Been Tested?
Tested by sending notifications with different payloads to Android and iOS devices.
Types of changes
The change could be viewed as one or all of these types:
Checklist: