DefaultLocationProviderFactory
Factory for creating instances of implementation of LocationProvider which utilizes the Android system location services to obtain locations through LocationManager.
If a custom CoroutineDispatcher is provided, it manages the callbacks of location listeners; otherwise, they are handled in the current call-frame.
Functions
Link copied to clipboard
fun create(context: Context, config: LocationProviderConfig = LocationProviderConfig()): LocationProvider
Creates a new instance of LocationProvider that relies on the default Android mechanism to obtain location ( via LocationManager ).
fun create(context: Context, dispatcher: CoroutineDispatcher, config: LocationProviderConfig = LocationProviderConfig()): LocationProvider
Constructs the LocationProvider with a custom CoroutineDispatcher to handle location listener callbacks on a dedicated thread. This recommended approach for instantiation helps prevent cases where the handling of location updates blocks the main thread.