2
    public class Notification extends FirebaseMessagingService {

    private static final String TAG = "MyFirebaseNotification";

    @Override
    public void onMessageReceived(final RemoteMessage remoteMessage) {
        Map<String, String> data=null;

        Log.v(TAG,"notification Received");
        Log.v(TAG,remoteMessage.getData().toString());
    }
    }

Method is not being called when application got killed. How do i receive notifications even if the app is killed,not in foreground or background.

Jay
  • 473
  • 1
  • 6
  • 19

1 Answers1

1

Please check the following command while your app is closed (after a reboot or after swiping)

adb shell dumpsys package MY-PACKAGE | grep stopped

if you can read stopped=true it means that the manufacturer of your device implemented a non standard behavior consisting in "force-stopping" applications when they are swiped.

force-stopping is very similar to disabling the app until the user opens it again. while the app is in that state many android behaviors will not work (broadcasts, alarms..)

If this is the root cause of behavior you are seeing you should contact the manufacturer and request that they fix the device by removing this non-standard behavior

Diego Giorgini
  • 12,489
  • 1
  • 47
  • 50