New Issue Checklist
Issue Description
I have an existing code that is sending push notifications to both Android and iOS via the same call. The invocation in the cloud code looks like this:
return Parse.Push.send({
where: query,
expiration_interval: 36000, // NOTE: in seconds this is 10 hours
data: payload
})
where payload has been set to:
payload = {
alert: {
"body": "something",
"title": "title",
},
"sound": "myfancysound.wav",
"mutable-content": 1,
"threadId": "something",
"url": "https://something...",
"interruptionLevel": "time-sensitive"
}
You can see that it uses default iOS alert dictionary with couple of standard iOS params (interruptionLevel, mutable-content, ...) as well as user defined params (for example url).
Updating to the latest parse-server-push-adapter@6 and adding firebaseServiceAccount to the Android configuration does not work out of the box:
Actual Outcome
Error 1: Error: android.data must only contain string values
Using the existing code and just reconfiguring android push adapter config to use firebaseServiceAccount does not work.
erbose: _PushStatus 1H56NNwx6E: sending push to installations with 1 batches
verbose: Sending push to 1
info parse-server-push-adapter FCM sending push to 1 devices
ERR! parse-server-push-adapter FCM error sending push: Error: android.data must only contain string values
verbose: _PushStatus 1H56NNwx6E: sent push! 0 success, 0 failures
This indicates that the push notification was correctly targeted and posted to FCM API, however FCM API returned an error android.data must only contain string values. This is most probably coming from the fact that push data contain an alert dictionary with body and title instead of using just flat alert and title.
Flattening the payload makes the error go away, but:
payload = {
"alert": "something",
"title": "title",
"sound": "myfancysound.wav",
"mutable-content": 1,
"threadId": "something",
"url": "https://something...",
"interruptionLevel": "time-sensitive"
}
Parse log output is:
verbose: _PushStatus 28Tg8rzqsZ: sending push to installations with 1 batches
verbose: Sending push to 1
info parse-server-push-adapter FCM sending push to 1 devices
verb parse-server-push-adapter FCM tokens with successful pushes: ["f6d_Lyr6TH6OZhFLRMFDfs:APA91bH-ywNh186FRsx7XmzBKIjBZq4rFiKRTcCdiPXtiFmhF6oMKr-Lwwytise4TV0kAU_s4XVB6JpGShyga92oMUlr98mU5CcPYIrarTE2BJdHIaWBH6Rqff4exx50rzQGjwySZpfR"]
verbose: _PushStatus 28Tg8rzqsZ: sent push! 1 success, 0 failures
Error 2: Notification does not show up on Android device
The client side SDK receives a RemoteMessage with Bundle containing all the keys passed to sendPush but does not contain the data key, thus the code below returns null for all important params and push notification, despite reaching the device just gets silently dropped in handlePush.
https://github.com/parse-community/Parse-SDK-Android/blob/a08c5d1594b3a083671b493804eb1970c1ce6441/fcm/src/main/java/com/parse/fcm/ParseFirebaseMessagingService.java#L20-L42
Expected Outcome
I would expect existing code to either work or get some pointers how to adapt it to work using the new adapter.
Environment
Client
- Parse Server Push Adapter version: 6.0.0
Server
- Parse Server version: 7.0.0
New Issue Checklist
Issue Description
I have an existing code that is sending push notifications to both Android and iOS via the same call. The invocation in the cloud code looks like this:
where
payloadhas been set to:You can see that it uses default iOS
alertdictionary with couple of standard iOS params (interruptionLevel,mutable-content, ...) as well as user defined params (for exampleurl).Updating to the latest
parse-server-push-adapter@6and addingfirebaseServiceAccountto the Android configuration does not work out of the box:Actual Outcome
Error 1: Error: android.data must only contain string values
Using the existing code and just reconfiguring
androidpush adapter config to usefirebaseServiceAccountdoes not work.This indicates that the push notification was correctly targeted and posted to FCM API, however FCM API returned an error
android.data must only contain string values. This is most probably coming from the fact that push data contain analertdictionary withbodyandtitleinstead of using just flatalertandtitle.Flattening the payload makes the error go away, but:
Parse log output is:
Error 2: Notification does not show up on Android device
The client side SDK receives a
RemoteMessagewithBundlecontaining all the keys passed tosendPushbut does not contain thedatakey, thus the code below returnsnullfor all important params and push notification, despite reaching the device just gets silently dropped inhandlePush.https://github.com/parse-community/Parse-SDK-Android/blob/a08c5d1594b3a083671b493804eb1970c1ce6441/fcm/src/main/java/com/parse/fcm/ParseFirebaseMessagingService.java#L20-L42
Expected Outcome
I would expect existing code to either work or get some pointers how to adapt it to work using the new adapter.
Environment
Client
Server