-
-
Notifications
You must be signed in to change notification settings - Fork 692
geolocator_apple > 2.2.2 does not work in background ? #1270
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
+1 |
Does it stop collecting the location data immediately or after some time, and can you inform me about how long it takes before you run into this issue? It would be helpful if you could provide the output of 'flutter doctor -v' and clear, step-by-step instructions to reproduce the issue in the comment section. This will assist us in better understanding and addressing the problem. |
Hi Tim, I give you a quick feedback with the information I can have right now. To reproduceBuild an application that continuously retrieve location every 30s for instance.
Here is my pseudo-code (I'll try and give you a real test program to investigate):
When I put my application in background (i.e I switch to another application, or I switch off my smartphone screen to sleep), after 30s, my application is sending the error message as given previously. As soon as I add the 2 following lines, it works fine.
flutter doctor outputs:[✓] Flutter (Channel stable, 3.7.10, on macOS 12.3.1 21E258 darwin-arm64, locale en-FR) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 13.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.60.2) [✓] Connected device (2 available) [✓] HTTP Host Availability • No issues found! |
Thank you for providing the additional details, we will start looking into this. If you do manage to create a real testing application that would still help out a lot. |
Can you please confirm the following: Do you have allowBackgroundLocationUpdates set to true in your locationSettings? e.g. like below (see example app):
And:
Waiting for your reply, Tim |
Hi @TimHoogstrate , Great news, this option totally fixes my issue. I am so sorry not being able to see it earlier. Christophe. |
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale en-KH) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 15.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.1) [✓] VS Code (version 1.76.0) This is my flutter doctor -v . I got the same issue with ios how can fix I already do it step by step but Geolocation still return the permission is denied . |
Hi Chantha, This issue was raised quite a long time ago.
|
Yes Thanks brother. I already apply this but it doesn't work . I still got error : |
Just to be sure, now I've migrated to the following content in pubspec.yaml:
At the time I fixed workaround the issue, I had:
And obviously, I have the following in my Info.plist:
|
💬 Questions and Help
Hello,
I have a flutter application using geolocator 9.0.2 on iOS.
My application is designed to run continuously for a long time in order to report user position, although the application is in background (smartphone in sleep mode or application not on the front).
Using geolocator_apple 2.2.2,everything is OK, but using 2.2.5 or 2.2.6, I get an error message :
And my application is no longer collecting the location.
I've checked all permissions are active (Location: While Using the App, and Background : location capability is set).
Any idea why I keep having this issue ?
Thank you for your help
Regards,
Christophe.
The text was updated successfully, but these errors were encountered: