Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15253

Android: singleTask launchMode with HeavyWeight window hangs after 1st launch

    Details

    • Story Points:
      8
    • Sprint:
      To Be Scheduled, 2017 Sprint 02 SDK

      Description

      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.

      Why use launchMode?

      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.

      To reproduce

      1. Create a new project: titanium create -p android -n test
      2. Build (only) to generate manifest: titanium build -b -p android
      3. 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.
      4. Add android:launchMode="singleTask" to the <activity> element and save tiapp.xml.
      5. Build the app to the device: titanium build -p android -T device
      6. Open the updated AndroidManifest.xml to confirm the only effective change is the newly added attribute.
      7. Seeing the app properly launched on the device, move it to the background by clicking the device's home button.
      8. Lookup the app on the device and launch it again. You'll see a black screen with a titlebar (test) only.
      9. Now replace the app's app.js with a lightweight window instead of the default heavyweight tabgroup:

            Ti.UI.createWindow({backgroundColor:'white'}).open();
            

      10. Repeat steps 5-8 and this time, the app will properly launch.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                fokkezb Fokke Zandbergen
                Reviewer:
                Frankie Merzadyan (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17493
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code