Unable to receive FCM Topic Messaging on iOS 9.2
Asked Answered
B

1

6

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??

Bold answered 27/12, 2017 at 17:43 Comment(4)
The response indicates that the message sent successfully. Are you able to verify that the device is subscribed to the topic?Radiochemistry
ya it was subscribed to topicBold
Can you do some things for me? First, send a message to the specific device's token from the Firebase console. Include a data payload with the message. Send the message while the app is in the foreground. Is onMessageReceived performing the expected actions? Then send a message while the app is in the background. Do you receive a notification? This will rule out the client as the issue. Now the payload you're showing is for a data-only message. Are you intending to include a notification in the payload as well? If so, you need to include the "notification" key in the payload.Radiochemistry
from firebase console to specific topic it was working when app is killed . Send the message while the app is in the foreground. Is onMessageReceived performing the expected actions? - in both case it was working i want to use data payload only using "data" payload it was working with foreground and backgroundBold
O
1

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

{
"to":"/topics/test",
"notification":{
    "type":"test",
    "title":"test!",
    "message":"test"
     }
}
Operatic answered 26/2, 2019 at 7:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.