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

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

@vividos

Description

@vividos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions