{ "id": "90235", "key": "TIMOB-8746", "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": "13405", "description": "Sprint 2012-09 API", "name": "Sprint 2012-09 API", "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-04-25T13:40:08.000+0000", "created": "2012-04-16T13:53:12.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "api", "parity" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2013-01-16T22:56:17.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": "While using the GeoLocation e.coords.longitude is returning undefined. In the below code if you comment out the \"if condition\" you will see the error \"cannot read property 'longitude' of undefined\". It's working fine in iOS.\r\nh4. Repo Steps\r\n1. Run the below code in the app.js file.\r\n2. You will get an error \"gps is not available\", when gps drops in android.\r\n3. If you comment out the if condition you can see the error \"cannot read property 'longitude' of undefined\" \r\n\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({\r\n\ttitle : 'Tab 1',\r\n\tbackgroundColor : '#fff'\r\n});\r\nTi.Geolocation.preferredProvider = \"gps\";\r\n\r\nvar latitude = 33.58262112511852;\r\nvar longitude = -111.71566843986511;\r\n\r\nvar locationCallback = function(e) {\r\n\tif(!e.success || e.error) { \r\n\t\talert('error:' + JSON.stringify(e.error)); \r\n\t\treturn; \r\n\t}\r\n\tTi.API.info(JSON.stringify(e));\r\n\r\n\tvar longitude = e.coords.longitude;\r\n\tvar latitude = e.coords.latitude;\r\n\r\n}\r\nTitanium.Geolocation.addEventListener('location', locationCallback);\r\n\r\nwin1.open();\r\n\r\n\r\n{code}", "attachment": [ { "id": "27143", "filename": "android_error.png", "author": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-16T13:53:12.000+0000", "size": 22058, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Geolocation e.coords.longitude is returning undefined.", "creator": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "android 2.2.2\r\nLG Optimus V\r\nTi SDK 2.1.x", "comment": { "comments": [ { "id": "192321", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Neither IOS nor Mobileweb have coords in the location event when success is false.\r\n\r\nPull pending https://github.com/appcelerator/titanium_mobile/pull/2055", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-23T16:56:04.000+0000", "updated": "2012-04-23T16:56:04.000+0000" }, { "id": "192631", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "Just to clarify, the PR fixes the documentation and properly sets the event data structure in the case of error. Trying to access coords of a error event will still result in failure.", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-04-25T13:40:00.000+0000", "updated": "2012-04-25T13:40:00.000+0000" }, { "id": "199924", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified with documentation, however an attached code will not have issues previously described.", "updateAuthor": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-23T14:18:30.000+0000", "updated": "2012-06-23T14:18:30.000+0000" }, { "id": "234688", "author": { "name": "akshaytaru2007@gmail.com", "key": "akshaytaru2007@gmail.com", "displayName": "Akshay Taru", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Yes, I am also facing this issue.\r\n1. I get latitude and longitude in alert but if I try to return them nothing is returned.\r\n2. I am getting latitude and longitude on button click, on first click (1) is observed.(Nothing returned)\r\n3. When I again click the button, I get the latitude and longitude in return.(Every time I have to click 2 times on a button to get values)\r\n\r\n\r\n*Code :*\r\n{code:JavaScript}\r\n\r\n\r\n Titanium.Geolocation.addEventListener('location', function(e) {\r\n \t\t\t\r\n \t\t\tif (e.error) {\r\n \t\t\t\t\r\n \t\t\t\t\r\n \t\t\t\tTi.App.geolocation={\r\n \t\t\t\t\t\r\n \t\t\t\t\tlatitude:'',\r\n \t\t\t\t\tlongitude:'',\r\n \t\t\t\t\tgeoError: true\r\n \t\t\t\t\t\r\n \t\t\t\t};\r\n \t\t\t\talert( \"Not found \" ); \r\n \t\t\t\t \r\n }else{\r\n \r\n geoError=false;\r\n Ti.App.geolocation={\r\n \t\t\t\t\t\r\n \t\t\t\t\tlatitude:e.coords.latitude,\r\n \t\t\t\t\tlongitude:e.coords.longitude,\r\n \t\t\t\t\tgeoError: false\r\n \t\t\t\t\t\r\n \t\t\t\t};\r\n \t\t\t\talert(Ti.App.geolocation.latitude+\" Inside\");\r\n } \t \t\t\r\n \r\n });\r\n\r\n\r\n\r\n\r\n{code}\r\n\r\n\r\nbut I find nothing in *Ti.App.geolocation* on first button click on second button click I can see content", "updateAuthor": { "name": "akshaytaru2007@gmail.com", "key": "akshaytaru2007@gmail.com", "displayName": "Akshay Taru", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-01-16T22:56:17.000+0000", "updated": "2013-01-16T22:56:17.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }