I have a simple app with two activities, a splash activity that displays an animation, then starts a singleTop landing activity(to handle opening the app through a notification) and finishes. When the app is started from the launcher, that splash activity is called again even if the app was already running. What's also weird is that this behavior never happens when I am debugging the app, only with the installed released apk
Splash activity
<activity
android:name=".SplashScreen"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
android:theme="@android:style/Animation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Navigating to the landing activity and finishing
private void navigateToLandingScreen() {
Intent intent = new Intent(SplashScreen.this, LandingActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.splash_fadein, R.anim.splash_fadeout);
finish();
}
Landing activity with a singleTop launchMode
<activity
android:launchMode="singleTop"
android:name=".LandingActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan"/>