I have SplashActivity to show animation and init some data, after animation finishes I start MainActivity and call finish() for SplashActivity. When I am at MainActivity and press Home button, than open Play Market, found my app and press Open button, my app starts from SplashActivity. But when I open my app from recent or from icon in apps list it works OK.
Summing: How it is: SplashActivty->MainActivity->Home Button->Play Market->MyApp->Open Button->SplashActivity
How I need: SplashActivty->MainActivity->Home Button->Play Market->MyApp->Open Button->MainActivity
I guess that Play Market adds some special flags to intent when launching app, but this behavior is not acceptable for me, maybe someone had the same problem and can advice me some solution.
This is SplashActivity in AndroidManifest
<activity
android:name=".activities.SplashActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden"
android:theme="@style/SplashTheme"
tools:replace="name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This is code to launch MainActivity
public void openMainActivity() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}