Vishesh
Vishesh

Reputation: 334

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 console message window

Upvotes: 1

Views: 766

Answers (1)

Vishesh
Vishesh

Reputation: 334

I got it.. its so simple: :) getNotification().getBody() ;

Upvotes: 5

Related Questions