The following code sample demonstrates how to add a basic marker to a 3D map by caling the addMarker method. To use this code sample, follow the instructions in Setup and Add a 3D map to your app to set up your Android Studio project with a basic 3D map. Then, add the following code to the MainActivity.kt file:
// Add importsimportcom.google.android.gms.maps3d.model.latLngAltitude...// Add to the onMap3DViewReady method, after the googleMap3D object has been initializedgoogleMap3D.setMapMode(Map3DMode.SATELLITE)googleMap3D.setCamera(camera{center=latLngAltitude{latitude=52.51974795longitude=13.40715553altitude=150.0}heading=252.7tilt=79.0range=1500.0})// Add a marker using absolute altitude positioninggoogleMap3D.addMarker(markerOptions{position=latLngAltitude{latitude=52.519605780912585longitude=13.406867190588198altitude=150.0}label="Absolute (150m)"altitudeMode=AltitudeMode.ABSOLUTEisExtruded=trueisDrawnWhenOccluded=truecollisionBehavior=CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL})
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-05 UTC."],[],[]]