-
Notifications
You must be signed in to change notification settings - Fork 399
Description
As its mentioned here and here
Notification Payload should be updated from gcm
to new fcm
standard.
And pn_gcm
must be turned into pn_fcm
.
And here is several migration concernings described below.
Building message payload
To build payload I am using NotificationsPayload class and buildPayload function (from this SDK).
As we can see, buildPayload at this SDK still assign pn_gcm
to payload.
Finally, my message payload to be published is:
{
"message": {
"body": {
// Some payload
},
"pn_gcm": { // Here is important to keep pn_gcm, otherwise it won't works.
"notification": {
"title": "New Message",
"body": "Charlie has sent you a new message.",
"sound": "notification.wav",
"android_channel_id": "1:8768586xxxxx:web:958xxxx"
}
}
},
"channel": "XXXXXX-XXXXX"
}
Replacing pn_gcm
to pn_fcm
will not works, as i tried it serveral times.
Notifications won't be received in iOS/Android.
Server Side Processing Updates
I guess, my pn_gcm
will automatically processed into new FCM v1 format at PubNub server-side layer:
"fcm": {
"notification": {
"title": "New Message",
"body": "Charlie has sent you a new message.",
"sound": "notification.wav"
},
"android": {
"notification": {
"sound": "notification.wav"
}
}
}
And it is working right now with pn_gcm
as described here, but not pn_fcm
:
PubNub will continue to support the existing pn_gcm object for simple payloads. Since pn_gcm was based on an older and incompatible spec, the push server will attempt to remap the payload to the new FCM spec.
However, it will only work in some cases. Because the older spec was more forgiving, a payload that worked previously would be rejected as an error with the new FCM.
Addition consideration on SDK updates
Additionally, here pushGateway
prop at addChannels
function is still using apns2 | gcm
.
Don't sure if it's still relevant or have to be migrated into apns2 | fcm
.
Main Questions
- Should this SDK change
pn_gcm
topn_fcm
at this code lines ? - Should
pushGateway
to be updated intoapns2 | fcm
? - Should buildPayload need to be updated according to new Payload format ?
- Do I need to do something extra for my app codebase in case that now Notifications works well, or PubNub (Server team + SDK team) will handle migration on side itself?