0

Inside my FirebaseMessagingService I have something like:

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
                Log.d(TAG, "Launching app");
                Intent i = new Intent(getBaseContext(), MainActivity.class);
                i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                i.putExtra(EXTRA_MESSAGE,remoteMessage);
                startActivity(i);
    }

When I send a FCM message when the app is closed I can see the log "Launching app". However, the app doesn't launch. This bug only happened recently after I updated the OS on my tablet.

I tested my app on another Android device that wasn't udpated recently and it works. Any ideas?

Joshua Augustinus
  • 1,468
  • 3
  • 15
  • 28

1 Answers1

2

Yes this is because Android has restricted opening activity from background after Android 10 but it might works web your app is open but strictly not work if it is in background .check out this: https://developer.android.com/guide/components/activities/background-starts

Maulik Togadiya
  • 594
  • 5
  • 10
  • I'm trying to make an app like Skype where you can recieve a Video call even if the app wasn't open. Should i be using something else now to notify user? Before i could launch the activity and show incoming call screen. – Joshua Augustinus Aug 31 '20 at 03:38
  • Yes for that you have to show full screen high priority notification.check out this and explore more. https://stackoverflow.com/a/58819729/7706832 – Maulik Togadiya Aug 31 '20 at 08:31