FusedLocationProviderClient wrapper using Kotlin Coroutines.
- Get oneshot coordinates of the current device.
- Get coordinates as Flow.
- FragmentScoped, ActivityScoped, ApplicationScoped? No problem.
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):
dependencies {
implementation 'com.github.edwnmrtnz:locationhelper:Tag'
}
// Try to obtain a viable location within 1 min with 500m radius.
val job = scope.launch {
val result = withTimeoutOrNull(60_000L) {
locationHelper.getViableCurrentLocation(500f)
}
}
Get continuous location updates with Coroutine Flows.