-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to send push notifications to Android after updating to 6.0.0 #237
Comments
Thanks for opening this issue!
|
Initial investigation reveals that dictionary that is passed to This is what we get after preparing a dict to be sent to FCM:
Notice how The offending code comes from here where the dict is constructed: parse-server-push-adapter/src/FCM.js Lines 322 to 326 in 300b9bb
The |
@jimnor0xF would you mind taking a look at this? It may be easy for you to fix since you recently worked on some related changes 🙂 |
I have crafted an ugly PR which shows that |
@mman ...on a quick side note, were you able to test this on ios as well? Does the Apple Parse SDK expect push_id etc to be present? |
@jimnor0xF Nope, I have not tested this with iOS. I send notifications to iOS directly via |
I do not think they are used/required by Apple or Parse iOS SDK. They seem to be only an implementation detail in that they are set on the Parse Server, then delivered to Parse Android SDK, and there used to queue/buffer incoming push notifications based on their Looks like it may have been used to remove duplicates and keep only couple recent pushes queued? |
Just to confirm that I have pushed 6.2.0 to production and I can send push notifications to Android users without changes in the cloud code and without changes on the client side. Simply modifying the push adapter configuration by adding |
I've done some testing as well and can confirm @mman's result. I have only tested with Android, not with Apple. It may be possible that there are edge cases in which this doesn't work, but for the moment I'm unaware of any. I've overhauled the README for better structure and to provide better guidance in light of the FCM legacy API deprecation. Everything seems to be ready, so if there are no contrary opinions we'll prepare to send out a tweet in the next days. Are there any changes we should make in the Android SDK regarding |
No changes on the Android SDK side as far as I could see |
From the comments above regarding |
We would need to look into history to figure out why they were added in the first place and what was their purpose. From my short look I could see that |
Thanks for explaining, I guess we can leave as is for now. Opened parse-community/parse-server#9126. |
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
payload
has been set to: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 exampleurl
).Updating to the latest
parse-server-push-adapter@6
and addingfirebaseServiceAccount
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 usefirebaseServiceAccount
does 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 analert
dictionary withbody
andtitle
instead of using just flatalert
andtitle
.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
RemoteMessage
withBundle
containing all the keys passed tosendPush
but does not contain thedata
key, thus the code below returnsnull
for 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
The text was updated successfully, but these errors were encountered: