I have followed a simple tutorial on how to displaying google maps with jetpack compose in the documentation.
But the MyLocationButton still does not showing up.
val singapore = LatLng(1.35, 103.87)
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(singapore, 17f)
}
var uiSettings by remember { mutableStateOf(
MapUiSettings(
myLocationButtonEnabled = true,
zoomControlsEnabled = false
)
) }
GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
uiSettings = uiSettings,
onMyLocationButtonClick = {
true
}
) {
Marker(
state = MarkerState(position = singapore),
title = "Singapore",
snippet = "Marker in Singapore"
)
}
You have to add the properties of the GoogleMap:
GoogleMap(properties = MapProperties(isMyLocationEnabled = true))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With