Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrossGeolocator.Current.StartListeningAsync() not working properly #353

Open
BurhanMunir opened this issue Feb 13, 2023 · 0 comments
Open

Comments

@BurhanMunir
Copy link

BurhanMunir commented Feb 13, 2023

I am stuck how to use CrossGeolocator.Current.StartListeningAsync() method. what it's parameters for timespan and distance do. and what if I put one of these parameters equal to zero .. I Actually need listening after particular seconds only or after particular distance only.

Bug Information

Version Number of Plugin:Xam.Plugin.Geolocator(4.5.0.6)
Device Tested On:Android and iOS
Simulator Tested On:
Version of VS: 2022
Version of Xamarin:5.0.0.2012
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Startlistener should listen after the particular time or particular distance

Actual Behavior

Startlistener mixes up the time and distance

Code snippet

if (await CrossGeolocator.Current.StartListeningAsync(TimeSpan.FromSeconds(Helper.Utils.Seconds), 1, false
,new ListenerSettings {
DeferralTime = TimeSpan.FromSeconds(Helper.Utils.Seconds),
DeferralDistanceMeters=null,
DeferLocationUpdates=false,
AllowBackgroundUpdates = true
})) {
Helper.Utils.IsTracking = true;
}

if (await CrossGeolocator.Current.StartListeningAsync(TimeSpan.FromSeconds(Helper.Utils.Seconds), Helper.Utils.Meters, false
,new ListenerSettings {
AllowBackgroundUpdates= true
} )) {
var location = await Geolocation.GetLocationAsync();

                            previousLatitude = location.Latitude;
                            previousLongitude = location.Longitude;
                            Helper.Utils.IsTracking = true;
                        }

Screenshotst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant