{ "id": "63219", "key": "TIMOB-2587", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": [ { "id": "11238", "name": "Release 1.6.0 M05", "archived": true, "released": true, "releaseDate": "2011-01-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:59:32.000+0000", "created": "2011-04-15T03:23:39.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "feature", "intent", "release-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-04-17T01:59:32.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}

Our IntentProxy.getData is implemented by returning\nIntent.getDataString (\"The same as getData(), but\nreturns the URI as an encoded String\" [android docs]). This means\nwe can't then take that information and pass it back into a new\nintent's EXTRA_STREAM field. (EXTRA_STREAM: \"A content: URI holding\na stream of data associated with the Intent, used with ACTION_SEND\nto supply the data being sent.\").

\n

This, in turn, means we can't use our new intents and such to do\nsomething like the following:

\n\n

For example, if you try the attached win.js and select the Gmail\napp as the sending mechanism, Gmail crashes with

\n
\nW/Bundle  (30615): Key android.intent.extra.STREAM expected Parcelable but value was a java.lang.String.  The default value <null> was returned.\nW/Bundle  (30615): Attempt to cast generated internal exception:\nW/Bundle  (30615): java.lang.ClassCastException: java.lang.String\n
{html}", "attachment": [ { "id": "18169", "filename": "win.js", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:23:40.000+0000", "size": 2143, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: Support setting true URIs for EXTRA_STREAM", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "128880", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

@Marshall, in IntentProxy.putExtra we could check\nif key == Intent.EXTRA_STREAM && (value instanceof\nString) and then set it to a URI. But maybe we need a\nless-hacky, more general solution? (I haven't looked at all\nEXTRAs to see if others of them expect \"non-primitive\"\ndata types.)

\n

You can assign back to me after answer.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:23:40.000+0000", "updated": "2011-04-15T03:23:40.000+0000" }, { "id": "128881", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

The formatting of my commit got messed up, here's the commit\nthat fixed this:
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/f4d42cf4d2e1...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:23:41.000+0000", "updated": "2011-04-15T03:23:41.000+0000" }, { "id": "128882", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

test used to verify this:

\n
\n\nvar win = Ti.UI.createWindow({\n    backgroundColor: 'white'\n});\n\n// const value grabbed from\n// http://developer.android.com/reference/android/provider/MediaStore.Audio.Media.html#RECORD_SOUND_ACTION\nvar RECORD_SOUND_ACTION = \"android.provider.MediaStore.RECORD_SOUND\";\nvar soundUri = null; // Will be set as a result of recording action.\n\nvar recordButton = Titanium.UI.createButton({\n    top: 10, left: 10, right: 10, height: 35, title: \"Record Audio\"\n});\nvar labelResultCaption = Titanium.UI.createLabel({\n    top: 50, left: 10, right: 10, height: 35, visible: false, color: 'yellow'\n});\nvar labelResult = Titanium.UI.createLabel({\n    top: 90, left: 10, right: 10, height: 35, visible: false,\n    backgroundColor: 'white', color: 'black',\n    verticalAlign: 'top'\n});\n\nvar sendButton = Titanium.UI.createButton({\n    top: 130, left: 10, right: 10, height: 35, \n    title: \"Share Recorded Audio\", visible: false\n});\nsendButton.addEventListener('click', function(){\n    var intent = Titanium.Android.createIntent({\n        action: Titanium.Android.ACTION_SEND,\n        type: 'application/octet-stream'\n    });\n    intent.putExtraUri(Titanium.Android.EXTRA_STREAM, soundUri);\n    var chooserIntent = Titanium.Android.createIntentChooser(intent, 'Send Sound via');\n    Titanium.Android.currentActivity.startActivity(chooserIntent);\n});\n\nrecordButton.addEventListener('click', function() {\n    var intent = Titanium.Android.createIntent({ action: RECORD_SOUND_ACTION });\n    Titanium.Android.currentActivity.startActivityForResult(intent, function(e) {\n        if (e.error) {\n            labelResultCaption.text = 'Error: ' + e.error;\n            labelResultCaption.visible = true;\n        } else {\n            if (e.resultCode === Titanium.Android.RESULT_OK) {\n                labelResultCaption.text = 'Audio Captured.  Path to audio:';\n                soundUri = e.intent.data;\n                labelResult.text = soundUri;\n                labelResultCaption.visible = true;\n                labelResult.visible = true;\n                sendButton.visible = true;\n            } else {\n                labelResultCaption.text = 'Canceled/Error? Result code: ' + e.resultCode;\n                labelResultCaption.visible = true;\n            }\n        }\n    });\n});\n\nwin.add(recordButton);\nwin.add(labelResultCaption);\nwin.add(labelResult);\nwin.add(sendButton);\nwin.open();\n
{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:23:41.000+0000", "updated": "2011-04-15T03:23:41.000+0000" }, { "id": "128883", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

verified on droid2 2.2

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:23:41.000+0000", "updated": "2011-04-15T03:23:41.000+0000" }, { "id": "128884", "author": { "name": "andrecarregal", "key": "andrecarregal", "displayName": "Andre Carregal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Could you extend the test example in order to create a new file\nwith the recorded audio? How would soundUri be used in this\ncase?

{html}", "updateAuthor": { "name": "andrecarregal", "key": "andrecarregal", "displayName": "Andre Carregal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:23:41.000+0000", "updated": "2011-04-15T03:23:41.000+0000" }, { "id": "128885", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "{html}

Andre Carregal, check out this gist for an example of how to\nsave the response to a file. It works on videos, but the exact same\nthing can be applied to sound recording as well. What you want is\ntowards the end of the gist:

\n

https://gist.github.com/832488

{html}", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T03:23:41.000+0000", "updated": "2011-04-15T03:23:41.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }