Last active
June 12, 2024 19:39
-
-
Save ngengesenior/4e87aeec45dca9cb2bb6e2c922077dc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun locationManager(manager: CLLocationManager, didUpdateLocations: List<*>) { | |
val location = didUpdateLocations.firstOrNull() as? CLLocation? | |
locationResultContinuation?.let { | |
if (it.isActive) { | |
if (location != null) { | |
it.resume(Result.success(location)) | |
} else { | |
it.resumeWithException(Exception("No valid location found")) | |
} | |
locationResultContinuation = null | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment