Android: Notification vs Data payload
Closed this issue · 2 comments
Push notifications on Android are handled differently depending on whether the recipient app is in the foreground or background, and whether the push contains only a notification
or data
payload, or both.
Payload Type | Foreground | Background |
---|---|---|
Notification Only | App is notified through a callback | notification appears in system tray, app is not notified |
Data only | App is notified through callback | App is notified through callback |
notification and data | Data portion is given to app through callback | notification portion is handled by OS to display notification, data segment is provided to app through the launch intent when the user taps the notification |
The GCM Provider sends both notification and data segments in all pushes sent out.
This causes issues when it comes to the app handling the push notification, especially if the app expects a certain combination of notification and data. In the case of Cordova apps using phonegap-push-plugin
notifications need to be data only in order for the push to be handled correctly by Cordova.
I wanted to start a conversation about how to give Loopback devs more control of the payload when sending pushes to Android devices in a backwards compatible way. Perhaps allow the creation of Notifications with data
and notification
properties that are used if present, and fallback to the current behaviour otherwise?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS
file at the top-level of this repository.