Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to receive FCM Topic Messaging on iOS 9.2

I wrote application which uses FCM topic massaging to receive push notifications from server.

My HTTP request is:

https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{
"to":"/topics/Foo-bar",
"priority":"high",
"content_available": true,
"data":{
    "notification-type":"chat",
    "target":"Current User",
    "title":"Current User has sent you a message",
    "text": "hello1",
    "badge": 5  //Badge you want to show on app icon
   }
}

And I got response as:

{
"message_id": 6199072048907273657
 }

But it doesn't receives Notification on device.

And how to print Notification data in debugger??

like image 695
tabassum Avatar asked Dec 27 '17 17:12

tabassum


1 Answers

Payload should be like this. Instead of data use notification object.

{
"to":"/topics/test",
"notification":{
    "type":"test",
    "title":"test!",
    "message":"test"
     }
}
like image 119
sagarchavan Avatar answered Nov 09 '22 06:11

sagarchavan