Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19194] Ti.Android.Intent: Ability to send multiple URI to an intent

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-12-01T22:54:37.000+0000
Affected Version/sRelease 4.0.0
Fix Version/sRelease 5.2.0
ComponentsAndroid
Labelsandroid, intent, link, module_android, multiple, notable, qe-manualtest, qe-testadded
ReporterShuo Liang
AssigneeAshraf Abu
Created2015-07-09T01:10:10.000+0000
Updated2016-01-27T00:05:11.000+0000

Description

Feature:

Right Now, Ti.Android.Intent only gives the option to send a single url within the putExtraUri() function. We need the option to use the ACTION_SEND_MULTIPLE instead of ACTION_SEND constant in order to allow an Array of URLs to be passed instead of a single String value.

Usage example:

var photos = [ firstImage.nativePath, secondImage.nativePath ];
intent.putExtraUri(Ti.Android.EXTRA_STREAM, photos);

Expected Result:

success intent call

Actual Result:

Right now it generates an exception:
[WARN] Bundle: Key android.intent.extra.STREAM expected ArrayList but value was a android.net.Uri$StringUri. The default value <null> was returned. 
[WARN] Bundle: Attempt to cast generated internal exception: 
[WARN] Bundle: java.lang.ClassCastException: android.net.Uri$StringUri cannot be cast to java.util.ArrayList 
[WARN] Bundle: at android.os.Bundle.getParcelableArrayList(Bundle.java:805) 
[WARN] Bundle: at android.content.Intent.getParcelableArrayListExtra(Intent.java:5116) 
[WARN] Bundle: at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7852) 
[WARN] Bundle: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1494) 
[WARN] Bundle: at android.app.Activity.startActivityForResult(Activity.java:3745) 
[WARN] Bundle: at android.app.Activity.startActivityForResult(Activity.java:3706) 
[WARN] Bundle: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) 
[WARN] Bundle: at android.app.Activity.startActivity(Activity.java:4016) 
[WARN] Bundle: at android.app.Activity.startActivity(Activity.java:3984) 
[WARN] Bundle: at org.appcelerator.titanium.proxy.ActivityProxy.startActivity(ActivityProxy.java:110) 
[WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method) 
[WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57) 
[WARN] Bundle: at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43) 
[WARN] Bundle: at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:152) 
[WARN] Bundle: at android.os.Handler.handleCallback(Handler.java:739) 
[WARN] Bundle: at android.os.Handler.dispatchMessage(Handler.java:95) 
[WARN] Bundle: at android.os.Looper.loop(Looper.java:135) 
[WARN] Bundle: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)

Comments

  1. Ashraf Abu 2015-11-23

    PR: https://github.com/appcelerator/titanium_mobile/pull/7481 Test code in PR.
  2. Lokesh Choudhary 2016-01-27

    Verified the implementation. Ti.Android.Intent now has the ability to send multiple URI to an intent. Closing. Environment: Appc Studio : 4.5.0.201601210853 Ti SDK : 5.2.0.v20160114021251 Ti CLI : 5.0.6 Alloy : 1.7.33 MAC Yosemite : 10.10.5 Appc NPM : 4.2.3-1 Appc CLI : 5.2.0-233 Node: v0.12.27 Nexus 5 - Android 5.1.1

JSON Source