Reputation: 146
I'm using Firebase Cloud Messaging (FCM) with ios app. I'm now trying to get a data message without notification
using following method
application(_:didReceiveRemoteNotification:)
Can I send a data message using http://pushtry.com/? I have tried sending a data message from this site but nothing happens, while notification are working fine.
JSON for data message
{
"message":{
"token":"mytoken comes here",
"data":{
"Nick" : "Mario",
"body" : "great match!",
"Room" : "PortugalVSDenmark"
}
}
}
Is there any other site to test the data message without notification
?
Upvotes: 2
Views: 1524
Reputation: 358
This worked for us, you can use this to get data in the foreground & background of your application. This sends it silently and the user does not see it but you can programmatically react to this in your application.
{
"to": "{{fcm-token-here}}",
"content_available": true,
"data": {
"story_id": "story_12345"
}
}
Upvotes: 0
Reputation: 11539
You can send a silent notification with FCM by adding content_available
as true
to your payload.
{
"message": {
"token": "mytoken comes here",
"content_available": true,
"priority": "high",
"data": {
"Nick": "Mario",
"body": "great match!",
"Room": "PortugalVSDenmark"
}
}
}
Upvotes: 1