作者:人帅刀快爱美女_915 | 来源:互联网 | 2023-07-24 16:13
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