FCM onReceivedMessage() get Bundle

Viewed 3996

link of structure

I'm trying to get the message from my ArrayMap but I can not access the ReceiveMessage bundle. I tried to access Map directly, but it is very wrong

My code

public class FbService extends FirebaseMessagingService {
    public FbService() {
    }

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        // TODO(developer): Handle FCM messages here.
        // If the application is in the foreground handle both data and notification messages here.
        // Also if you intend on generating your own notifications as a result of a received FCM
        // message, here is where that should be initiated. See sendNotification method below.

        Map<String, String> params = remoteMessage.getData();
        String message =  params.get(3);

        Log.d("FbService", "Notification Message Body: " + message);



    }
}
3 Answers
Related