2

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.

Praetorian
  • 106,671
  • 19
  • 240
  • 328
Ibanez
  • 409
  • 5
  • 16

1 Answers1

2

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.

Avani
  • 566
  • 2
  • 8
  • Thanks Avani, I will try adding a custom AndroidManifest. I will let you know if that resolves my issue. – Ibanez Aug 26 '14 at 07:04
  • Thank you Avani, I have added the AndroidManifest with android:launchMode="singleInstance" and it works like a charm! – Ibanez Aug 26 '14 at 07:38
  • Excellent! Please email vscordovatools@microsoft.com if you have additional questions. – Avani Aug 26 '14 at 15:42