[英]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控制台发送的必填消息字段,并以黄色突出显示。
我明白了..它是如此简单::) getNotification()。getBody();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.