Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android app not receiving firebase notification

My android app is not receiving any firebase notification. When I send a message from the firebase console it is showing that the process is completed and when the row is expanded it shows 0 message send, screenshot below

Screenshot

Expiry of the message is set to 1 minute.

I've added the FirebaseMessagingService , FirebaseInstanceIdService and added the services in the manifest like this

    <service android:name=".service.TjssFireBaseInstanceIdService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
    <service
        android:name=".service.TjssFireBaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

I've tried adding

android:enabled="true"
android:exported="true"

This is the onCreate method of application class

@Override
public void onCreate() {
    super.onCreate();
    mGlide = Glide.with(this);

    String token = FirebaseInstanceId.getInstance().getToken();
    if (token != null)
        M.log("Firebase Token", token);
}

and I've a valid token in the logcat output

I did everything they said the documentation, but it is not working. Did I miss something important?

like image 880
Sony Avatar asked Feb 17 '26 07:02

Sony


1 Answers

In your onCreate of Application add this

FirebaseApp.initializeApp(this);

this meaning context here

like image 156
Rishabh Dugar Avatar answered Feb 18 '26 20:02

Rishabh Dugar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!