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
  • Dependencies
  • Geocoding Setup
  • Geolocation setup

Was this helpful?

Edit on GitHub
  1. Setup

Android / iOS

Dependencies

If you only need to support mobile (Android and iOS) add the following dependencies:

# gradle/libs.versions.toml

[libraries]
compass-geocoder = { module = "dev.jordond.compass:geocoder", version.ref = "compass" }
compass-geocoder-mobile = { module = "dev.jordond.compass:geocoder-mobile", version.ref = "compass" }
compass-geolocation = { module = "dev.jordond.compass:geolocation", version.ref = "compass" }
compass-geolocation-mobile = { module = "dev.jordond.compass:geolocation-mobile", version.ref = "compass" }

Then you can add them to your build.gradle.kts:

kotlin {
    sourceSets {
        commonMain {
            dependencies {
                // Geocoding
                implementation(libs.compass.geocoder)
                implementation(libs.compass.geocoder.mobile)
                
                // Geolocation
                implementation(libs.compass.geolocation)
                implementation(libs.compass.geolocation.mobile)
            }
        }  
    }
}

Geocoding Setup

Geolocation setup

Location permissions are required for using geolocation on Android and iOS. Compass can handle the permission requesting automatically for you.

Android

On Android you don't need to declare any location permission in your manifest since Compass includes those in the geolocation-mobile artifact.

iOS

On iOS you are required to edit your info.plist and add the following entry:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Add a description for why you need this permission</string>

If you don't add this key to your info.plist, you will encounter a runtime exception when requesting permissions.

PreviousAll DependenciesNextMixed platforms

Last updated 26 days ago

Was this helpful?

No location permissions are needed for geocoding operations. Compass will use the built-in Android or iOS services. These services can be rate-limited, so make sure you aren't calling them too frequently. Check out the as well as the for more information.

Make sure you change the description for the permission. You are required to explain to your users why you need their location. Check out the .

🤖
Android documentation
iOS documentation
Documentation