繁体   English   中英

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

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

当我们只有可以通过Firebase控制台发送的通知(显示消息)时,当我们的应用程序位于Foreground中时,将调用FirebaseMessagingService的onMessageReceived方法。 为了获得通知,我创建了工作正常的通知生成器。 我面临的唯一问题是检索消息内容,因为它不是数据通知,所以remotemessage.getData()为null,甚至remotemessage.getNotificationBody()也为null。 我已经调试了程序,remoteMessage具有一个字段来存储发送的消息,但我无法检索它。 请帮我。 随附的快照显示了从Firebase控制台发送的必填消息字段,并以黄色突出显示。 Firebase控制台消息窗口

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

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM