Bug in some Android launchers that causes a partial restart instead of resume

As explained here:
https://code.google.com/p/android/issues/detail?id=2373

And here:

There is a bug in some Android launchers that cause this problem:
If you push the home button on Android it takes you to the home screen.
Then, if you push the icon to go back to your app, your launch Activity is being started and added to the top of the Activity stack when the app is being resumed by the launcher. So, it is resuming the app, but it is also running the launch and startup activity of your app again (without the splashscreen).

This affects some Android phones that use a non-google launcher (like a Samsung or Moto launcher) for example.

Evidently, one solution is to do something similiar to this in the onCreate() of the initial/launch Activity so that the app will check to see if it should run the startup or if it is just being resumed:

if (!isTaskRoot()
        && getIntent().hasCategory(Intent.CATEGORY_LAUNCHER)
        && getIntent().getAction() != null
        && getIntent().getAction().equals(Intent.ACTION_MAIN)) {
    finish();
    return;
}

However, I do not know how to do this in Ionic v2.

1 Like