Skip to content

Instantly share code, notes, and snippets.

@jdsingh
Created November 20, 2018 19:43
Show Gist options
  • Save jdsingh/de52b82ad433ca5a159933f891e51dfd to your computer and use it in GitHub Desktop.
Save jdsingh/de52b82ad433ca5a159933f891e51dfd to your computer and use it in GitHub Desktop.
private fun getLocation(lastLocation: Task<Location>) {
lastLocation.addOnCompleteListener { task ->
if (task.isSuccessful) {
val data = workDataOf(
"latitude" to location.latitude,
"longitude" to location.longitude
)
future.set(Payload(Result.SUCCESS, data))
} else {
future.setException(task.exception)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment