Google Maps Platform

Supporting Kotlin Google Maps Platform Developers

Kotlin hero

Ever since Google announced support for Kotlin on Android, Android developers are increasingly adopting Kotlin as their programming language of choice. Developers love Kotlin for how expressive it is, how it enables defensible programming through nullability support, and how it interoperates with Java. In fact, the recent State of Kotlin on Android survey shows that 50 percent of developers are more likely to be satisfied with Kotlin, 60 percent of pro-Android developers use Kotlin, and 70 percent of the top 1,000 apps in Google Play contain Kotlin code.


In support of this changing landscape of Android developers, we’ve launched Kotlin extension (KTX) libraries, Kotlin snippets throughout Google Maps Platform documentation, and Kotlin sample code on GitHub.


KTX libraries

KTX libraries enable you to write concise code that is more natural and familiar to the Kotlin programming language. The set of KTX libraries wrap existing Google Maps Platform Android SDKs so that you can use several Kotlin-only features such as extension functions, lambdas, named parameters, and coroutines.


Currently, the KTX libraries we have available are the Places KTX library, which offers extensions for the Places SDK for Android. And the Maps KTX library, which offers extensions for the Maps SDK for Android and our Android Utility Library. These libraries are optional integrations that enable you to use the same libraries you know and love while taking advantage of Kotlin-specific features.


Kotlin code snippets in Google Maps Platform documentation

Quality and functional code snippets are key to providing a good developer experience with our SDKs. As such, we’ve finished adding Kotlin snippets, alongside Java, throughout the Maps and Places SDK for Android documentation. Now whenever a code snippet is presented, you should see both Java and Kotlin tabs so you can select the most relevant to your development needs.

Kotlin code library

Moving forward, you can expect new Google Maps Platform code samples in our docs to always contain both Kotlin and Java snippets.


Kotlin samples on GitHub

Last but not least, we also provide Kotlin sample applications that demonstrate common scenarios using Google Maps Platform SDKs. These samples are available on GitHub (Places, Maps), which you can clone directly to your machine. Since these are open source projects, feel free to open issues for anything you’d like to see.


To stay up-to-date with our latest language support, make sure to follow us on Twitter. We’re excited to see what you build with Kotlin.


For more information on Google Maps Platform, visit our website.