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. Geolocation

Location

PreviousGeolocatorNextAndroid / iOS

Last updated 1 year ago

Was this helpful?

The result from Geolocation operations will return a Location object, which looks like this:

class Location(
    public val coordinates: Coordinates,
    public val accuracy: Double,
    public val azimuth: Azimuth?,
    public val speed: Speed?,
    public val altitude: Altitude?,
    public val timestampMillis: Long,
)

You can read the .

Detailed location data

Depending on the Priority you use to request the location, determines what kind of data is present.

All location results will return the coordinates and the accuracy of those coordinates in meters. In order to get the other values you will need to use a more accurate Priority, like so:

val location: Location = geolocator.current(Priority.HighAccuracy)

There is still a chance those values will be null, since it is up to the device to determine what data is returned.

On Android the Priority.HighAccuracy requires the ACCESS_FINE_LOCATION permission. This will be requested automatically by Compass.

🌐
KDocs here