As both Google Home and Google Assistant devices become more ubiquitous in our lives, making new Actions for the Assistant becomes an almost necessary step for developers. To make it easier for Android developers (among others) to make the leap, today, Google has released a Java & Kotlin library for Actions on Google.
Since the launch of Actions on Google, it’s been possible to write new actions using almost any language you wish (including Java or Kotlin), if you were willing to handle low-level tasks like reading JSON from an HTTP request in a cloud-friendly manner. To jumpstart developers at the time, Google provided a handy Node.js library so they could focus more on their own logic, not boilerplate for supporting the cloud and JSON data.
Today, Google is offering Java, Kotlin, and Android developers the same helping hand with an Actions on Google library for Java & Kotlin. First and foremost, the library provides a boilerplate template to make your Assistant Action cloud-ready for both Google Cloud Platform and Amazon Web Services Lambda.
Secondly, the library will handle processing the JSON data into proper Java classes to easily use in your code, and to send your final response in the proper JSON format when you’re done. With all of that out of the way, there’s little else standing between a Java or Kotlin developer and their vision for a Google Assistant Action.
Google is also using this as an opportunity to further their relationship with Kotlin, noting in the blog post that the entire library was written in Kotlin. Two years ago, Kotlin became a first-class language for Android, and Google has since continued to foster the language, including co-founding the Kotlin Foundation.