Thread
#compose
    g

    Guy Bieber

    2 years ago
    Has anyone integrated google maps into a compose app? I am looking for example code if it exists.
    John O'Reilly

    John O'Reilly

    2 years ago
    Did you find any examples of this? I have app that uses
    SupportMapFragment
    right now and looking to get working with Compose....curious how data source that for example drives placement of markers would be managed.....and likewise where panning of map triggers data query/update
    @romainguy I just saw that you mentioned using
    AndroidView
    ....do you know of any examples of this used for a map like this?
    I have basic setup working using
    AndroidView
    with a layout file that includes
    com.google.android.gms.maps.SupportMapFragment
    fragment ....looking next at what options are for accessing map and tying in for example with map lifecycle callbacks
    ok, looks like I can do something like
    AndroidView(resId = R.layout.fragment_nearby, modifier = Modifier.weight(0.4f)) {
        val mapFragment = fragmentManager.findFragmentById(R.id.map) as SupportMapFragment
    
        mapFragment.getMapAsync {map ->
            map.isMyLocationEnabled = true
        }
    }