Search code examples
androidcordovavisual-studio-2013android-manifestmulti-device-hybrid-apps

Cordova application does not resume but restarts after pressing home button and then opening app again


I have created an Android application using Multi-Device Hybrid Apps for Visual Studio CTP 1.1

The issue occurs when the home button is pressed, the application is sent to the background, and then the app icon is tapped to re-open the app again. Instead of the application resuming, it restarts.

Due to the application being built in Multi-Device Hybrid Apps for Visual Studio, there is no way to make any changes to the AndroidManifest.xml.

I also tried adding <preference name="launchMode" value="singleTask" /> to the config.xml, but that did not work.

I am targeting Android 4.1.2

How could I get the application to resume instead of restarting?

Any feedback would be much appreciated.


Solution

  • The Background Mode plugin will handle this for you in Cordova.

    Another approach would be to use the res/cert folder to inject content into the native project used to build your app. A custom AndroidManifest.xml file can be placed in the res/cert/android folder. The FAQ details this further.