3 Replies Latest reply on Mar 23, 2017 5:49 AM by audreyeso

    Android launch mode

    aeea36500303

      I've just exported my XDK project to phonegap and built it by build.phonegap.com. I've notice that everytime I touch the app icon a new instance is created instead of taking the running one on top. How to change it?

      I tried to add preference AndroidLaunchMode as Cordova docs suggest but nothing changes.

      Please help me

        • 1. Re: Android launch mode
          audreyeso Adobe Employee

          Hi! Is this what you have for AndroidLaunchMode? If not, you can try this:

          <preference name="AndroidLaunchMode" value="singleTask" />


          You can also try this:

          <gap:config-file platform="android" parent="/manifest/application">
             
          <activity android:launchMode="singleInstance" />
          </gap:config-file>


          Check out this resource.

          https://github.com/phonegap/build/issues/252

           

          Let me know if any of this is helpful. If not, please include a code sample of what you are doing! Thanks so much!

          • 2. Re: Android launch mode
            aeea36500303 Level 1

            yes this is what I have in my config.xml file exported, as you can see there's the line you mentioned

             

            <?xml version="1.0" encoding="UTF-8"?>
            -<widget id="com.visitami.visitami" version="2.1.59" ios-CFBundleVersion="2.1.58" android-versionCode="2159" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0" xmlns="http://www.w3.org/ns/widgets">
            <!-- This file is generated by the Intel XDK. Do not edit this file as your edits will be lost.-->
            
            
            <!-- To change the contents of this file, see the documentation on the intelxdk.config.additions.xml file. -->
            <name>Visitami</name><description>connecting people to healthcare</description><author>Alessandro sbenaglia</author><content src="index.html"/><allow-intent href="*"/><access origin="*"/><access origin="*"/><preference value="cli-6.2.0" name="phonegap-version"/><preference value="false" name="xwalkMultipleApk"/><plugin version="1.8.0" name="cordova-plugin-crosswalk-webview"/><plugin name="cordova-plugin-appversion" spec="https://github.com/Rareloop/cordova-plugin-app-version.git"/>
            <!-- If available via Cordova registry; consider changing to an NPM reference. -->
            <plugin name="cordova-plugin-certificates" spec="https://github.com/hypery2k/cordova-certificate-plugin.git"/>
            <!-- If available via Cordova registry; consider changing to an NPM reference. -->
            <plugin name="cordova-plugin-device" spec="1.1.4"/><plugin name="cordova-plugin-dialogs" spec="1.2.1"/><plugin name="cordova-plugin-email" spec="1.1.0"/>-<plugin name="cordova-plugin-camera" spec="2.3.0"><variable value="Immagine del profilo" name="CAMERA_USAGE_DESCRIPTION"/><variable value="Immagine del profilo" name="PHOTOLIBRARY_USAGE_DESCRIPTION"/></plugin>-<plugin name="cordova-plugin-facebook4" spec="1.7.2"><variable value="829140770512386" name="APP_ID"/><variable value="Visitami" name="APP_NAME"/></plugin><plugin name="cordova-plugin-apprate" spec="https://github.com/pushandplay/cordova-plugin-apprate.git"/>
            <!-- If available via Cordova registry; consider changing to an NPM reference. -->
            -<plugin name="cordova-plugin-geolocation" spec="2.4.1"><variable value=" " name="GEOLOCATION_USAGE_DESCRIPTION"/></plugin><plugin name="cordova-plugin-globalization" spec="1.0.5"/><plugin name="cordova-plugin-inappbrowser" spec="1.6.1"/><plugin name="cordova-plugin-splashscreen" spec="4.0.1"/><plugin name="cordova-plugin-statusbar" spec="2.2.1"/><plugin name="cordova-plugin-x-socialsharing" spec="5.1.6"/><plugin name="intel.xdk.cache" spec="https://github.com/01org/cordova-plugin-intel-xdk-cache.git#r1.2.4"/>
            <!-- If available via Cordova registry; consider changing to an NPM reference. -->
            <plugin name="intel.xdk.device" spec="https://github.com/01org/cordova-plugin-intel-xdk-device.git#r3.0.1"/>
            <!-- If available via Cordova registry; consider changing to an NPM reference. -->
            <plugin name="ionic-plugin-keyboard" spec="2.2.1"/>-<plugin name="pushwoosh-cordova-plugin" spec="6.2.1"><variable value="DEBUG" name="LOG_LEVEL"/><variable value="BANNER" name="IOS_FOREGROUND_ALERT_TYPE"/><variable value="true" name="ANDROID_FOREGROUND_PUSH"/></plugin>-<plugin name="cordova-plugin-customurlscheme" spec="https://github.com/EddyVerbruggen/Custom-URL-scheme.git"><variable value="visitami" name="URL_SCHEME"/><variable value=" " name="ANDROID_SCHEME"/><variable value=" " name="ANDROID_HOST"/><variable value="/" name="ANDROID_PATHPREFIX"/></plugin><plugin name="cordova-plugin-compat" spec="1.0.0"/>-<plugin name="cordova-plugin-calendar" spec="https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git"><variable value="salva gli appuntamenti nel calendario" name="CALENDAR_USAGE_DESCRIPTION"/></plugin>-<plugin name="phonegap-plugin-barcodescanner" spec="6.0.3"><variable value="QRCode" name="CAMERA_USAGE_DESCRIPTION"/></plugin><plugin name="cordova-plugin-whitelist" spec="1.2.2"/><preference value="screen" name="SplashScreen"/>-<platform name="android">
            <!-- below requires the splash screen plugin -->
            
            
            <!-- docs: https://github.com/apache/cordova-plugin-splashscreen -->
            <preference value="true" name="SplashMaintainAspectRatio"/></platform><preference value="singleTask" name="AndroidLaunchMode"/>-<platform name="ios">
            <!-- iOS icons -->
            
            
            <!-- Spotlight Icon -->
            </platform><preference value="--disable-pull-to-refresh-effect --ignore-gpu-blacklist " name="xwalkCommandLine"/>-<platform name="android"><preference value="16" name="android-minSdkVersion"/><preference value="19" name="android-targetSdkVersion"/><preference value="auto" name="android-installLocation"/><preference value="portrait" name="Orientation"/><preference value="false" name="Fullscreen"/></platform><icon src="package-assets/36.png" height="36" width="36" platform="android"/><icon src="package-assets/48.png" height="48" width="48" platform="android"/><icon src="package-assets/72.png" height="72" width="72" platform="android"/><icon src="package-assets/96.png" height="96" width="96" platform="android"/><splash src="package-assets/426.png" height="426" width="320" platform="android" orientation="portrait"/><splash src="package-assets/470.png" height="470" width="320" platform="android" orientation="portrait"/><splash src="package-assets/640.png" height="640" width="480" platform="android" orientation="portrait"/><splash src="package-assets/960.png" height="960" width="720" platform="android" orientation="portrait"/>-<platform name="ios"><preference value="production" name="ios-configuration"/><preference value="portrait" name="Orientation"/><preference value="8.0" name="deployment-target"/></platform><icon src="package-assets/icon-small.png" height="29" width="29" platform="ios"/><icon src="package-assets/icon-small@2x.png" height="58" width="58" platform="ios"/><icon src="package-assets/icon-small@3x.png" height="87" width="87" platform="ios"/><icon src="package-assets/icon-60.png" height="60" width="60" platform="ios"/><icon src="package-assets/icon-60@2x.png" height="120" width="120" platform="ios"/><icon src="package-assets/icon-60@3x.png" height="180" width="180" platform="ios"/><icon src="package-assets/icon-76.png" height="76" width="76" platform="ios"/><icon src="package-assets/icon-76@2x.png" height="152" width="152" platform="ios"/><icon src="package-assets/icon-40.png" height="40" width="40" platform="ios"/><icon src="package-assets/icon-40@2x.png" height="80" width="80" platform="ios"/><icon src="package-assets/icon-57.png" height="57" width="57" platform="ios"/><icon src="package-assets/icon-57@2x.png" height="114" width="114" platform="ios"/><icon src="package-assets/icon-72.png" height="72" width="72" platform="ios"/><icon src="package-assets/icon-72@2x.png" height="144" width="144" platform="ios"/><icon src="package-assets/icon-50.png" height="50" width="50" platform="ios"/><icon src="package-assets/icon-50@2x.png" height="100" width="100" platform="ios"/><icon src="package-assets/icon-187.png" height="187" width="187" platform="ios"/><icon src="package-assets/icon-167.png" height="167" width="167" platform="ios"/><splash src="package-assets/i2008.png" height="2008" width="1536" platform="ios" orientation="portrait"/><splash src="package-assets/i1004.png" height="1004" width="768" platform="ios" orientation="portrait"/><splash src="package-assets/i1334.png" height="1334" width="750" platform="ios" orientation="portrait"/><splash src="package-assets/i2208.png" height="2208" width="1242" platform="ios" orientation="portrait"/><splash src="package-assets/i1136.png" height="1136" width="640" platform="ios" orientation="portrait"/><splash src="package-assets/i960.png" height="960" width="640" platform="ios" orientation="portrait"/><splash src="package-assets/i480.png" height="480" width="320" platform="ios" orientation="portrait"/><splash src="package-assets/i2048.png" height="2048" width="1536" platform="ios" orientation="portrait"/><splash src="package-assets/i1024.png" height="1024" width="768" platform="ios" orientation="portrait"/><splash src="package-assets/i2732.png" height="2732" width="2048" platform="ios" orientation="portrait"/><splash src="package-assets/i2048-2.png" height="2048" width="2732" platform="ios" orientation="landscape"/><splash src="package-assets/i750.png" height="750" width="1334" platform="ios" orientation="landscape"/><splash src="package-assets/i1242.png" height="1242" width="2208" platform="ios" orientation="landscape"/><splash src="package-assets/i1536.png" height="1536" width="2048" platform="ios" orientation="landscape"/><splash src="package-assets/i768-2.png" height="768" width="1024" platform="ios" orientation="landscape"/></widget>
            
            • 3. Re: Android launch mode
              audreyeso Adobe Employee

              Have you also tried this code too?

               

              <gap:config-file platform="android" parent="/manifest/application">
                <activity android:launchMode="singleInstance" />

              </gap:config-file>