There isn't an official Android documentation for ...
# compose
p
There isn't an official Android documentation for work with google maps in jetpack compose? I only found this. But they doens't explain how to enable the embedded "my location button" of maps for locate the user, nor how to correctly show the user location using jetpack compose (samples with how to get, update and store user location after pressing than button and where to store it, in the viewmodel or where).
p
Yea, you need to ask for location permission first (see some generic docs for that), then enable the button for the map
Copy code
GoogleMap(
    properties = MapProperties(
        isMyLocationEnabled = hasLocationPermission,
    ),
    // ...
)
You don't really need more for this basic functionality.
p
does maps require to pass the current location using a fusedlocationclient? or with the permission and that button maps is smart enough to center the screen on user location?
c
Refer to the original Android Google maps documentation. The Composable is just a wrapper over the androids view.
👍 1
p
I found that the button works by itself (without fusedlocationclient) if you are fine that the user needs to click it manually. If you want to center map to user's location automatically, you need to mess with fusedlocationclient and pass location to map manually.