简体   繁体   English

Firebase Cloud Messaging(FCM)无法获取数据

[英]Firebase Cloud Messaging (FCM) not getting data

I'm sending push notification using FCM to Android device. 我正在使用FCM向Android设备发送推送通知。

I'm using java based google API client for sending messages. 我正在使用基于Java的Google API客户端发送消息。

FCM request body for message using common notification object: 使用公共通知对象的FCM请求正文消息:

{
 "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: 邮件已发送到Firebase进行传递,回复:

{  
"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. 但是,在我的android设备中,我仅获得标题值"FCM Notification"作为通知,但我想查看一些数据以及一些自定义JSON。

Please through some light if you face this earlier. 如果您早些时候遇到这个问题,请通过一些光线。

Regards, 问候,

There was some some problem with android code. android代码存在一些问题。 After using correct callback method, we are getting data. 使用正确的回调方法后,我们正在获取数据。 Below is the useful link. 以下是有用的链接。

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

Thanks for all of your efforts. 感谢您的所有努力。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 调用“ https://fcm.googleapis.com/fcm/send”时,Firebase云消息传递出现内部服务器错误 - Firebase cloud messaging getting internal server error when calling “https://fcm.googleapis.com/fcm/send” addCompleteListener()尚未解决-Firebase Cloud Messaging(FCM) - addCompleteListener() is not being resolved - Firebase Cloud Messaging (FCM) MismatchSenderId错误Firebase云消息传递(FCM) - MismatchSenderId error Firebase Cloud Messaging (FCM) 如何向FCM(Firebase云消息传递)令牌的特定用户发送消息? - How to send a message to a specific user of an FCM (Firebase Cloud Messaging) token? 在Firebase Cloud Messaging上检查新通知。 (FCM) - Check for new notifications on Firebase Cloud Messaging. (FCM) 我无法在我的 android 仿真器中接收 Firebase 云消息传递 FCM - I Can' t receive the Firebase Cloud Messaging FCM In my android emulator 是否可以在没有 Firebase Cloud Messaging (FCM) 的情况下向所有安装了我的应用程序的设备发送推送通知? - is it possible to make push notifications to all devices which had installed my application without Firebase Cloud Messaging (FCM)? 如何使用Firebase Cloud Messaging根据Firebase数据发送通知 - How to send notifications depending on the Firebase data using Firebase Cloud Messaging FCM Cloud Messaging 与 Notifications 和 Message 的区别 - FCM Cloud Messaging difference from Notifications and Message Firebase推送通知云消息传递如何访问附加数据作为通知 - Firebase push notification cloud messaging how to access Additional Data as Notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM