I am using GCM to send push messages to multiple users, but even though I am getting success and message IDs in the response, I cannot debug them in FCM diagnostics and they don't arrive to the devices.
How can I debug this?
The message I'm sending:
{
"priority": "normal",
"time_to_live": 6000,
"delay_while_idle": true,
"content_available": true,
"notification": {
"title": "Title",
"text": "Text",
},
"data": {
"title": "Title",
"text": "Text",
},
"registration_ids": ["ID1", "ID2"]
}
The response is an array of message IDs.
Related
This is how I am sending a FCM notification to my Android device through Postman.
{
"to": "<fcm_token>",
"notification": {
"title": "Title",
"body": "Body",
"tag": "bar"
},
"android":{
"notification": {
"tag": "foo"
}
}
}
But the tag neither works in notification.tag nor in android.notification.tag part. I keep seeing old notifications, they are not dismissed (overwritten by new one).
What am I doing wrong?
I'm sending push notifications to my app via the firebase admin API. I use "DeviceGroups" to register my user's devices. Then I send notifications to the specific device group. The notifications are received well, bu in the firebase console, I can't see any label I added in the analytics label tag.
Here is the format of my message:
{
"to": "...",
"notification": {
"title": "LabelUno",
"body": "Messager",
"image": ""
},
"data": {
"apns_collapse_id": "id"
},
"apns": {
"headers": null,
"fcm_options": null,
"payload": {
"aps": {
"badge": null,
"category": null,
"thread-id": null,
"alert": null,
"sound": null,
"content-available": 1,
"mutable-content": 1
}
}
},
"fcmOptions": {
"analytics_label": "LabelUno"
}
}
I found this while researching the cause of this issue, but we are actively looking for a work arround. Please can anyone help ?
I have integrated pubnub API in one of my project. I am trying to get bundle of data that i have sent in payload. I have added FCM for push notification. I am getting push notification in all cases but not getting bundle data when app is killed or in background. Already getting payload object when app is in foreground but not getting any data when app is in background or killed.
Payload 1 :
{
"pn_gcm": {
"notification": {
"title": "Barack Obama",
"body": "12",
"channelName": "Hell 4_656"
}
},
"firstName": "Barack",
"lastName": "Obama",
"displayName": "Barack Obama",
"profileImageUrl": "abcURL",
"userId": "173",
"type": "sender",
"time": "1615958943297",
"message": "12"
}
PayLoad 2 :
{
pn_gcm={
notification={
title=BarackObama,
body=Hello,
image=Hell4_656
}
},
firstName=Barack,
lastName=Obama,
displayName=BarackObama,
time=1615958740553,
type=sender,
message=Hello,
profileImageUrl=abcURL,
userId=173
}
I am getting notification object when app is in foreground but not getting any of them when app is in background or killed.(Getting some FCM default object)
I am trying to get notification object in bundle when launch app from Notification tray
Answer
Made JSON payload like this :
{
"pn_gcm": {
"notification": {
"title": "Barack Obama",
"body": "18"
},
"body": {
"channelName": "Hell 5_657",
"firstName": "Barack",
"lastName": "Obama",
"displayName": "Barack Obama",
"profileImageUrl":
"http://3.137.127.137/quiqle/uploads/profile/1615523786_4866.jpg",
"userId": "173",
"type": "sender",
"time": "1615965488916",
"message": "18"
}
}
}
You need to add data with information which you want to receive with push into pn_gcm.
Information outside of pn_(gcm|apns) (including tjpse) will be delivered as regular messages
Message can be as follows:
using notification:
{
"pn_gcm":{
"notification":{
"title":"Chat invitation",
"body":"John invited you to chat",
"sound":"default"
}
}
}
Or using data:
{
"pn_gcm" : {
"data" : {
"room" : "Portugal vs Denmark",
"body" : "great match!"
}
}
}
or both:
{
"pn_gcm" : {
"notification": {
"title":"Portugal vs Denmark",
"body":"great match!"
},
"data" : {
"room" : "Portugal vs Denmark",
"body" : "great match!"
}
}
}
For an explanation on the different between data and notification, please read the official FCM docs, About FCM messages.
See also:
Why are my FCM push notifications not working?
I am trying to send image in push notification from firebase console but it doesn't work, so i tried to send from the postman but it doesn't work either. I tried other parameters like icon, image, media_url, mediaImgUrl..etc from Internet in the body.
Help me out here so that i can send image in notification.
{
"to": "tokennnnnnnnnnnn............",
"content_available": true,
"mutable_content": true,
"data":
{
"message": "Hey!",
"icon": ".....farm.png"
},
"notification":
{
"body": "Topic",
"sound": "default",
"icon": ".....farm.png"
}
}
Try sending image with this payload :
{
"message":{
"token" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"android": {
"notification": {
"body" : "This is an FCM notification that displays an image.!",
"title" : "FCM Notification",
"image": "url-to-image"
}
}
}
I'am trying to send push notification with pubnub from android app to ios app. I'am using folowing json as push notificatio message, it works for android but doesn't work for ios:
{
"pn_gcm": {
"message": "test message",
"message_id": 1464707948327,
"sender_id": "5735b2a2a3c4c3fe01d37600",
"chat_room": "",
"message_type": "text",
"date": 1464707948327,
"file_url": "",
"sender_name": "Sorocean Alexei"
},
"pn_apns": {
"aps": {
"payload": {
"message": "test message",
"message_id": 1464707948327,
"sender_id": "5735b2a2a3c4c3fe01d37600",
"chat_room": "",
"message_type": "text",
"date": 1464707948327,
"file_url": "",
"sender_name": "sender name"
},
"alert": "sender name: test message",
"badge": 1,
"sound": "default"
}
}
}