Google Map Platform 101 — Part 2: Map Style

✒️1. Create Style of Map

Link: Styling Wizard: Google Maps APIs

Detail

Theme

More options — Style Editor

Finish → JSON

2. Use Map Style

MapsActivity.kt

/**
* Map style
*/
fun setMapStyle(map: GoogleMap) {
try {

} catch () {

}
}
val success = map.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this,
R.raw.map_style
)
)
if (!success) {
lge("MapStyle: Style parsing failed.")
}
} catch (e: Resources.NotFoundException) {
lge("MapStyle: Can't find style. Error: $e")
}
lifecycleScope.launchWhenCreated {
// Get map
val googleMap = mapFragment.awaitMap()

// Wait for map to finish loading
googleMap.awaitMapLoad()

// set location in San Francisco
setToSF(googleMap)
setMapStyle(googleMap)

...
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store