Forum Xamarin.iOS

CLLocationManager AllowDeferredLocationUpdatesUntil(100, 30) not working

_DK__DK_ DEMember ✭✭

The method AllowDeferredLocationUpdatesUntil(distance, time) of the Class CLLocationManager fires every second in the Simulator or always different on the device (iPhone s3). Why does the time i am entered is not retained? Here is my source code:

 protected CLLocationManager locMgr;

            partial void BtnLocation_TouchUpInside(UIButton sender)
                    {                     if (CLLocationManager.LocationServicesEnabled)
                           {
                           LocMgr.Delegate = new MyLocationDelegate();

                           LocMgr.DesiredAccuracy = CLLocation.AccuracyBest; 
                           LocMgr.DistanceFilter = CLLocationDistance.FilterNone; 
                           LocMgr.AllowsBackgroundLocationUpdates = true;  
                           LocMgr.AllowDeferredLocationUpdatesUntil(100, 30);  //Distance in meter, Time in seconds
                           LocMgr.StartUpdatingLocation();
                            }
                     }




 public class MyLocationDelegate : CLLocationManagerDelegate
             {
                 public override void LocationsUpdated(CLLocationManager manager, CLLocation[] locations)
                 {                              

                     foreach (var loc in locations)
                     {    
                            // do something                                  
                     }
                 }       
            }

any ideas?

Sign In or Register to comment.