2

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"
       )
 }
Denny Kurniawan
  • 1,581
  • 2
  • 15
  • 28

1 Answers1

2

You have to add the properties of the GoogleMap:

GoogleMap(properties = MapProperties(isMyLocationEnabled = true))