问题描述
public class Notification extends FirebaseMessagingService {
private static final String TAG =MyFirebaseNotification;
@Override
public void onMessageReceived(final RemoteMessage remoteMessage){
Map< String,String>数据= NULL;
Log.v(TAG,收到通知);
Log.v(TAG,remoteMessage.getData()。toString());
当应用程序被终止时,方法不会被调用。我怎样才能收到通知,即使应用程序被杀害,而不是在前台或后台。
请检查以下命令应用程序已关闭(重新启动后或刷卡后)
adb shell dumpsys包MY-PACKAGE | grep停止
如果您可以阅读 stopped = true
这意味着您的设备制造商实施了非标准行为,其中包含强行停止应用程序。 code> force-stopping 与禁用应用程序非常相似,直到用户再次打开它为止。
,而应用程序处于这种状态,许多android行为将无法正常工作(广播,警报..)
如果这是您正在看到的行为的根源你应该联系制造商,并要求他们通过消除这种非标准行为来修复设备
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.
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
这篇关于当应用程序被杀死时,使用FCM推送通知没有收到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!