Issue
After testing my application on multiple device i found out that on some of them if i click application icon it shows me
WelcomeActivity
instead of bringing back the application from background. I know that WelcomeActivity is LAUNCHER but on my other devices the app icon alway bring me back the background application.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".WelcomeActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustPan">
After WelcomeActivity i use MainActivity. and usually the app is putted to the background while that was alive.
Solution
Remove
android:launchMode="singleTop"
Because
If an instance of the activity already exists at the top of the target task, the system routes the intent to that instance through a call to its onNewIntent() method, rather than creating a new instance of the activity.
Answered By - sasikumar
Answer Checked By - Robin (JavaFixing Admin)