Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[Spec] Listening for location changes in the foreground #1447

Closed
vividos opened this issue Oct 14, 2020 · 2 comments
Closed

[Spec] Listening for location changes in the foreground #1447

vividos opened this issue Oct 14, 2020 · 2 comments
Labels
feature-request A request for a new feature.

Comments

@vividos
Copy link
Contributor

vividos commented Oct 14, 2020

Starting foreground geolocation listener

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.

@vividos vividos added the feature-request A request for a new feature. label Oct 14, 2020
@vividos
Copy link
Contributor Author

vividos commented Oct 24, 2020

@jamesmontemagno @mattleibow @Redth what do you think? I would provide a first implementation on the base of this spec...

@vividos
Copy link
Contributor Author

vividos commented Jul 14, 2021

I updated the Spec, adding a new class ListeningRequest that contains MinimumTime and DesiredAccuracy, since I think that the GeolocationRequest with its default Timeout value of TimeSpan.Zero wasn't as suitable as I thought. I will also update PR #1579 with the new class.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request A request for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants