I'm not sure if this is expected, if it's a bug and whether or not there's a workaround.
When a user hits the home button in our Android Phonegap app, the application minimizes properly. When the user clicks the icon to launch the app, it restarts from the beginning. This is undesirable.
After a user minimizes the app by clicking the home button, there are two ways the app will resume properly:
So my question is, what do we need to do to resume the app in the same way those above two items do when the user clicks on the app icon from the desktop? The app is running and healthy as item 1 listed above confirms.
Any help would be greatly appreciated. Thanks!
I had the same problem . My app was getting restarted when i click the app icon to relaunch the already running app in the background.
Basically if the android:launchMode
is set to standard or not set ,then a new intent is created for the app and the old paused state of app is not resumed .
So the best way around i found was to apply
android:launchMode="singleTask"
in the AndroidManifest.xml -> inside <activity>
.
please conside this example :
<activity android:name="Example" android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With