From a4f6c8bf7bf5ba49855f31831662f7964b17f962 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Sun, 18 Sep 2016 16:00:53 -0400 Subject: [PATCH] Enable background start of Cordova Android apps This closes #322 --- bin/templates/project/Activity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/templates/project/Activity.java b/bin/templates/project/Activity.java index 1bd9e1cb..7cd0f972 100644 --- a/bin/templates/project/Activity.java +++ b/bin/templates/project/Activity.java @@ -28,6 +28,13 @@ public class __ACTIVITY__ extends CordovaActivity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + // enable Cordova apps to be started in the background + Bundle extras = getIntent().getExtras(); + if (extras != null && extras.getBoolean("cdvStartInBackground", false)) { + moveTaskToBack(true); + } + // Set by in config.xml loadUrl(launchUrl); }