简体   繁体   中英

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. 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. 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. Please help me. Attached is the snapshot showing the required field of message sent from firebase console highlighted in yellow. Firebase控制台消息窗口

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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