Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26250] Android: Allow activity "android:launchMode" attribute to be set in "tiapp.xml"

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-08-03T00:11:08.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.3.0
ComponentsAndroid
Labelsactivity, android, build, xml
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-08-02T01:38:40.000+0000
Updated2018-08-03T18:23:34.000+0000

Description

*Summary:* In Titanium 6.1.0, our build tools ignore the activity "android:launchMode" setting in "tiapp.xml" and log the following build warning. This was to avoid confusion over how Google's "singleTask" feature works and to favor Titanium's "intent-filter-new-task" property instead.
[WARN] : android:launchMode should not be used. Ignoring definition from <ActivityName>
We should change the behavior to allow developers to set "android:launchMode" again, but keep the build warning. Some developers already know how to deal with the repercussions of the "singleTask" setting where all child activity windows are automatically closed upon app resume. *Test:*

Add the below Android xml settings to your "tiapp.xml" file.

In the XML, change the <activity> element's "name" attribute's <ProjectName> part to the name of your Titanium project where only the 1st letter is capitalized. (Ex: "MyProject" would become "Myproject".)

Build the application for Android.

Note the build warning that appears regarding "android:launchMode".

*tiapp.xml*
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
	<android xmlns:android="http://schemas.android.com/apk/res/android">
		<manifest>
			<application>
				<activity android:name=".<ProjectName>Activity" android:launchMode="singleTask">
					<intent-filter>
						<action android:name="android.intent.action.MAIN"/>
						<category android:name="android.intent.category.LAUNCHER"/>
					</intent-filter>
				</activity>
			</application>
		</manifest>
	</android>
</ti:app>

Comments

  1. Joshua Quick 2018-08-02

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10225 PR (7.3.x): https://github.com/appcelerator/titanium_mobile/pull/10226 The PR for master includes sample code on how to deal with the "singleTask" launch mode.
  2. Lokesh Choudhary 2018-08-03

    FR Passed. PR's merged.
  3. Lokesh Choudhary 2018-08-03

    Verified the fix in SDK 7.4.0.v20180803013445 & 7.3.0.v20180803101103. Closing.

JSON Source