Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26148] Add support for "android.intent.action.SEND_MULTIPLE" in android intent filters.

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, images, intent-filter, intents, share
ReporterMuhammad Qasim
AssigneeEric Merriman
Created2018-05-31T10:26:51.000+0000
Updated2018-06-22T09:15:54.000+0000

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](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](https://stackoverflow.com/questions/13378108/androidselecting-multiple-images-in-gallery-and-starting-implicit-intent)

Comments

  1. Sharif AbuDarda 2018-06-02

    Hello, Can you please share native docs on this feature? Our engineers will look into it. Thanks.
  2. Sharif AbuDarda 2018-06-19

    Hello [~appsol], We can't move this ticket you if don't provide the sufficient information that is needed. Please share the native docs on this feature. Thanks.
  3. Muhammad Qasim 2018-06-20

    @Sharif AbuDarda The StackOverFlow link I attached has an example. Here is the link to native docs that has an example of *ACTION_SEND_MULTIPLE*: [https://developer.android.com/training/sharing/receive](https://developer.android.com/training/sharing/receive)

JSON Source