[TIMOB-26250] Android: Allow activity "android:launchMode" attribute to be set in "tiapp.xml"
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-08-03T00:11:08.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.3.0 |
Components | Android |
Labels | activity, android, build, xml |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2018-08-02T01:38:40.000+0000 |
Updated | 2018-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.
In the XML, change the
[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>
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.
FR Passed. PR's merged.
Verified the fix in SDK 7.4.0.v20180803013445 & 7.3.0.v20180803101103. Closing.