You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 15, 2024. It is now read-only.
James' Geolocation plugin provides one extra feature above getting geo locations, and that is starting (and stopping) listening for geolocations and changes. I know that it's complicated when the listening should start or continue in the background, but this is not the scope for the new API. My use case is that as long as the app is open, the user wants to track where he/she is.
API
Geolocation
public static bool IsListening { get; }
public static Task<bool> StartListeningForegroundAsync(ListeningRequest request);
public static Task<bool> StopListeningForegroundAsync();
public static event EventHandler<LocationEventArgs> LocationChanged;
public class LocationEventArgs : EventArgs
{
public Location Location { get; }
public LocationEventArgs(Location location);
}
public class ListeningRequest
{
public ListeningRequest();
public ListeningRequest(GeolocationAccuracy accuracy);
public ListeningRequest(GeolocationAccuracy accuracy, TimeSpan timeout);
public TimeSpan MinimumTime { get; set; } = TimeSpan.FromSeconds(1);
public GeolocationAccuracy DesiredAccuracy { get; set; } = GeolocationAccuracy.Default;
}
Scenarios
This API is purely for listening when the app is in foreground. No guarantees about what's happening when the app is in the background.
Platform Compatibility
Target Frameworks:
iOS: yes
Android: yes
UWP: yes
MacOS: yes
Backward Compatibility
All new methods, so no backward compat issues.
Difficulty : medium
The implementation would mainly contain of the PR #1043 and parts of @jamesmontemagno 's plugin.