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

Allow updating location stream settings #1664

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

orkun1675
Copy link

This PR allows updating the location stream after one is started. It adds a new API endpoint:

  /// Updates the parameters of the active position stream.
  ///
  /// Throws a [NotSubscribedException] when there is no active position stream
  /// to update.
  static Future<void> updatePositionStream({
    required LocationSettings locationSettings,
  }) =>
      GeolocatorPlatform.instance.updatePositionStream(
        locationSettings: locationSettings,
      );

This endpoint allows plugin users to change settings, such as distanceFilter or intervalDuration, without having to stop & start the stream. This is critical if the update is hapenning while the app is in the background since Android does not allow starting a location stream unless the app is in focus.

Fixes #1569. Improved version of #1406.

If there is interest in merging this PR I will clean it up and send for review.


Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

@orkun1675
Copy link
Author

@TimHoogstrate PLMK if there is interest in merging this PR and I can clean it up.

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

Successfully merging this pull request may close these issues.

[Question]: Updating accuracy/distanceFilter while the Position stream is running
1 participant