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).
spatial-id-assign-runnable Buck binary (or its Gradle equivalent). Its canonical shape:
{
"components": { "Foo": 1, ... },
"attributes": { "Foo.x": 2, ... }
}
object SpatialIdsBootstrap
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 |
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: ContextReturns 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: StringReturns Pair<Map<String, Int>, Map<String, Int>> |