Skip to content

Instantly share code, notes, and snippets.

@roscrazy
Created February 8, 2020 04:58
Show Gist options
  • Save roscrazy/0f3c1a43f2058f5490bebdd7a30e8f7a to your computer and use it in GitHub Desktop.
Save roscrazy/0f3c1a43f2058f5490bebdd7a30e8f7a to your computer and use it in GitHub Desktop.
RxLocationManager SetCancellable
emitter.setCancellable(getCancellable(listener))
...
private fun getCancellable(locationListener: LocationCallback): Cancellable {
return Cancellable {
log { "FusedLocationService Observable has canceled" }
fusedLocationProviderClient.removeLocationUpdates(locationListener)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment