Yusuf Ibragimov
07/04/2024, 12:33 PMAlexandru Gheorghe
07/04/2024, 2:39 PMYusuf Ibragimov
07/05/2024, 4:17 AMAlexandru Gheorghe
07/05/2024, 11:45 AMLatLng
. The only problem is when user moves location, there's no update to the location marker and thus if you click on go to location button (if implemented), the map will show the correct location but not with the location marker. Haven't spent time on solving this issue, though I think triggering recomposition of the map should do the job. Not sure if this would work for you. My app is not in production.Colton Idle
07/06/2024, 6:12 PMYusuf Ibragimov
07/08/2024, 7:11 AMYusuf Ibragimov
07/08/2024, 7:13 AMYusuf Ibragimov
07/08/2024, 7:15 AMAlexandru Gheorghe
07/08/2024, 7:18 AMYusuf Ibragimov
07/09/2024, 10:40 AMYusuf Ibragimov
07/09/2024, 10:41 AMLaunchedEffect(key1 = Unit) {
if (
ContextCompat.checkSelfPermission(
applicationContext,
Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
launcher.launch(Manifest.permission.ACCESS_FINE_LOCATION)
} else {
fusedLocationClient.lastLocation.addOnSuccessListener {
if (it != null) {
viewModel.onAction(UiAction.SetUserLocation(it.latitude, it.longitude))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
geocoder.getFromLocation(it.latitude, it.longitude, 1) { list ->
viewModel.onAction(
UiAction.SetUserLocationName(list.firstOrNull()?.locality ?: "")
)
}
} else {
val list = geocoder.getFromLocation(it.latitude, it.longitude, 1)
viewModel.onAction(
UiAction.SetUserLocationName(
list?.firstOrNull()?.locality ?: ""
)
)
}
} else {
viewModel.onAction(UiAction.NavigateBack)
}
}
}
}
I leave my code, it may be useful for someone🫡. Thanks everyone, happy coding!