Override making error in Android Studio

725 views Asked by At

I have been trying to make an app which uses Firebase Push notification,But an getting this error in Myfirebasemessaginservie class which is "Method does not override method from super class" :

package com.flymit.firebasenotificationexam;

import com.google.firebase.messaging.FirebaseMessagingService;

public class MyFirebaseMessagingService extends FirebaseMessagingService{
    private static final String Tag="MyFirebasemsgservice";

    @Override
    public void onMessageReceived(){

    }
}

Help Please!

2

There are 2 answers

0
Sergey Glotov On BEST ANSWER

You forgot message parameter. Method declaration should look like onMessageReceived(RemoteMessage message).

1
sasikumar On

check once you have added in build.gradle file

dependencies {

compile 'com.google.firebase:firebase-messaging:9.4.0'

}

you missed parameters in that method .so change your method like this

 @Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    Log.i("TAG", "MESSAGE RECEIVED!!");

}