android 杀死程序收不到推送_当应用程序被杀死时,使用FCM推送通知没有收到

public class Notification extends FirebaseMessagingService {

private static final String TAG = "MyFirebaseNotification";

@Override

public void onMessageReceived(final RemoteMessage remoteMessage) {

Map 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.

解决方案

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


版权声明:本文为weixin_33511821原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。