Lyokone / flutterlocation

A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.
MIT License
1.09k stars 791 forks source link

fix: Location.getLocation() not resolving when app location accouracy is not set to Precise #748

Open TouseefAQ opened 2 years ago

TouseefAQ commented 2 years ago

When i turn off location accuracy from app setting in ios , getLocation doesn't resolve.Althought i have set location accuracy to LocationAccuracy.low from changeSetting methode. Similary on Android 7 , user device location is turned off but IslocationServiceEnabled returns true every time. On Android 12 is i turn off precise location off and call getLocation() , getPrecise location request box pops and if i select approximate location , It crashes the app

It should ateast get approximate location.

Steps To Reproduce

Go to ios App setting Turn off presise And Try to call GetLocation()

Tested on:

Flutter Doctor v

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.10.5, on macOS 11.3.1 20E241 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 13.2) [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] VS Code (version 1.67.1) [✓] VS Code (version 1.66.2) [✓] Connected device (2 available) ! Error: Anas iphone12 is not connected. Xcode will continue when Anas iphone12 is connected. (code -13) ! Error: iPhone is busy: Fetching debug symbols for iPhone. Xcode will continue when iPhone is finished. (code -10) [✓] HTTP Host Availability

Android 12 - after selecting approximate location I/Quality (18537): ActivityThread: activityResume delay 76 com.app.myapp 18537 I/Quality (18537): Skipped: false 5 cost 97.524185 refreshRate 0 processName com.app.myapp E/BLASTBufferQueue(18537): BLASTBufferItemConsumer::onDisconnect() E/BLASTBufferQueue(18537): BLASTBufferItemConsumer::onDisconnect() E/BLASTBufferQueue(18537): ViewRootImpl[MainActivity]#0 Applying pending transactions on dtor 1 V/OplusZoomWindowDecorViewHelper(18537): removeZoomView D/FlutterLocationService(18537): Unbinding from location service. D/FlutterLocationService(18537): Destroying service.

troy379 commented 2 years ago

Same for me. Any thoughts on how to resolve this?

troy379 commented 2 years ago

Tried adding _location.changeSettings(accuracy: LocationAccuracy.low); as well as _location.changeSettings(accuracy: LocationAccuracy.reduced);, but it didn't help :(

TouseefAQ commented 2 years ago

Tried adding _location.changeSettings(accuracy: LocationAccuracy.low); as well ass _location.changeSettings(accuracy: LocationAccuracy.reduced);, but it didn't help :(

Exactly

troy379 commented 2 years ago

Since I needed this functionality ASAP, and there's no feedback so far, I had to switch to the geolocator library. Maybe this will help you 🙂

TouseefAQ commented 2 years ago

Since I needed this functionality ASAP, and there's no feedback so far, I had to switch to the geolocator library. Maybe this will help you 🙂

Yeah but geolocator responds late on iOS, especially on 15.5. What I have done for now is to set location accuracy to accuracy.reduced and always check for permission granted. If permission is not fully granted don't let the user enter the app until or unless permission is fully granted.

TouseefAQ commented 1 year ago

Still no update ?

RottenSchnitzel commented 7 months ago

I am also encountering this issue and it is a dealbreaker for me, it's concerning that there is not even an update on this yet. There are three issues open regarding the problem (this, #736 and #764) and I think they originate in the same bug.

I hope this gets fixed soon as I prefer this package to geolocator. Are there still no updates or temporary fixes?