I have an application, which misbehaves if started from another app (e.g. over the playstore). Instead of resuming to the already existing Activity
, it restarts as a new instance.
What I have:
- declared every activity with
launchMode="singleTop"
inmanifest.xml
- I tried the same with
launchMode=singleTask
, but it has the same behaviour - used additional
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
on everyIntent
which starts a newActivity
onNewIntent()
is not called in already running instance
I used following code, to start my app from another app (with, and without additional addFlag()
)
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("my.package.name");
launchIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(launchIntent);
My Launcher-Activity is a SplashScreenActivity
, which starts the MainActivity
if user is logged in with the following code and gets finished()
Intent intent = null;
intent = new Intent(SplashScreenActivity.this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
finish();
What am I missing? Any recommendations are welcome!