{ "id": "118808", "key": "TIMOB-14920", "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": null, "resolutiondate": null, "created": "2013-08-20T14:31:46.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-06-30T04:36:48.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Description of the problem\r\nWhen opening an intent to share data using startActivityForResult, the result e.resultCode is always set to RESULT_CANCELED\r\n\r\nh2. Test code\r\n1) Use the following code to test\r\n2) Share an image with an external app: if you share or cancel, the result is always CANCELED\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'black'\r\n});\r\n \r\nvar btn = Ti.UI.createButton({\r\n title: 'Share'\r\n});\r\nbtn.addEventListener('click', function(e) {\r\n var intent = Ti.Android.createIntent({\r\n type: \"image/jpg\",\r\n action: Ti.Android.ACTION_SEND\r\n });\r\n \r\n var image = Ti.Filesystem.getFile(Ti.Filesystem.externalStorageDirectory, 'image.jpg');\r\n Ti.API.info(image.nativePath);\r\n\t\r\n\tintent.putExtra(Ti.Android.EXTRA_SUBJECT, \"Subject\");\r\n\tintent.putExtra(Ti.Android.EXTRA_TITLE, \"Title\");\r\n\tintent.putExtra(Ti.Android.EXTRA_TEXT, \"Text\");\r\n\tintent.putExtraUri(Ti.Android.EXTRA_STREAM, image.nativePath);\r\n\tTi.Android.currentActivity.startActivityForResult(Ti.Android.createIntentChooser(intent, \"Share image\"), function(e) {\r\n\t\tswitch(e.resultCode) {\r\n\t\t\tcase Ti.Android.RESULT_OK:\r\n\t\t\t\talert(\"OK\"); break;\r\n\t\t\tcase Ti.Android.RESULT_CANCELED:\r\n\t\t\t\talert(\"CANCELED\"); break;\r\n\t\t}\r\n\t});\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\t\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: startActivityForResult always returns RESULT_CANCELED in the callback", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android 4.2.2, 4.3\r\nSDK 3.1.2, 3.2.0\r\nTi CLI 3.2.0\r\n", "comment": { "comments": [], "maxResults": 2, "total": 2, "startAt": 0 } } }