Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Location event returns limited data

$
0
0

All,

I'm trying to write a simple location tracker on iOS. It needs to be pretty accurate and update often, so I figured the location event would work. The problem is that I'm getting next to no events. After tracking for 60 seconds and walking back and forth across an area about 50 feet long, I get 2 events right at startup and maybe 1 or two more.

The code should be fairly straight forward... but I'm just not getting the events. Has anyone successfully used the location event for fine location tracking?

Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
    Ti.Geolocation.distanceFilter = 0;
    Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
    Ti.Geolocation.addEventListener('location', locationHandler);
function locationHandler (e) {
    if (e.error) {
        Log.error('location error', e.error);
        addDebugLog('location error');      
    } else {        
        var data = {
            time : (new Date()).getTime(),
            lat : e.coords.latitude,
            lon : e.coords.longitude
        };
 
        trackerLog.push(data);
        addDebugLog(JSON.stringify(data));
    }
}
Thanks for any advice

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>