Maps and locations

AppKickstarter comes with a GoogleMap and MapKit implementation that you just have to use.

Observe location

With ObserveLocation you can start user location tracker and get a Flow of GpsPosition

fun invoke(): Flow<GpsPosition>
suspend fun startTracking()
fun stopTracking()

You just have to call this:

observeLocation.startTracking()
observeLocation().collect { latlng ->
    // your code
}

Display location on a Map

MapView creates a GoogleMap on Android and a MapKit on iOS :

val verticalScrollEnableState = remember { mutableStateOf(true) }
MapView(
    modifier = Modifier
        .padding(horizontal = 12.dp),
    gps = gpsPosition,
    title = "Author location",
    parentScrollEnableState = verticalScrollEnableState,
)

Last updated