{ "id": "61754", "key": "TIMOB-1122", "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": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11253", "name": "Sprint 2011-18", "archived": true, "released": true, "releaseDate": "2011-05-09" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-05-04T15:49:17.000+0000", "created": "2011-04-15T02:44:34.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "geolocation", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T19:31:41.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

Titanium.Geolocation.addEventListener gets fired 50-75/sec on\napp startup with no location changes. My understanding was that\nthis was only supposed to fire when the location changed. On the\niphone simulator, I'm seeing this fire every 3 seconds. On the\ndevices its many, many times a second. It slows down the app\nstart-up and causes time-outs.

\n

http://pastie.org/994622

\n

In the console log, you can see the first location request and\nthen the following 187 are lines are the location listenter.

{html}", "attachment": [], "flagged": false, "summary": "Geolocation listener fires repeatedly", "creator": { "name": "curtisolson", "key": "curtisolson", "displayName": "Curtis Olson", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "curtisolson", "key": "curtisolson", "displayName": "Curtis Olson", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124895", "author": { "name": "curtisolson", "key": "curtisolson", "displayName": "Curtis Olson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Here is the code from app.js that requests location. It is very\nclose to the KitchenSink code.

\n
\ntry {\n    Ti.API.debug('Titanium.Geolocation.locationServicesEnabled: ' + Titanium.Geolocation.locationServicesEnabled);\n    if (Titanium.Geolocation.locationServicesEnabled == false) {\n        Titanium.UI.createAlertDialog({\n            title: 'Warning',\n            message: 'Your device has geolocation turned off. Please turn it on now.'\n        }).show();\n    }\n    else {\n        Ti.API.debug('Location services are available');\n        //\n        //  SET ACCURACY\n        //\n        Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;\n        //\n        //  SET DISTANCE FILTER.  THIS DICTATES HOW OFTEN AN EVENT FIRES BASED ON THE DISTANCE THE DEVICE MOVES\n        //  THIS VALUE IS IN METERS\n        //\n        Titanium.Geolocation.distanceFilter = 10;\n        //\n        // GET CURRENT POSITION - THIS FIRES ONCE\n        //\n        var myLongitude;\n        var myLatitude;\n        var myAltitude;\n        var myHeading;\n        var myAccuracy;\n        var mySpeed;\n        var myGeoTimestamp;\n        var myAltitudeAccuracy;\n        Titanium.Geolocation.getCurrentPosition(function(e){        \n            if (e.error) {\n                Ti.API.error('Geolocation Error');\n                Ti.API.error('error:' + JSON.stringify(e.error));\n                return;\n            };\n            // get values from geolocation call\n            myLatitude = e.coords.latitude;\n            Titanium.App.Properties.setDouble('myLatitude', myLatitude);\n            myLongitude = e.coords.longitude;\n            Titanium.App.Properties.setDouble('myLongitude', myLongitude);\n            myAltitude = e.coords.altitude;\n            myHeading = e.coords.heading;\n            myAccuracy = e.coords.accuracy;\n            mySpeed = e.coords.speed;\n            myGeoTimestamp = e.coords.timestamp;\n            myAltitudeAccuracy = e.coords.altitudeAccuracy;\n            showVariables('Got Geolocation info');\n        });\n        //\n        // EVENT LISTENER FOR GEO EVENTS - THIS WILL FIRE REPEATEDLY (BASED ON DISTANCE FILTER)\n        //\n        Titanium.Geolocation.addEventListener('location', function(e){\n            if (e.error) {\n                Ti.API.error('Geolocation Error');\n                Ti.API.error('error:' + JSON.stringify(e.error));\n                return;\n            };\n            \n            // get values from geolocation call\n            myLatitude = e.coords.latitude;\n            Titanium.App.Properties.setDouble('myLatitude', myLatitude);\n            myLongitude = e.coords.longitude;\n            Titanium.App.Properties.setDouble('myLongitude', myLongitude);\n            myAltitude = e.coords.altitude;\n            myHeading = e.coords.heading;\n            myAccuracy = e.coords.accuracy;\n            mySpeed = e.coords.speed;\n            myGeoTimestamp = e.coords.timestamp;\n            myAltitudeAccuracy = e.coords.altitudeAccuracy;\n            \n            geoCount = geoCount + 1;\n            Ti.API.info('***********  Geo: ' + geoCount + ' ' + myLatitude + '/' + myLongitude + ' ');\n            Titanium.Geolocation.distanceFilter = 100; // changed after first location event \n        });\n    };\n}\ncatch(err) {\n    Titanium.UI.createAlertDialog({\n        title: 'Geolocation Error',\n        message: err\n    }).show();  \n};\n
{html}", "updateAuthor": { "name": "curtisolson", "key": "curtisolson", "displayName": "Curtis Olson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:35.000+0000", "updated": "2011-04-15T02:44:35.000+0000" }, { "id": "124896", "author": { "name": "udi", "key": "udi", "displayName": "Udi", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I'm seeing the same behavior. It doesn't make any sense.

{html}", "updateAuthor": { "name": "udi", "key": "udi", "displayName": "Udi", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:35.000+0000", "updated": "2011-04-15T02:44:35.000+0000" }, { "id": "124897", "author": { "name": "cliftonlabrum", "key": "cliftonlabrum", "displayName": "Clifton Labrum", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I'm see this problem as well.

\n

When I test the code in the KitchenSink, I can't get the\nposition to update based on a position change (according to the\ndistance filter). Only the initial position is acquired, and no\nsubsequent positions are acquired. The distance filter seems\ninoperable.

\n

The only way I've managed to get working GPS functionality is to\ncall getCurrentPosition on the location event like\nthis:

\n
\nTi.Geolocation.addEventListener('location', getPosition);\n\nfunction getPosition(e) {\n    \n    //Watch for errors\n    if(e.error){ return; }\n\n    Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;\n    Ti.Geolocation.distanceFilter = 100;            \n  \n    Ti.Geolocation.getCurrentPosition(function(e){\n        if(e.error){ return; }\n        \n        //Get the GPS goods\n        var longitude = e.coords.longitude;\n        var latitude = e.coords.latitude;\n        var altitude = e.coords.altitude;\n        var accuracy = e.coords.accuracy;\n        var timestamp = e.coords.timestamp;\n    });\n}\n
\n

So I'm basically getting the initial position over and over\nagain using the location event. It feels wrong, but\nit's the only thing I've been able to figure out.

{html}", "updateAuthor": { "name": "cliftonlabrum", "key": "cliftonlabrum", "displayName": "Clifton Labrum", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:36.000+0000", "updated": "2011-04-15T02:44:36.000+0000" }, { "id": "124898", "author": { "name": "norm", "key": "norm", "displayName": "Norm", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Having the same problem with the kitchen sink code, it only\nseems to update the first time then hangs. Although, after opening\nthe google maps app and allowing the GPS to sync and pulse, closing\ngoogle maps, then opening the kitchen sink app again it seems to\nwork properly and location updates flow in and regular intervals.\nAny ideas!?

{html}", "updateAuthor": { "name": "norm", "key": "norm", "displayName": "Norm", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:36.000+0000", "updated": "2011-04-15T02:44:36.000+0000" }, { "id": "124899", "author": { "name": "taazza", "key": "taazza", "displayName": "Taazza", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

We are seeing the same problem that norm is seeing.

\n

Later location updates seem to fire up even when the location\ndoesnt change. Kitchensink example doesnt work as coded. Let us\nknow if you need more info.

{html}", "updateAuthor": { "name": "taazza", "key": "taazza", "displayName": "Taazza", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:36.000+0000", "updated": "2011-04-15T02:44:36.000+0000" }, { "id": "124900", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Looks like this is a pressing issue.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:44:36.000+0000", "updated": "2011-04-15T02:44:36.000+0000" }, { "id": "133198", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "\"Fixed\" by 89ba1a4. Issue was that we had a feature which covers this issue, but it was not documented.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-04T15:49:17.000+0000", "updated": "2011-05-04T15:49:17.000+0000" }, { "id": "133310", "author": { "name": "admin@telanorth.com", "key": "admin@telanorth.com", "displayName": "Steve", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Stephen Tramer,\n\nWhere can we find the documentation?", "updateAuthor": { "name": "admin@telanorth.com", "key": "admin@telanorth.com", "displayName": "Steve", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-09T08:37:35.000+0000", "updated": "2011-05-09T08:37:35.000+0000" }, { "id": "133312", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In the apidocs, which are not published until release. You can always view the specific changes made to the documentation formatting files:\n\nhttps://github.com/appcelerator/titanium_mobile/commit/89ba1a4b9f450909cc58c67cdf0d8669f388d9d7#diff-0", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-09T10:24:04.000+0000", "updated": "2011-05-09T10:24:04.000+0000" }, { "id": "408480", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closed as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T19:31:41.000+0000", "updated": "2017-03-02T19:31:41.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }