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
3.0
iwg..om 12 years ago
parent 4395c45092
commit 049514df4e
  1. 22
      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");

Loading…
Cancel
Save