Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

CLLocationManager - Inconsistent update rates

JeffRushJeffRush USMember ✭✭✭

I have an app installed on three devices - an iPhone 5, 5s and 6. The app uses the following code to get the location roughly every 50m:

using (var pool = new NSAutoreleasePool())
    _LocationTrackingManager = new CLLocationManager();
    _LocationTrackingManager.DistanceFilter = 50;
    _LocationTrackingManager.LocationsUpdated += (object s, CLLocationsUpdatedEventArgs args) => 
            CLLocation location = args.Locations[args.Locations.Length - 1];
            MyWebService service = new MyWebService.Service1();
            service.Insert(DriverID, DateTime.Now.ToString("M-d-yyyy H:m:s"), location.Coordinate.Latitude, location.Coordinate.Longitude);
        catch {blah blah blah}

I've modified the Info.plist file to Enable Background Modes and Location Updates.

On the iPhone 5, at times I'm getting an update every two seconds even when the driver is stationary. In a three-hour span I've had over 1200 updates.
On the iPhone 5s, during that same span I've had roughly 300 updates.
On the 6, I've only had 10 updates.

I'm really just interested in knowing where they are when the actual app is opened, so I'll probably disable the "Enable Background Modes" option to reduce battery consumption and wasted database space. But I'm just curious as to why I'd get different behavior on different devices when all three drivers follow the same pattern: drive for a while, stop at a location, open the app, record data, put phone into sleep mode, drive to next location.

Sign In or Register to comment.