CoreSession

The root object of every Wemap SDK session — create one before anything else.

A CoreSession loads a map's data and holds the shared state and services that all Wemap SDKs build on: routing, points of interest, and positioning. Every higher-level component — WemapMapView, GeoARView, and the positioning location sources — is created from a session and reads its state through it. A session is therefore required to use any Wemap SDK.

Create a single session and pass it to each component you use. Sharing one session is what keeps navigation, points-of-interest selection, and the user's location consistent across every view and SDK — creating separate sessions would give each its own isolated state.

The session is created asynchronously because it fetches the map's data up front — use the suspending create factory. Its services are then built lazily on first use — typically when the first view attaches — so a session created only to inspect a map (for example to read mapCenter or isVpsEnabled) stays lightweight and allocates nothing further.

A session owns its shared services for its whole lifetime, so it can be reused across successive screens and shared by simultaneously-live components (for example a WemapMapView and a GeoARView together): the services survive when one view's cohort is torn down and are handed to the next. Call deinit when the session is no longer needed — typically from the lifecycle owner that holds it (e.g. ViewModel.onCleared) — to release those services (cancel coroutines, unregister sensors, clear cached data). All access is expected to happen on the main thread.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The configuration the session was created with, fixed for its lifetime.

Link copied to clipboard

true when the map supports VPS-based indoor positioning.

Link copied to clipboard

Computes and caches itineraries (routes) across this session's map.

Link copied to clipboard
val mapCenter: Point

The geographic center of the map, as configured on the Wemap dashboard.

Link copied to clipboard
val mapId: Int

The identifier of the map this session was created for.

Link copied to clipboard

Produces live navigation information — distance, duration, remaining steps — while navigating.

Link copied to clipboard

Fetches the points of interest defined for this session's map.

Functions

Link copied to clipboard
fun deinit()

Tears down the session and every service it materialized.