VpsLocalLocationSource
Offline visual positioning location source.
Works like VpsARCoreLocationSource, but fully offline (no VPS network service) and without ARCore: camera frames are captured via CameraX and matched against a pre-built map database on the device.
The map database files (descriptors.bq, reloc-simplified.db, georef.db) are large and must be downloaded by the SDK user in advance and passed via mapDatabaseDirectory.
Position updates are discrete: a fix is produced only on a successful scan, with pedestrian dead reckoning carrying the position between scans — there is no continuous visual tracking (unlike ARCore SLAM).
Runtime permissions. CAMERA is required; without it the source cannot scan at all. ACTIVITY_RECOGNITION is strongly recommended: from API 29 the platform gates Sensor.TYPE_STEP_DETECTOR behind it, and without it dead reckoning is disabled — the position holds at the last fix between scans, and the movement-aware scan cadence degrades to VpsLocalConfig.maxScanInterval, since no walked distance is ever detected. Both permissions are declared by this module's manifest, but the app must request them at runtime.
Parameters
application context.
the session this source belongs to. Share the same session with the WemapMapView / GeoARView and any other location source on the screen — that shared instance is what keeps the user's location, navigation and POI selection consistent. The source reads the session's LocationProcessor and does not own it: deinit() here tears down this source's own resources, never the session's services (call session.deinit() from whoever owns the session).
directory containing the downloaded map database files.
tunable settings, fixed for this source's lifetime. Defaults to VpsLocalConfig().
optional CameraX preview surface. When supplied, the source binds a live camera preview alongside its capture use case so the app can show the feed while scanning; the source owns the camera, so apps must NOT bind their own camera session. Pass null for headless (no preview).
The preview stream is bound at a small resolution deliberately, which keeps its cost to roughly 16 ms per scan (measured on a Galaxy S21: 365 ms of capture time without a preview, 381 ms with one). Left at CameraX's default preview resolution the same binding cost ~625 ms per scan, so do not remove that cap — see CameraCapture.
optional configuration that keeps scanning alive while the app is backgrounded or the screen is off, via a camera-type foreground service (VpsLocalForegroundService). When null (the default), scanning only runs while the app is in the foreground. When supplied, the consuming app MUST declare the service and its permissions in its own manifest — see VpsLocalForegroundService.
Constructors
Types
Properties
Current device inclination in degrees (90° = upright), or null before the first attitude.
Emits the outcome of every scan attempt that did not yield a usable fix — no candidates, a rejected outlier, a frame-quality skip, a stalled camera, and so on.
The current scan-loop status.
Emits the scan-loop status whenever it changes.
Emits a VpsLocalLocalizationUpdate each time a scan produces a fix that passes the outlier filter and is submitted downstream.