{ "id": "63950", "key": "TIMOB-3318", "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-08T23:28:58.000+0000", "created": "2011-04-15T03:42:02.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "tbs-1.8.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-08T23:28:58.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 have an issue using Titanium.Network.createHTTPClient with\nAndroid. Im trying to call an url http://www.motorsport-total.com/f1/live/htdocs/ticker.php\n. When i call this url a redirect should happen as you can see if\nyou use an usual web browser like firefox or chrome. It usually\nredirects to this url : \nhttp://www.motorsport-total.com/f1/live/htdocs/ticker.php?strecken_...
\nThen i want to get those get parameters for using them in my app\nto get the latest race results. This works great with iOs but\ndoenst work with Android. It still keeps on http://www.motorsport-total.com/f1/live/htdocs/ticker.php
\nIs there any way to get the redirect working or to get those get\nparameters? I really need that fast because the iOs Version is\nalready available in the iTunes Store and our client wants to go\nlive with the Android Version. And thats the last big issue i\nhave.
\nThis is the code:
\n\nfunction get_last()\n{\n var req = new r_ajax('http://www.motorsport-total.com/f1/live/htdocs/ticker.php', function(f)\n {\n Titanium.API.info('location of request = ' + f.location);\n var query = f.location.replace('http://www.motorsport-total.com/f1/live/htdocs/ticker.php?', '');\n var vars = query.split(\"&\");\n \n for (var i = 0; i < vars.length; i++) \n {\n Titanium.API.error(vars[i]);\n var pair = vars[i].split(\"=\");\n \n if (pair[0] == 'strecken_id') \n {\n win.strecken_id = pair[1];\n }\n \n if (pair[0] == 'event_id') \n {\n win.event_id = pair[1];\n }\n }\n \n Titanium.API.info('win.strecken_id = ' + win.strecken_id );\n Titanium.API.info('win.event_id = ' + win.event_id);\n \n xmlFile = 'http://www.motorsport-total.com/f1/live/xmlfeed/generic/S_ID_' + win.strecken_id + '_EV_ID_' + win.event_id + '.xml';\n xmlNewsFile = 'http://www.motorsport-total.com/f1/live/xmlfeed/generic/S_ID_' + win.strecken_id + '_EV_ID_' + win.event_id + '_news.xml';\n createTickerValues(\n {\n url: xmlFile\n }, showLive, live_err);\n }, function()\n {\n Titanium.API.error('Error at function get_last live.js = ' + e);\n }, 'GET').send();\n}
\n
\n\nvar r_ajax = function(url,on_ok, on_err, method, async) {\n var async = !!async ? true : false;\n var method = !!method ? method : 'POST';\n var xhr = Titanium.Network.createHTTPClient();\n \n xhr.onload = function()\n {\n on_ok(this);\n xhr.abort();\n };\n \n xhr.onerror = function(e){\n on_err(e);\n xhr.abort();\n }; \n \n \n xhr.open(method,url,async);\n \n return {\n xhr:xhr,\n send:function(data) {\n xhr.send(data); \n },\n abort:function() { xhr.abort();}\n };\n};
\n
Problem
\nConfirmed that above code works properly if not redirected and\nfails only on Android when redirect is required.
Test
\nTested on TiDev 1.6 and 1.7 (03/10/11) emulator APIs 2.2.
\nFailed test results:
\nwin.strecken_id = undefined
\nwin.event_id = undefined
Ticket Reference
\nHD Ticket Reference: http://developer.appcelerator.com/helpdesk/view/76362