Skip to content

Instantly share code, notes, and snippets.

@manuelvicnt
Created March 23, 2021 06:51
Show Gist options
  • Save manuelvicnt/2f1d6f3d8ef6398390331c4838c431d2 to your computer and use it in GitHub Desktop.
Save manuelvicnt/2f1d6f3d8ef6398390331c4838c431d2 to your computer and use it in GitHub Desktop.
class LocationFragment: Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// ...
viewLifecycleOwner.addRepeatingJob(Lifecycle.State.STARTED) {
locationProvider.locationFlow().collect {
// New location! Update the map
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment