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

Android: Intents using FLAG_ACTIVITY_NEW_DOCUMENT can cause issues with KrollRuntime

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 6.0.4
    • Component/s: Android
    • Labels:
      None
    • Story Points:
      8
    • Sprint:
      2017 Sprint 08 SDK

      Description

      Some applications specify the FLAG_ACTIVITY_NEW_DOCUMENT flag when launching applications (Gmail). This can cause event listeners to be overridden and fired in the incorrect activity instance.

      TEST CASE
      tiapp.xml

      <android ...>
          ...
         <manifest ...>
             ...
              <intent-filter>
                  <action android:name="android.intent.action.VIEW" />
                  <category android:name="android.intent.category.DEFAULT" />
                  <category android:name="android.intent.category.BROWSABLE" />
                  <data android:scheme="http" />
                  <data android:scheme="https" />
                  <data android:host="www.android.com" />
              </intent-filter>
              ...
          </manifest>
      </android>
      

      app.js

      var win = Ti.UI.createWindow({
              layout: 'vertical'
          }),
          bar = Ti.UI.createView({
              layout: 'horizontal',
              width: Ti.UI.FILL,
              height: Ti.UI.SIZE
          })
          currentData = Ti.UI.createButton({
              title: 'CURRENT DATA',
              left: 0
          }),
          clear = Ti.UI.createButton({
              title: 'CLEAR',
              right: 0
          }),
          scrollView = Ti.UI.createScrollView({
              layout: 'vertical',
              height: Ti.UI.FILL,
              backgroundColor: 'white'
          });
       
      // show current data
      currentData.addEventListener('click', function (e) {
          alert(Ti.Android.currentActivity.getIntent().data);
      });
       
      // clear intent log
      clear.addEventListener('click', function (e) {
          scrollView.removeAllChildren();
      });
       
      // launch intent
      scrollView.add(Ti.UI.createLabel({
          top: 10,
          color: 'black',
          text: 'LAUNCH INTENT ' + JSON.stringify(Ti.Android.currentActivity.getIntent()) + ' WITH DATA: ' + Ti.Android.currentActivity.getIntent().data
      }));
       
      bar.add(currentData);
      bar.add(clear);
      win.add(bar);
      win.add(scrollView);
      win.open();
      

      1. Launch app via a link in Gmail: www.android.com/0
      2. Press 'CURRENT DATA', should display www.android.com/0
      3. Open recent apps menu and resume Gmail
      4. Launch app via link in Gmail: www.android.com/1
      5. Press 'CURRENT DATA', should display www.android.com/1
      6. Open recent apps menu and resume Gmail
      7. Launch app via a link in Gmail: www.android.com/0
      8. Press 'CURRENT DATA', should display www.android.com/0 but does not

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              gmathews Gary Mathews
              Reviewer:
              Maggie Chen
              Tester:
              Lokesh Choudhary
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code