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

Android: Resuming app from intent does not provide EXTRA

    Details

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

      Description

      1. Press "CREATE SHORTCUT"
      2. Kill the app
      3. Start the app via shortcut - observe correct behaviour (WITH EXTRA: TEST)
      4. Move app into background
      5. Resume the app using shortcut - observe invalid behaviour WITH EXTRA : null

      var win = Ti.UI.createWindow({
              layout: 'vertical'
          }),
          bar = Ti.UI.createView({
              layout: 'horizontal',
              width: Ti.UI.FILL,
              height: Ti.UI.SIZE
          })
          createShortcut = Ti.UI.createButton({
              title: 'CREATE SHORTCUT',
              left: 0
          }),
          clear = Ti.UI.createButton({
              title: 'CLEAR',
              right: 0
          }),
          scrollView = Ti.UI.createScrollView({
              layout: 'vertical',
              height: Ti.UI.FILL,
              backgroundColor: 'white'
          });
       
      // create homescreen shortcut
      createShortcut.addEventListener('click', function (e) {
          var currentIntent = Ti.Android.currentActivity.getIntent(),
              shortcutIntent = Ti.Android.createIntent({
                  action: "com.android.launcher.action.INSTALL_SHORTCUT",
              });
       
          currentIntent.setAction(Ti.Android.ACTION_MAIN);
          currentIntent.putExtra("shortcut", "TEST");
          currentIntent.addCategory(Ti.Android.CATEGORY_HOME);
       
          shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_NAME, "SHORTCUT");
          shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_INTENT, currentIntent);
       
          Ti.Android.currentActivity.sendBroadcast(shortcutIntent);
      });
       
      // clear intent log
      clear.addEventListener('click', function (e) {
          scrollView.removeAllChildren();
      });
       
      // intent listener
      Ti.Android.currentActivity.addEventListener('newintent', function (e) {
          scrollView.add(Ti.UI.createLabel({
              top: 10,
              color: 'black',
              text: 'INTENT ' + JSON.stringify(e.intent) + ' WITH EXTRA: ' + e.intent.getStringExtra('shortcut')
          }));
      });
       
      // launch intent
      scrollView.add(Ti.UI.createLabel({
          top: 10,
          color: 'black',
          text: 'LAUNCH INTENT ' + JSON.stringify(Ti.Android.currentActivity.getIntent()) + ' WITH EXTRA: ' + Ti.Android.currentActivity.getIntent().getStringExtra('shortcut')
      }));
       
      bar.add(createShortcut);
      bar.add(clear);
      win.add(bar);
      win.add(scrollView);
      win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                gmathews Gary Mathews
                Reviewer:
                Andy Waldman
                Tester:
                Josh Longton
              • Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Source Code