Affects Version/s: None
Fix Version/s: Release 6.0.3
Android 4.1.2 on Samsung Galaxy S2
Mac OS X 10.8.4
Sprint:To Be Scheduled, 2017 Sprint 02 SDK
When launching your app with it's main activity set to android:launchMode="singleTask" and it's main window a HeavyWeight one, it will hang on the second and every following launch.
This bug blocks me from allowing users to open my app by using an URL scheme on a webpage or in a email message, send to them when they lost their password, received an invite to play a game etc.
By default, when launching your app via another app, e.g. using an URL scheme in the browser, your apps main activity will be stacked onto the current app's task. If your app was already running in the background, you will have 2 instances of the app running.
Android has a launchMode attribute that allows you to instruct the OS to always open the activity as the root of a new task, using singleTask as value.
This works fine, but not when the app's main window is HeavyWeight, for example a Ti.UI.TabGroup or a Ti.UI.Window with modal:false.
- Create a new project: titanium create -p android -n test
- Build (only) to generate manifest: titanium build -b -p android
- Open the generated build/android/AndroidManifest.xml and copy the first <activity> tree to the tiapp.xml under ti:app/android/manifest/application. You will need to create the empty <manifest> and <application> elements yourself.
- Add android:launchMode="singleTask" to the <activity> element and save tiapp.xml.
- Build the app to the device: titanium build -p android -T device
- Open the updated AndroidManifest.xml to confirm the only effective change is the newly added attribute.
- Seeing the app properly launched on the device, move it to the background by clicking the device's home button.
- Lookup the app on the device and launch it again. You'll see a black screen with a titlebar (test) only.
- Now replace the app's app.js with a lightweight window instead of the default heavyweight tabgroup:
- Repeat steps 5-8 and this time, the app will properly launch.