Open yangwuan55 opened 5 months ago
@yangwuan55 did you find any compose sample? I needed some too. But I've managed to figure out how to make it work on compose
@yangwuan55 did you find any compose sample? I needed some too. But I've managed to figure out how to make it work on compose
You can do like this:
val facotry = rememberLocationTrackerFactory(LocationTrackerAccuracy.Best)
val locationTracker = facotry.createLocationTracker(getPermissionController())
BindLocationTrackerEffect(locationTracker)
val viewModel = getScreenModel<SomeViewModel>()
LaunchedEffect(locationTracker) {
viewModel.init(locationTracker)
}
In viewmodel:
suspend fun init(locationTracker: LocationTracker) {
this.locationTracker = locationTracker
locationTracker.startTracking()
}
fun onCleared() {
locationTracker.stopTracking()
}
val locationTracker = facotry.createLocationTracker(getPermissionController())
could be
val locationTracker = remember { facotry.createLocationTracker(getPermissionController()) }
to avoid recomps
@yangwuan55 what does this method contains? getPermissionController() How it will be collected from Android and iOS?
@yangwuan55 what does this method contains? getPermissionController() How it will be collected from Android and iOS?
Thanks.