-
Notifications
You must be signed in to change notification settings - Fork 482
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
Adding Background/Foreground Services to GeoLocator UPDATE #3803
Conversation
Reviewer's Guide by SourceryThis pull request adds background/foreground service functionality to the GeoLocator control, implements bug fixes, and updates the client and Android components to align with flet-build-template 0.24.0. The changes primarily focus on enhancing location tracking capabilities, improving error handling, and updating dependencies. File-Level Changes
Tips
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @syleishere - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a configurable update interval for location tracking to allow users to balance between location accuracy and battery life, especially for mobile devices.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
} else { | ||
debugPrint('Geolocator: Position is null.'); | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Implement more robust error handling in _enableLocationService
The current error handling only logs the error. Consider implementing a more comprehensive strategy, such as propagating the error to the user or implementing a retry mechanism.
onError: (e) {
debugPrint('Geolocator: Error getting stream position: $e');
// Propagate error to user
_showErrorToUser('Unable to get location. Please try again.');
// Implement retry mechanism
_retryLocationService();
},
Ran tests on windows, web and android. Nothing fails, although this should only be used on android and IOS phones, it does work on other platforms for whatever reason from flutter package. To run example and have it work on android run app once, then go to permissions and enable location and notification permissions on phone for app. Restart app and should display a foreground service notification background service is enabled for updated website example when they click start service. Users should enable those permissions on android("LOCATION and NOTIFICATIONS") in their Flet app with permissions package before attempting to enable the service in a real app. IOS is untested, but I did look at info.plist file and that permission is already there that is needed, so if someone with an iphone can test, wonderful. |
Is the PR ready for review? |
Yeah I removed filepicker from pubspec.yaml in client area, should be good to go. |
CI is failing: https://ci.appveyor.com/project/flet-dev/flet/builds/50445436/job/7a7hr2otdjkon27e#L269 |
Took a look seems related to this PR which fixes it: Baseflow/flutter-permission-handler@817ae00 |
If you set version to 0.1.3+2 for permission_handler_html should resolve the PR commit from 3 days ago from them. I'll see if it works if i can modify it in flet_permission_handler/pubspec.yaml |
Appveyor builds successfully applying permission_handler_html pubspec.yaml fix |
@syleishere can you please make a PR to the template repo to update the necessary files (using the 0.24.0 branch as base-branch)? |
I have a PR there already for 0.24.0 branch for additions needed to AndroidManifest.xml |
Description
Adds background/foreground service to geolocator, bug fix, as well as client/android updates to more closely match flet-build-template 0.24.0.
Test Code
Type of change
Checklist:
Additional details
Merging this PR along with one for flet-build-template 0.24.0 should be all that is needed.
Summary by Sourcery
Add background and foreground services to the geolocator for improved location tracking capabilities. Fix permission handling issues and update dependencies to align with the flet-build-template 0.24.0. Introduce new methods for enabling and disabling geolocation services, enhancing the control over location tracking.
New Features:
Bug Fixes:
Enhancements:
Build: