From 049514df4ebaa2bfa9f1349e7a3048ba8961da74 Mon Sep 17 00:00:00 2001 From: "iwg..om" Date: Sun, 19 May 2013 03:58:15 +0000 Subject: [PATCH] SDK: Add SingleTask Launch Mode to AndroidManifest for new projects to avoid starting a new instance of the app when users hit the Home button and then resume the app. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10627 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/gde/android/AndroidSdkTool.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java b/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java index 3ec4dda15..b93b089cc 100644 --- a/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java +++ b/sdk/jme3-android/src/com/jme3/gde/android/AndroidSdkTool.java @@ -290,6 +290,28 @@ public class AndroidSdkTool { in.close(); in = null; boolean changed = false; + Element sdkApplication = XmlHelper.findChildElement(configuration.getDocumentElement(), "application"); + if (sdkApplication != null) { + Element sdkActivity = XmlHelper.findChildElement(sdkApplication, "activity"); + if (sdkActivity != null) { + if (!sdkActivity.hasAttribute("android:launchMode")) { + sdkActivity.setAttribute("android:launchMode", "singleTask"); + changed = true; + } + } + // add the following after AndroidHarness.screenOrientation is depreciated + // for jME 3.1 +// if (sdkActivity != null) { +// if (sdkActivity.hasAttribute("android:screenOrientation")) { +// String attrScreenOrientation = sdkActivity.getAttribute("android:screenOrientation"); +// } else { +// Logger.getLogger(AndroidSdkTool.class.getName()).log(Level.INFO, "creating attrScreenOrientation"); +// sdkActivity.setAttribute("android:screenOrientation", "landscape"); +// changed = true; +// } +// } + } + Element sdkElement = XmlHelper.findChildElement(configuration.getDocumentElement(), "uses-sdk"); if (sdkElement == null) { sdkElement = configuration.createElement("uses-sdk");