Android app not receiving firebase notification

android firebase firebase-notifications

554 观看


4659 作者的声誉

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


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">
            <action android:name="" />
            <action android:name="" />

I've tried adding


This is the onCreate method of application class

public void 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?

作者: Sony 的来源 发布者: 2017 年 9 月 15 日

回应 (3)


1169 作者的声誉

have you put google-services.json in your app folder ? . if not please put it in app folder and look information in this file it is relavant to your project or not . Try to send notification by selecting your application package name . I hope this will work. Thanks

作者: chandrakant sharma 发布者: 15.09.2017 05:25


0 作者的声誉

Make sure that your app is not running when you are sending the notification. If your app is in the foreground then you won't be able to receive notifications.

If you want to receive notifications when your app is in foreground, edit your service as follow:

public class TjssFireBaseMessagingService extends FirebaseMessagingService {

public void onMessageReceived(RemoteMessage remoteMessage) {

    if (remoteMessage.getNotification() != null) {
        Intent i = new Intent(getApplicationContext(), MainActivity.class);
        i.putExtra("Val", remoteMessage.getNotification().getTitle());

public void onDeletedMessages() {

The above code will start your main activity when a notification is received and your app is in foreground.

作者: user8583580 发布者: 15.09.2017 05:38


527 作者的声誉

In your onCreate of Application add this


this meaning context here

作者: Rishabh Dugar 发布者: 15.09.2017 06:30