Closed millerf closed 2 months ago
Plugin version: lastest
Please post the exact version. Consult your pubspec.yaml.
You’re having an issue with .getCurrentPosition but you’ve not posted the code you’re using or the context of when you’re calling it relative to .ready(config).
you must wait for .ready(config) to resolve before calling any method which requests location.
Plugin version
flutter_background_geolocation: ^4.15.5
you must wait for .ready(config) to resolve before calling any method which requests location.
Yes, there might be an issue here. I'll have a look later and otherwise post a more detailed code to replicate. Thanks!
It seems indeed the issue was ready()
was not finished to be called. Thanks for your help.
Closing this.
Your Environment
flutter doctor
):[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/millerf/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Users/millerf/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) • All Android licenses accepted.
Expected Behavior
Actual Behavior
Steps to Reproduce
1. 2. 3. 4.
Context
bg.BackgroundGeolocation.getCurrentPosition
when no location is available yet.I notice a discrepancy between iOS and Android, and wanted to bring it to your attention. It might be a misperception on my side. I default to
getCurrentPosition()
when I am starting my app and the plugin did not return a location yet. I notice the "issue" because I thought thetimeout
was in milliseconds and usedgetCurrentPosition(timeout: 3000)
. And I was not sure why my app seemed stalled. For some reason it seems the timeout is actually a "timer", and the function does not return a location before the timer runs out: I know removed the 3000 to a 1, and the app works as expected. Also, I did only notice this on Android, and not on iOS, so I was wondering if there might be an issue with the way the timeout is handled...Anyway, it might be nothing, but I wanted to bring it to your attention:
getCurrentPosition
doesn't seem to return anything before the timeout run out, even if a location is perfectly available...Thanks!