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

Add support for "android.intent.action.SEND_MULTIPLE" in android intent filters.

    Details

      Description

      Currently Titanium SDK only supports receiving single shared image using sharing intent and intent-filters. I couldn't find any way to receive multiple images from shared intent EXTRA_STRAM. It would be good if Titanium support this feature.

      Steps to reproduce:

      1. Follow this guide to setup intent filters show our app in share dialog: https://docs.appcelerator.com/platform/latest/#!/guide/Android_Intent_Filters

      2. Add the following intent filter to the main activity inside manifest section in tiapp.xml:

      <intent-filter>
      	<data android:mimeType="image/*"/>
      	<category android:name="android.intent.category.DEFAULT"/>
      	<action android:name="android.intent.action.SEND_MULTIPLE"/>
      </intent-filter>
      

      3. Add this code to index.js to get shared images from launchIntent:

      if(OS_ANDROID){
      	var launchIntent = Ti.App.Android.launchIntent;
      	var extra;
      	if(launchIntent.hasExtra(Ti.Android.EXTRA_STREAM) && (extra = launchIntent.getBlobExtra(Ti.Android.EXTRA_STREAM))){
      	    console.log('Recieved external image in intent',extra);
      	}
      }
      

      4. Run the project and once app is launched open gallery application.
      5. Select multiple images and tap share button.
      6. From share dialog select our Titanium app.

      Actual result:
      Nothing happens except the following warning in console:

      [WARN] :   Bundle: Key android.intent.extra.STREAM expected Parcelable but value was a java.util.ArrayList.  The default value <null> was returned.
      [WARN] :   Bundle: Attempt to cast generated internal exception:
      [WARN] :   Bundle: java.lang.ClassCastException: java.util.ArrayList cannot be cast to android.os.Parcelable
      [WARN] :   Bundle: 	at android.os.Bundle.getParcelable(Bundle.java:810)
      [WARN] :   Bundle: 	at org.appcelerator.titanium.proxy.IntentProxy.getBlobExtra(IntentProxy.java:379)
      [WARN] :   Bundle: 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
      [WARN] :   Bundle: 	at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
      [WARN] :   Bundle: 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:936)
      [WARN] :   Bundle: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1159)
      [WARN] :   Bundle: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:363)
      [WARN] :   Bundle: 	at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:116)
      [WARN] :   Bundle: 	at dk.napp.drawer.DrawerProxy.handleMessage(DrawerProxy.java:96)
      [WARN] :   Bundle: 	at android.os.Handler.dispatchMessage(Handler.java:107)
      [WARN] :   Bundle: 	at android.os.Looper.loop(Looper.java:179)
      [WARN] :   Bundle: 	at android.app.ActivityThread.main(ActivityThread.java:5537)
      [WARN] :   Bundle: 	at java.lang.reflect.Method.invoke(Native Method)
      [WARN] :   Bundle: 	at java.lang.reflect.Method.invoke(Method.java:372)
      [WARN] :   Bundle: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
      [WARN] :   Bundle: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
      

      Expected Result:
      The app should receive array of images from launch intent and print the array on console.

      This link can be helpful in implementing this feature: https://stackoverflow.com/questions/13378108/androidselecting-multiple-images-in-gallery-and-starting-implicit-intent

        Attachments

          Activity

            People

            • Assignee:
              emerriman Eric Merriman
              Reporter:
              appsol Muhammad Qasim
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration