1

This. MyFirebaseMessagingService is not called when I send notifications from Firebase. This is my code. I have the MyFirebaseInstanceIDService and works properly.

@Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        String from = remoteMessage.getFrom();
        Log.d(TAG, "Mensaje recibido: " + from);

        if (remoteMessage.getNotification() != null) {
            Log.d(TAG, "Notificacion: " + remoteMessage.getNotification().getBody());

            mostratNotificacion(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
        }

        if (remoteMessage.getData().size() > 0) {
            Log.d(TAG, "Data: " + remoteMessage.getData());
        }
    }

and this is part of my manifest

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Miguel Barra
  • 79
  • 1
  • 2
  • 5
  • `FirebaseInstanceIDService` is not required now and seems like you are using old code for firebase. In the newer version only a single service is required – Vivek Mishra Jan 25 '19 at 04:43
  • For updated FCM you would not require MyFirebaseInstanceIDService class. For more refer this: https://firebase.google.com/docs/cloud-messaging/android/client and Make sure that Fire-base token is received in method onNewToken() first. Now only required class is **MyFirebaseMessagingService.java**. Find the class here : https://github.com/firebase/quickstart-android/blob/c750602a3ed103ced5ee603c6a5f13c6914855e6/messaging/app/src/main/java/com/google/firebase/quickstart/fcm/java/MyFirebaseMessagingService.java#L95-L109 – Pradip Tilala Jan 25 '19 at 04:52
  • See this answer - https://stackoverflow.com/a/52120871/6891563 – Khemraj Sharma Jan 25 '19 at 06:01

0 Answers0