public async Task ExecuteStartTrackingTripCommandAsync()
{
if (IsBusy)
{
return;
}
try
{
if (Geolocator.IsListening)
{
await Geolocator.StopListeningAsync();
}
if (Geolocator.IsGeolocationAvailable && (CrossDeviceInfo.Current.Platform == Plugin.DeviceInfo.Abstractions.Platform.iOS || Geolocator.IsGeolocationEnabled))
{
Geolocator.AllowsBackgroundUpdates = true;
Geolocator.DesiredAccuracy = 25;
Geolocator.PositionChanged += Geolocator_PositionChanged;
//every 3 second, 5 meters
await Geolocator.StartListeningAsync(3000, 5);
}
else
{
Acr.UserDialogs.UserDialogs.Instance.Alert(
"Please ensure that geolocation is enabled and permissions are allowed for MyDriving to start a recording.",
"Geolocation Disabled", "OK");
}
}
catch (Exception ex)
{
Logger.Instance.Report(ex);
}
}