{ "id": "64080", "key": "TIMOB-3448", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-08T18:11:04.000+0000", "created": "2011-04-15T03:45:17.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "extras", "intent", "intents" ], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-08T18:11:04.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

I'm using Titanium Mobile 1.5/1.6's support for native Android\nintents and activities to let our StatusNet Mobile app accept text\nand image attachments from other social networking apps and the\nsystem Gallery and Camera apps.

\n

Unfortunately I'm having some trouble accepting images, which\nare attached as a Uri object in the EXTRA_STREAM extra field.\nCalling intent.getStringExtra(Ti.Android.EXTRA_STREAM) fails,\nbecause the returned object is a Uri, not a string:

\n
\nW/Bundle  ( 1569): Key android.intent.extra.STREAM expected String but value was a android.net.Uri$HierarchicalUri.  The default value <null> was returned.\nW/Bundle  ( 1569): Attempt to cast generated internal exception:\nW/Bundle  ( 1569): java.lang.ClassCastException: android.net.Uri$HierarchicalUri\nW/Bundle  ( 1569):  at android.os.Bundle.getString(Bundle.java:1040)\nW/Bundle  ( 1569):  at android.content.Intent.getStringExtra(Intent.java:3368)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.proxy.IntentProxy.getStringExtra(IntentProxy.java:239)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.proxy.IntentProxyBindingGen$3.invoke(IntentProxyBindingGen.java:187)\nW/Bundle  ( 1569):  at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:51)\nW/Bundle  ( 1569):  at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1711)\nW/Bundle  ( 1569):  at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)\nW/Bundle  ( 1569):  at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)\nW/Bundle  ( 1569):  at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)\nW/Bundle  ( 1569):  at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)\nW/Bundle  ( 1569):  at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:139)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:113)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:108)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:104)\nW/Bundle  ( 1569):  at org.appcelerator.kroll.KrollProxy.fireSingleEvent(KrollProxy.java:629)\nW/Bundle  ( 1569):  at org.appcelerator.kroll.KrollEventManager$KrollListener.invoke(KrollEventManager.java:143)\nW/Bundle  ( 1569):  at org.appcelerator.kroll.KrollEventManager.dispatchEvent(KrollEventManager.java:273)\nW/Bundle  ( 1569):  at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:600)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:294)\nW/Bundle  ( 1569):  at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:97)\nW/Bundle  ( 1569):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)\nW/Bundle  ( 1569):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)\nW/Bundle  ( 1569):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)\nW/Bundle  ( 1569):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)\nW/Bundle  ( 1569):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)\nW/Bundle  ( 1569):  at android.os.Handler.dispatchMessage(Handler.java:99)\nW/Bundle  ( 1569):  at android.os.Looper.loop(Looper.java:123)\nW/Bundle  ( 1569):  at android.app.ActivityThread.main(ActivityThread.java:4627)\nW/Bundle  ( 1569):  at java.lang.reflect.Method.invokeNative(Native Method)\nW/Bundle  ( 1569):  at java.lang.reflect.Method.invoke(Method.java:521)\nW/Bundle  ( 1569):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\nW/Bundle  ( 1569):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\nW/Bundle  ( 1569):  at dalvik.system.NativeStart.main(Native Method)\n
\n

I notice in ticket #2587, someone encountered the same problem when\ncreating such intents to send to other applications, and\nan Intent.putUriExtra() was added to accommodate it, converting\nfrom a string parameter to a Uri.

\n

It looks like it would be helpful to add an\nIntent.getUriExtra(), or else tweak things such that there's some\nother clear way to retrieve it.

{html}", "attachment": [], "flagged": false, "summary": "Android: cannot retrieve EXTRA_STREAM from Intent (no getUriExtra)", "creator": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "421538", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to time passed and lack on input for the past 6 years. Any problems, please open a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-08T18:11:04.000+0000", "updated": "2017-06-08T18:11:04.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }