How to use Place Autocomplete API using Ktor and Jetpack Compose

Daniel Atitienei
5 min readJan 8, 2023

What are we going to build?

What is Ktor?

Ktor is a framework to easily build connected applications — web applications, HTTP services, mobile and browser applications. Modern connected applications need to be asynchronous to provide the best experience to users, and Kotlin coroutines provide awesome facilities to do it in an easy and straightforward way.

Setup

Add these dependencies to your .app/build.gradle

dependencies {
// Lifecycle
def lifecycle_version = "2.6.0-alpha03"
implementation ("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
implementation ("androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version")

// Logger
implementation("io.github.aakira:napier:2.6.1")

// Ktor
def ktor_version = "2.2.1"
implementation("io.ktor:ktor-client-okhttp:$ktor_version")
implementation("io.ktor:ktor-client-core:$ktor_version")…

--

--