{ "id": "85026", "key": "TIMOB-7249", "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": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13401", "description": "Sprint 2012-09 Core", "name": "Sprint 2012-09 Core", "archived": true, "released": true, "releaseDate": "2012-05-06" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-02T10:42:22.000+0000", "created": "2012-01-17T06:53:32.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "core", "dr-list", "parity" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [ { "id": "16877", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "90284", "key": "TIMOB-8751", "fields": { "summary": "Android: Ti.Geolocation.getPreferredProvider() crashes the app when location services are disabled", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "38799", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "132629", "key": "AC-1611", "fields": { "summary": "Image intent Filter always null in android ", "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" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-03-24T21:04:18.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": "h2. Problem\r\n\r\nWhen deciding how an app should handle an incoming Android Intent, knowing the type, action, and data values that were sent with the Intent are critical. If your app only handles one very specific Intent, this is OK, but if you have an app that handles images, URIs, video,, etc... you need to know these values. \r\n\r\nRight now when an Intent is received via Intent Filter in Titanium, the following lists the values/errors you will get for the data, type, and action functions and properties of an Intent:\r\n\r\n* {{getData()}} always equals {{null}} \r\n* {{getType()}} and {{getAction()}} always throw this exception, despite the fact that logic and documentation dictates that these functions do not require arguments:\r\n{code}Uncaught Error: Requires property name as first argument{code}\r\n* The {{data}} property always returns {{null}}\r\n* The {{action}} and {{type}} properties always return {{undefined}}\r\n\r\nh2. Proposed Solution\r\n\r\nThe above listed functions and properties need to return the appropriate values for {{data}}, {{type}}, and {{action}} so that developers will know what to do with the Android Intent that they are receiving. Like I said, if you are handling only one type of data as dictated by your Intent Filter, you are OK. But if you plan to handle images, video, etc... and you need to read them from Ti.Android.EXTRA_STREAM, you have no way of knowing which type of Intent you are receiving.\r\n\r\nAlso, I believe the implementation of {{getAction()}} and {{getType()}} need to change so that they do not require a parameter.\r\n\r\nh2. Test Case\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff',\r\n fullscreen: false,\r\n exitOnClose: true\r\n});\r\nwin.addEventListener('open', function(e) {\r\n var intent = Ti.Android.currentActivity.getIntent();\r\n var iname = Ti.Android.EXTRA_STREAM;\r\n \r\n if (intent && intent.hasExtra(iname)) {\r\n \tTi.API.info(intent.getAction());\r\n \tTi.API.info(intent.getData());\r\n \tTi.API.info(intent.getType());\r\n } else {\r\n Ti.API.info('No extra named \"' + iname + '\" found in Intent');\r\n }\r\n});\r\nwin.open();\r\n{code}\r\n\r\nIt will also be necessary to add an intent filter to a custom AndroidManifest.xml to get this test case to receive intents. The only below needs to go in the main activity and will receive all image share intents. You can easily trigger an image share intent by long clicking on an image in the android gallery then select 'share' from the intent list. Then just select your test case app from the list.\r\n\r\n{code:xml}\r\n\r\n \r\n \r\n \r\n\r\n{code}", "attachment": [ { "id": "34845", "filename": "Jan18.txt", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-18T15:17:05.000+0000", "size": 2914, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: Intent - getData(), getAction(), and getType() do not work", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK version: 1.8.0.1\r\nJavascript Engine: Rhino & V8 \r\nPlatform & version: Android 2.2+\r\nDevice Details: Android emulator & device (Droid X)\r\nHost Operating System: OSX 10.7.2 \r\nTitanium Studio version: 1.0.7.201112132151", "comment": { "comments": [ { "id": "179549", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If you need a test case, let me know, but this should be present in all handling of Android Intents. It's also worth noting that my testing was done using the {{Ti.Android.EXTRA_STREAM}} extra. No handling of the actual Intent stream data is necessary to create the above issues, though.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-17T07:05:00.000+0000", "updated": "2012-01-17T07:05:00.000+0000" }, { "id": "192808", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hey Tony, would it possible to provide a test case? I checked the methods on the android side and getType() and getAction() don't require any arguments, so I'm not sure what the issue is there. If you could provide a test case that reproduces the failure, that would be great.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-26T14:16:06.000+0000", "updated": "2012-04-26T14:16:06.000+0000" }, { "id": "192908", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test case added. Every run will result in the errors I've listed above. I am aware that getType() and getAction() _should not_ require arguments, but they throw an exception if they are not supplied with one.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-27T07:18:42.000+0000", "updated": "2012-04-27T07:18:42.000+0000" }, { "id": "192935", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Looks like this is the same issue as TIMOB-8751. Looks like an easy fix, will have a PR ready soon.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-27T10:12:00.000+0000", "updated": "2012-04-27T10:12:00.000+0000" }, { "id": "193365", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "h3. Testing Notes\r\n\r\nUse the test case in the description of this JIRA item, except change the line...\r\n\r\n{code}\r\nTi.API.info(intent.getData());\r\n{code}\r\n\r\n... to ...\r\n\r\n{code}\r\nTi.API.info(intent.getStringExtra(Ti.Android.EXTRA_STREAM));\r\n{code}\r\n\r\n... because Gallery puts the Uri to the selected image in that instead of the {{data}} property.\r\n\r\nI expanded the utility of {{getStringExtra}} such that if it doesn't find a string extra with the given name, it will also try {{getParcelableExtra}} with the given name and, if it finds a result, return the {{toString()}} value of it. This is useful because it would be hard for us to support {{getParcelableExtra}} given the myriad of possible return types it has. Unfortunately, one of the most common intent properties, {{Intent.EXTRA_STREAM}}, is retrievable only as a parcelable extra, so it would suck to not have access to that. Thus the expanded capability of {{getStringExtra}} at least helps with things like Uris, since their string representations are reasonable equivalents of their actual value.", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-05-01T16:35:09.000+0000", "updated": "2012-05-01T16:35:09.000+0000" }, { "id": "193369", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "Pull request\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/2114", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-05-01T17:16:28.000+0000", "updated": "2012-05-01T17:16:28.000+0000" }, { "id": "234975", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Need additional review.\nTested with:\nTitanium Studio, build: 3.0.1.201212181159\nTitanium SDK, build: 3.0.2.v20130117161659\nDevices:\nDroid3 4.0.3\nNexus4 4.2\nActual result:\nSee log for details (Jan18.txt)", "updateAuthor": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-18T15:17:30.000+0000", "updated": "2013-01-18T15:17:30.000+0000" }, { "id": "415780", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed with reference to previous comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T21:04:18.000+0000", "updated": "2017-03-24T21:04:18.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }