Location Info

The library for determining the real geographic location of device.

Permissions

Permissions=Location;Internet

Dependency libraries

  • Qt5Core
  • Qt5Positioning

Features:

  • Check is supported.
  • Listen change location.
  • Gets the available positioning methods.

Example

var states: MutableMap<ULong, LocationState> = mutableMapOf()

class AuroraLocationInfo {

    fun isSupported(): Boolean {
        return LocationInfo.isSupported()
    }

    fun listen(): ULong {
        return LocationInfo.listen { id, value ->
            states.put(id, value)
        }
    }

    fun getState(id: ULong): String {
        return states[id]?.let { """
                lat: ${it.latitude.toString().take(12)},
                lon: ${it.longitude.toString().take(12)},
                alt: ${it.altitude.toString().take(12)}
            """.trimIndent() } ?: "loading..."
    }
}