Josef M
Josef M

Reputation: 406

Current location of user with FAB on google maps in compose

I am trying to create the blue geolocation icon that appears on google maps and that can center the user when clicked on. I have created the permission to ask the user for location already to use google maps, but how can I get their current location ? Is there a way to do it with google maps in compose or is it not yet implemented as a feature?

enter image description here

Upvotes: 1

Views: 2708

Answers (1)

heet kanabar
heet kanabar

Reputation: 300

Use this and I think after that you are good to go!

 val cameraPositionState= rememberCameraPositionState()

GoogleMap(
    modifier = Modifier.fillMaxSize(),
    cameraPositionState=cameraPositionState,
    properties = MapProperties(isMyLocationEnabled = true)
)

Upvotes: 7

Related Questions