0
votes

I'm sending push notification using FCM to Android device.

I'm using java based google API client for sending messages.

FCM request body for message using common notification object:

{
 "message": {
"notification": {
  "title": "FCM Notification",
  "body": "Notification from FCM"
},
"data": {
  "k1": "v1",
  "k2": "v2"
},
"token": "eeNFUXuDQ:APA91bGaLh5UeJcyJctFWlvC32ezPk7ZWp-D05ImpPWbSv_yc49igOioyBOMZg3bxl8L8fvNWTQW6LcptwZoiOwHtIN24uNHox1s2ql1Ir5Rm9Jk1DXPAPe79o20GXHZhY04-TRzpaXe"
}
}

Message sent to Firebase for delivery, response:

{  
"name": "projects/lacoya-1540956670279/messages/0:1544690320409950%b4fb2744b4fb2744"
}

But, in my android device, I'm getting only title value "FCM Notification" as a notification but I want to see some data as well like some custom JSON.

Please through some light if you face this earlier.

Regards,

1
Is that your actual token or did you change it a bit?Zun
Can you post your android codeReda
@Reda I am using java based client code to send push notification to my registered android device for getting notification. This is client code github.com/firebase/quickstart-java/blob/… I don't have android code. I just want if I send message using my java client, that should appear as a notification to device.S Singh
@SSingh Yes, the http post request seems to be okey, idk about the message json object, so without the android code to get the data, I don't know how we can figure it out.Reda

1 Answers

-1
votes

There was some some problem with android code. After using correct callback method, we are getting data. Below is the useful link.

https://firebase.google.com/docs/cloud-messaging/android/receive

Thanks for all of your efforts.