protected override void PlatformSpecificStart(MvxGeoLocationOptions options)
{
if (_locationManager != null)
throw new MvxException("You cannot start the MvxLocation service more than once");
_locationManager = (LocationManager) Context.GetSystemService(Context.LocationService);
if (_locationManager == null)
{
MvxTrace.Warning( "Location Service Manager unavailable - returned null");
SendError(MvxLocationErrorCode.ServiceUnavailable);
return;
}
var criteria = new Criteria {Accuracy = options.EnableHighAccuracy ? Accuracy.Fine : Accuracy.Coarse};
var bestProvider = _locationManager.GetBestProvider(criteria, true);
if (bestProvider == null)
{
MvxTrace.Warning( "Location Service Provider unavailable - returned null");
SendError(MvxLocationErrorCode.ServiceUnavailable);
return;
}
// 4th September 2013 - defaults changed to 0,0 - meaning send updates as often as possible
_locationManager.RequestLocationUpdates(bestProvider, 0, 0, _locationListener);
// TODO - Ideally - _geoWatcher.MovementThreshold needed too
}