strongloop / loopback-component-push

Push notification component for LoopBack.
http://loopback.io/doc/en/lb2/Push-notifications.html
Other
96 stars 95 forks source link

Android: Notification vs Data payload #165

Closed MichaelMarner closed 6 years ago

MichaelMarner commented 6 years ago

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?

stale[bot] commented 6 years ago

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.

stale[bot] commented 6 years ago

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.