I am trying to set up push-notifications for the android version of our ionic app (using Parse-JS-SDK) with back4app.com . I’ve followed the guides and set up firebase and checked from over there that notifications work and show up (they do). However, when I try to sent them over Parse - either the dashboard or via cURL - I can’t see them. My cURL:
It looks like the parse-server is not unwrapping the data (instead it is converted to a string?) but instead puts it into another data-field. Dropping the data-wrap from the cURL just gives an empty notification.
What am I doing wrong? How does it work for others? Did I overlook a setting or do I need to post the content differently? Any hints appreciated!
as said I am currently using the REST-Interface via cURL (with the code above) and the dashboard-UI for sending push messages. The later I tried both text and JSON formatted, but neither yields a notification that shows up - which is weird enough as the dashboard UI renders some previews what that is supposed to look like…
Do you think it would be different when issuing from cloud-code? I can try that if you want.
I’ve read the code and noticed that the notification-key is just pushed over, and hear, hear, if use that instead of data in my cURL, I see the message pop up!
curl -X POST \
-H "X-Parse-Application-Id: APPKEY" \
-H "X-Parse-Master-Key: MASTERKEY" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": "android"
},
"notification": {
"title": "Title",
"body": "All work and no play makes Jack a dull boy."
}
}'\ https://parseapi.back4app.com/parse/push
Cool. I’m glad you figured it out. But I believe it should work with your original curl command. I was asking to see the code you have on the client side to alert the push. Maybe the problem can be fixed over there.
so, now running JS-code in the parse-server (of a docker, but back4app shows the same). I am able to send push-notifications with the notifications:-field, but am seeing the same problem of data as before.
It does show up in the notifications are and the console.log, shows that data is converted to a string and put insidedata - which is incorrect.
I’ve also played around with other ways, including other fields in notification, but neither that nor any other fields seem to work at all. Unfortunately, notification doesn’t fully support all features that data is supposed to (e.g. mediaURL), but only title and body.
Is there anywhere production code I could look at? I really don’t get what I am doing wrong…
I am using capacitor for that. This only reacts if the app is in foreground when the message is received and regardless of the content won’t show in the notification area.
I now see, what you were getting at. Trying the firebase message creator, I am able to send a message with the extra image (just an https one though), that shows up in the notification area, but when I look at what capacitor hands over, there is no reference of it at all (second is the data given, when the message is clicked):