I am using react-native v0.61.5 and latest versions of react-native-hms-push (App) and hms-push-serverdemo-nodejs.
My server app is able to send both Notification Messages both Data Messages.
What is unclear to me, is how messages must be implemented in order to have this:
when app is in a killed state: a messages is received, sounds on and a bubble appears, the user taps on the notification bubble, the App processes the notification payload while opening
when app is in a killed state: a messages is received, sounds on and a bubble appears, the user opens the App without tapping on the notification bubble, the App processes the notification payload while opening
when app is in a background state: a messages is received, sounds on and a bubble appears, the user opens the App without tapping on the notification bubble, the App processes the notification payload while opening
when app is in background state: a messages is received, sounds on and a bubble appears, the user opens the App without tapping on the notification bubble, the user opens the App without tapping on the notification bubble, the App processes the notification payload while opening
when app is in foreground state: a messages is received, sounds on and a bubble DOES NOT appears, (there are no bubbles to be tapped), the App processes the notification payload suddenly
We encountered some difficulties to satisfy all these 5 requirements listed above. What we have to send from server-side? Data Messages or Notification Messages?
We also tried to use:
let message = {
notification: {...},
android: {androidConfig..., notification: {foreground_show: [false|true]}},
token: new Array(pushDeviceToken)
};
both:
let message = {
data: notification,
android: {androidConfig..., notification: {foreground_show: [false|true]}},
token: new Array(pushDeviceToken)
};
But is seems that there is no the best option...
One more thing: it seems that foreground_show
does not works for Notification Messages, when I keep the App in opened state and send a Notification Message with foreground_show: true
, no bubble appears and the notification is not processed by the App.
The cause could also be a bad configuration on the App side. It is not very clear how to configure it, since we are new to HMS Push Kit.