Simple Kotlin tutorial to integrate google map with our android application.

First of all we are going to Install android studio on system As we know Android studio provides programming in Java & Kotlin language.So now we are move on to further step for creating app which displaying current location on google map using kotlin language.

Create a new  android project  and select Google maps activity.

new project app

After that you need to add a project name &  select the language which you preferred.Right now we are going to use the Kotlin language to do further development.

app name & details

Before we are going to show a map with a specific location with a marker, for that purpose we required a Google Maps API key. We can create an API key follow this link

Also, there is an alternative way

Once you get an API key, copy that key & paste it under the google_maps_api.xml file under the string in this file. eg: Api key starts with “AIza”

google api key

Now we will add Latitude & longitude to display specific locations on the map. You can add your location by adding latitude & longitude under the `MapsActivity.kt` file under the onMapReady function.OnMapReady function which is automatically called when the map is activated on your device or an emulator like the below example.

// Add a marker in Sawantwadi and move the camera

val Sawantwadi = LatLng(15.9053, 73.8213)



If you want to change the color of the marker on the map,then just add following code after addmarker method :


Also if you want to change the marker icon on a map you need the first download the specific image format file like jpg etc & add that file under res/drawable folder. After that add the following line of code.


Eg: mMap.addMarker(MarkerOptions().position(Sawantwadi).title("Sawantwadi,Maharashtra").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker))


If you want to zoom the map with the following specific levels

1: World, 5: Landmass/continent, 10: City, 15: Streets and 20: Buildings

Just need to add the following line & replace the level as you want like 15f,10f, etc. so the zoom effect will be displayed on specific streets, buildings levels only.  If you notice that what we did just replaced the function newLatLng with newLatLngZoom to get that effect.


You need to check first `google play services` are installed on your device or not. If not then you need to add Google Play services to Android Studio from SDK manager tools.

Enable google play service

Once all procedures are done run the app you will get a required map with a location on your device or else you can test that app on AVD manager which creates virtual devices.

map location