flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

[WIP] Allow updating location stream settings

Open orkun1675 opened this issue 9 months ago • 5 comments

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 https://github.com/Baseflow/flutter-geolocator/issues/1569. Improved version of https://github.com/Baseflow/flutter-geolocator/pull/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 avatar Mar 21 '25 00:03 orkun1675

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

orkun1675 avatar Mar 21 '25 00:03 orkun1675

Dear @orkun1675,

Thanks for your PR. We are looking forward to review this. Looks like an interesting addition. I'll do a quick review, try to do a little test and you can clean it up if possible.

Kind regard,

TimHoogstrate avatar Mar 31 '25 08:03 TimHoogstrate

I've tested this on iOS and Android (Pixel 7) en it seems to work as expected.

TimHoogstrate avatar Mar 31 '25 10:03 TimHoogstrate

The idea is to split up the PR in desperate PR's. Separate packages, platform interface and app facing package. If you need any help from us let us know.

Kind regards,

TimHoogstrate avatar Mar 31 '25 10:03 TimHoogstrate

Thank you for the review. I'll address the native plugin comments after https://github.com/Baseflow/flutter-geolocator/pull/1760 lands.

orkun1675 avatar Nov 22 '25 06:11 orkun1675