I am noticing a weird behavior in my app and not sure what is causing it or where to look for or where to start investigating.
So my main activity calls another activity sign in activity. My sign in activity has 2 layouts say layout A and layout B. As soon as I launch the app, layout A gets displayed and when I click on a button on layout A is hidden and layout B is displayed.
Sideloading the app:
During sideload, if I am on layout B and go to the background and come back to the app, the app still launched layout B and I noticed that onStart method gets called on SignIn Activity.
Downloading from HockeyApp or PlayStore:
On downloaded app, if I am on layout B and go to the background and comeback, the app displays layout A i.e. it doesn't maintain the state and goes through entire activity lifecycle again starting from onCreate. However if I force stop the app manually and try the same scenario, then it will behave like a sideloaded app i.e. it maintains the app state after coming from background.
Am not sure what is causing this behavior. Has anyone experienced such behavior before?
Adding the logic around both the activities from AndroidManifest file.
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustNothing"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="test-app" />
<data android:host="loc" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern="/.*/apps/test.*" />
</intent-filter>
</activity>
<activity
android:name=".SignInActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />