You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Rajil Davda (JIRA)" <ji...@apache.org> on 2015/11/24 07:57:11 UTC

[jira] [Commented] (CB-6048) Add config setting for Android app launchMode

    [ https://issues.apache.org/jira/browse/CB-6048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15023883#comment-15023883 ] 

Rajil Davda commented on CB-6048:
---------------------------------

I still am unable to set launchMode from config.xml file.  Is this issue still persist?

Below is the environment details:
Cordova CLI: 5.3.3
Gulp version:  CLI version 3.9.0
Gulp local:  
Ionic CLI Version: 1.7.8
Ionic App Lib Version: 0.6.4
ios-deploy version: 1.8.2 
ios-sim version: 5.0.3 
OS: Mac OS X El Capitan
Node Version: v4.1.1
Xcode version: Xcode 7.0 Build version 7A220 

Below are the plugins i'm using:
com.ionic.keyboard 1.0.4 "Keyboard"
com.verso.cordova.clipboard 0.1.0 "Clipboard"
cordova-plugin-calendar 4.4.4 "Calendar"
cordova-plugin-contacts 1.1.0 "Contacts"
cordova-plugin-crosswalk-webview 1.4.0 "Crosswalk WebView Engine"
cordova-plugin-customurlscheme 4.0.0 "Custom URL scheme"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-email 1.0.0 "EmailComposer"
cordova-plugin-fileopener 1.0.3 "FileOpener"
cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-statusbar 1.0.1 "StatusBar"
cordova-plugin-transport-security 0.1.1 "App Transport Security"
cordova-plugin-whitelist 1.0.0 "Whitelist"
cordova-plugin-x-toast 2.2.1 "Toast"
hu.dpal.phonegap.plugins.PinDialog 0.1.2 "PinDialog"
hu.dpal.phonegap.plugins.UniqueDeviceID 1.2.0 "UniqueDeviceID"
phonegap-plugin-push 1.4.4 "PushPlugin"


Below is the code i added into config.xml for launchMode:

......
<platform name="android">
        <preference name="AndroidLaunchMode" value="singleTask"/>
.......


Below is the AndroidManifest.xml file generated by cordova:

<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <data android:scheme="myAppName" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
        </activity>

> Add config setting for Android app launchMode
> ---------------------------------------------
>
>                 Key: CB-6048
>                 URL: https://issues.apache.org/jira/browse/CB-6048
>             Project: Apache Cordova
>          Issue Type: New Feature
>          Components: Android, CLI
>            Reporter: Michal Mocny
>            Assignee: Michal Mocny
>
> As raised on mailing list: "[Android] Apps restart instead of resume when brought to focus by clicking app icon"
> "TLDR; AndroidManifest.xml <activity> needs: android:launchMode="singleTop" -- can I add it?
> Quick search brings up: http://stackoverflow.com/questions/10122449/phonegap-android-application-restarting-instead-of-resuming-although-it-was-not
> ..which advises to add android:launchMode="singleTask" to AndroidManifest.xml <activity>, which does fix the issue.
> According to the descriptions in http://developer.android.com/guide/topics/manifest/activity-element.html the differences mostly stem in how the app handles intents, however, there is a comment in the table of descriptions which labels singleTask launchMode as  "(not recommended for general use)".
> On the other hand, singleTop mode *is* recommended, and also fixes the issue, and according to the description, sounds to me like a much better default."



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org