1

I'm integrating FCM to my project. But I'm getting below error in Log while notification received. (Error text color is blue)

W/FirebaseMessaging: Received message with unknown type: text

My code is like this:

public void onMessageReceived(RemoteMessage remoteMessage) {
        Log.d("Notification", "Success");
        sendNotification(remoteMessage);
}

In this code, the first line is not executing and it is not debugging also.

AL.
  • 36,815
  • 10
  • 142
  • 281
Bhavesh Butani
  • 281
  • 2
  • 18

1 Answers1

7

Finally I got the solution

In php side I'm sending

"message_type":"text"

That's why I got above error.

As "message_type" keyword is predefined by FCM so it is conflicting. So change that keyword in PHP code.

Dhananjay M
  • 1,851
  • 22
  • 18
Bhavesh Butani
  • 281
  • 2
  • 18
  • ok but how did you fix it? did you remove this line from your code or replaced it by something else? – vanomart Dec 13 '16 at 12:33
  • 1
    "message_type" keyword is predefined by FCM so it is conflicting. So I change that keyword in PHP code. – Bhavesh Butani Dec 14 '16 at 06:12
  • 1
    Yes, after I post my comment I googled a bit figured that out. Here is the link for future reference: https://firebase.google.com/docs/cloud-messaging/server : "In addition to regular FCM messages, control messages are sent, indicated by the message_type field in the JSON object. The value can be either 'ack' or 'nack', or 'control' (see formats below). Any FCM message with an unknown message_type can be ignored by your server." – vanomart Dec 14 '16 at 17:16