README.md 999 Б
Newer Older
Зарубин Виталий Викторович's avatar
Зарубин Виталий Викторович включено в состав коммита
1
2
3
4
5
6
7
8
9
# Location Info

The library for determining the real geographic location of device.

### Features:

- Check is supported.
- Listen change location.
- Get listen location method.
Зарубин Виталий Викторович's avatar
Зарубин Виталий Викторович включено в состав коммита
10

Зарубин Виталий Викторович's avatar
Зарубин Виталий Викторович включено в состав коммита
11
12
13
14
15
16
17
18
19
20
21
22
### Permissions

```
Permissions=Location;Internet
```

### Dependency

- `BuildRequires: pkgconfig(Qt5Location)`
- `BuildRequires: pkgconfig(Qt5Positioning)`
- `QT += location positioning`

Зарубин Виталий Викторович's avatar
Зарубин Виталий Викторович включено в состав коммита
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
### Example

```kotlin
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..."
    }
}
```