compass icon indicating copy to clipboard operation
compass copied to clipboard

Call to `.current()` on iOS can take up to several seconds to resolve

Open sigmadeltasoftware opened this issue 5 months ago • 0 comments

Hey everyone,

First off thanks for the effort invested into building and maintaining this library!

I'm currently using it in a KMM project and I've noticed that sometimes multiple seconds can pass before (mainly the first) result of the .current() request resolves:

// Example
private val geolocator = Geolocator.mobile()
...
suspend fun getLocationAndMoveCamera() {
  when (val result = geolocator.current()) { // Can take up to several seconds before result is resolved on iOS 
  ...
  }
}

While doing some research I've noticed that this seems to be an issue for some Flutter libraries too:

https://github.com/Baseflow/flutter-geolocator/issues/964 https://github.com/Baseflow/flutter-geolocator/issues/887#issuecomment-958123890

I've tried doing things like trying to "pre-initialise" the Geolocator (adding and fetching during the DI setup, calling .current() during onCreate(), etc...) but none of these things seemed to make a (big/noticeable) difference.

Is this an anomaly in my setup and/or are there any suggestions you could give me to deal with this?

sigmadeltasoftware avatar Sep 25 '24 20:09 sigmadeltasoftware