API reference

SpatialIdsBootstrap Object

Loads the build-time component/attribute ID map from the APK asset and installs it into SpatialIdRegistry. Called automatically from VrActivity.onCreate (the first lifecycle hook after the Activity's base context is attached), but exposed for advanced setups that need to install the maps earlier in the process lifecycle (e.g. from a custom Application subclass).
The asset is produced at APK post-process time by the spatial-id-assign-runnable Buck binary (or its Gradle equivalent). Its canonical shape:
{
  "components": { "Foo": 1, ... },
  "attributes": { "Foo.x": 2, ... }
}

If the asset is absent (or the supplied Context isn't yet ready to serve assets), the install silently no-ops — any later component lookup that reaches into SpatialIdRegistry will throw with a clear "install was not called" message until a follow-up commit adds a runtime fallback.

Signature

object SpatialIdsBootstrap

Properties

ASSET_PATH : String
[Get]
Path inside the APK's assets/ directory where the build-time ID map is written.
Signature
const val ASSET_PATH: String

Methods

installIfPresent ( context )
Reads assets/spatial_ids.json from SpatialIdsBootstrap.installIfPresent's APK and calls SpatialIdRegistry.install. Safe to call multiple times; the registry's install is idempotent and replaces previous maps.
If the asset is missing this method silently returns — see class KDoc for rationale.
Signature
fun installIfPresent(context: Context): Boolean
Parameters
context: Context
Returns
Boolean true if an asset was found and the registry was installed; false if no asset.
parse ( json )
Parses the canonical spatial_ids.json shape into two name → ID maps. Pure function — no Android dependency — so it can be unit-tested without Robolectric.
Test-only: callers must opt in via SpatialSDKInternalTestingAPI.
Signature
fun parse(json: String): Pair<Map<String, Int>, Map<String, Int>>
Parameters
json: String
Returns
Pair<Map<String, Int>, Map<String, Int>>