Compass 🧭
GithubReferenceMaven
  • 🧭Compass
  • 🖥️Artifacts
  • 🚗Roadmap
  • Setup
    • 📇All Dependencies
    • 🤖Android / iOS
    • 📱Mixed platforms
  • Geocoding
    • 🌎Geocoding Overview
    • 📈Web API Service
      • Google Maps
      • Mapbox
    • ❓Request a Geocoder API
  • Geolocation
    • 📍Geolocation Overview
    • 🔍Geolocator
    • 🌐Location
    • 📱Android / iOS
    • 🖥️Browser
  • Autocomplete
    • 🔍Autocomplete Overview
    • 🌎Via Geocoding
      • 📱Android / iOS
      • 📈Web API Service
  • Misc
    • 📲Demo
    • 💾Contributing
    • 🔧Compass Reference
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Autocomplete
  2. Via Geocoding

Web API Service

Compass supports Autocomplete on all platforms using the Geocoding services provided by Mapbox and Google Maps.

Getting started

To get started you first need to create an autocomplete instance:

val autocomplete = Autocomplete.googleMapsGeocoder(apiKey = "your-api-key")

Then you can use the autocomplete instance:

val results = mutableListOf<String>()

suspend fun search(query: String) {
    val result = autocomplete.getOrNull() ?: return
    if (result.isNotEmpty()) {
        results.clear()
        results.addAll(result)
    }
}
PreviousAndroid / iOSNextDemo

Last updated 1 year ago

Was this helpful?

🌎
📈