简体   繁体   English

Android Firebase:当应用程序处于前台时如何从Firebase获取通知消息的消息文本组件

[英]Android Firebase : how get the message text component of notification message from firebase when app is in foreground

when we just have notification (display message) which can be sent through firebase console, our onMessageReceived method of the FirebaseMessagingService is called when our app is in Foreground. 当我们只有可以通过Firebase控制台发送的通知(显示消息)时,当我们的应用程序位于Foreground中时,将调用FirebaseMessagingService的onMessageReceived方法。 And to have notification i created Notification builder which works fine. 为了获得通知,我创建了工作正常的通知生成器。 Only issue that i am facing is to retrieve the message content, since it is not a data notification, remotemessage.getData() is null and even remotemessage.getNotificationBody() is also null. 我面临的唯一问题是检索消息内容,因为它不是数据通知,所以remotemessage.getData()为null,甚至remotemessage.getNotificationBody()也为null。 I have debug the program and remoteMessage is having one field which is storing the message sent but i am not able to retrieve it. 我已经调试了程序,remoteMessage具有一个字段来存储发送的消息,但我无法检索它。 Please help me. 请帮我。 Attached is the snapshot showing the required field of message sent from firebase console highlighted in yellow. 随附的快照显示了从Firebase控制台发送的必填消息字段,并以黄色突出显示。 Firebase控制台消息窗口

我明白了..它是如此简单::) getNotification()。getBody();

暂无
暂无

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

相关问题 当我的 android App 收到 firebase 消息通知,然后关机 - When my android App get firebase message notification, then shutting down 收到新消息Firebase Android时获取通知 - Get notification when there is a new message Firebase Android 在Android中-当应用程序处于前台时如何防止Firebase推送通知? - In android - How to prevent Firebase push notification when app is in foreground? 应用程序在前台时如何处理Firebase通知 - How to handle the Firebase notification when app is in foreground 使用 Firebase 的聊天应用程序:收到新消息时收到通知 - Android - Chat App using Firebase: Get notification when new message received - Android 当应用程序不在前台时,如何使用Firebase Cloud Messaging(Notification)在Android中获取抬头通知? - How to get Heads Up notification in android using Firebase Cloud Messaging(Notification) while the app is not in foreground? Android 在 Firebase 通知上将应用程序带到前台 - Android bring app to foreground on Firebase notification Firebase通知显示在textview中,而应用程序在前景中,但是当我单击通知消息不显示在textview中时 - firebase notification showing in textview while apps in foreground but while i click on notification message not showing in textview android 当应用程序在前台使用 Firebase 时不显示通知 - Notification not display when app in foreground using Firebase 当应用程序在前台时,通知消息似乎为空 - Notification message seems to be empty when app is on foreground
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM