AR SDK Overview

The Treedis AR SDK localizes a device in a scanned space, anchors content there, and follows navigation routes supplied by the host application.

Choose an integration

Integration Engine and packaging Host interface
iOS (Swift) Compiled ARKit/RealityKit XCFramework, TreedisVPS VPSController and VPSSession
Android (Kotlin) Compiled ARCore/SceneView AAR with Maven metadata VPSController and VPSSession
WebXR Compiled ES-module package, @treedis/vps-webxr, for WebXR in Chrome on ARCore Android; online localization only VPSController and VPSSession, with an optional three.js view

Treedis supplies an SDK archive for each platform: TreedisVPS-iOS-<version>.zip, TreedisVPS-Android-<version>.zip and TreedisVPS-WebXR-<version>.zip, each with a SHA-256 checksum. The native archives contain compiled libraries, inference models, installation instructions, an example host and third-party licenses. The WebXR archive holds the compiled npm package. Request the archives and checksums from Treedis. Integrating the SDK requires no access to our source code. No platform embeds Unity.

Responsibilities

The SDKs own camera localization, online engines (and offline engines on iOS and Android), anchor updates, occlusion, AR objects, thread placement, route drawing and progress, floor changes, and AR events. The SDKs ship no UI and no WebView bridge: build the UI natively, or in the page with WebXR. The host owns UI, tour/account API requests, authentication, route requests, QR/App Clip invocation, push registration, and persistence. Supply those through values and adapters instead of depending on a particular Treedis deployment.

The WebXR guide covers the browser package, its three.js view, and the API key and proxy setup. The Kotlin guide covers the compiled Android package, adapters and lifecycle. The iOS guide covers binary installation, the complete command/event reference, offline rules, a generic host example, and App Clip setup. All three distributions can power navigation, Connected Workers, or your own host application.

Online localization and API keys

Every platform localizes against the Treedis VPS server by default. The device sends camera frames; the server returns the camera pose in the tour. Two agreeing fixes place the content, and background checks keep it aligned while the user walks. iOS and Android can also localize on the device with an explicitly downloaded offline pack. WebXR is online only.

VPSConfiguration takes the VPS server URL and an API key. The SDK sends the key only to that server, never in a URL, event or log, and never to media or upload URLs. A workspace VPS key (tvk_...) opens only the spaces of its Treedis workspace, for reading and localizing. An Enterprise workspace admin creates it in Treedis under Workspace info > VPS key. When the key is regenerated or revoked, requests fail with an HTTP 401 or 403 error: fetch the current key, or fall back to another key you hold, and update the session's configuration. Keep keys in your host's configuration, not in source code, URLs or content payloads. In a public web page, use a server-side proxy that adds the key (see the WebXR guide).

Commands and events

The command envelope is {type, data}. data is an object and contains the optional query requestId. Every command has a typed method; JSON (receive(json)) is an optional transport, for example when your app relays commands from its own WebView.

  • Native iOS/Android: call VPSController methods or send; observe its delegate/listener, onEvent, or the session event streams.
  • WebXR: call VPSController methods or send; observe onEvent, addEventListener or the session event streams.
  • onMessage receives a structured {type,data} object on every platform. No callback needs JSON parsing.

For the controller, configure host adapters, set environment if required, load the tour, then start localization. Commands wait for engine readiness. Loading and successful localization have their own events; onReady means the engine accepts commands. setWindowSize scales intercepted taps only and is not required for localization.

Purpose Commands
Setup setEnvironment, setTourInfo
Localization startLocalization, relocalize, reset, setLocalizationHint, clearLocalizationHint
Objects and view showARObject, hideARObject, setMeshVisible, click, setWindowSize
Navigation startNavigation, stopNavigation, setPath, recomputePath, confirmTeleport, endTeleport
Live position setPositionStreaming
Queries getPosition, raycastTag, captureCameraFrame
Threads startThreadCreation, cancelThreadCreation, confirmThreadPlacement, setThreadPlacementMode, spawnThread, updateThread, removeThread, setThreadCompleted

Live position

Localization starts a live position stream: onLivePosition(sample) fires at most five times per second, independently of navigation. A sample is {localized: true, position: {x, y, z}, heading} in the tour frame; heading is degrees from -Z toward +X. Frames older than one second, interrupted tracking and untrusted localization produce {localized: false} without coordinates. Pause and resume delivery with setPositionStreaming (enabled: false / true). Set the localization setting liveLocation to false to suppress coordinates entirely; samples are then {localized: false, sharingEnabled: false}. Reset, stop, and environment or tour changes turn streaming off until localization starts again. The host owns identity, authentication, background handling and any socket transport.

Object localization

From SDK 0.9.0 a session can also localize against one physical object instead of a space: VPSTarget.model(id) uses an object map built from the object's textured 3D model, and content is placed in the model's frame. The model outline, tag cards and a mode for objects that move are described in Object Localization.

Coordinates and content

All public positions use the Treedis tag/Showcase frame: Y up, metres. Navigation destinations, route nodes, content, pose events and localization hints share this frame on every platform. Hosts convert external QR/marker formats before calling the SDK. Object identifiers are strings; integer JSON IDs are normalized to strings.

Object types are TAG, THREAD, VS_IMAGE, VS_VIDEO, VS_OBJECT, VS_HTML, and POLYGON. The native engines render HTML with JavaScript disabled, and WebXR shows it as a static text card; interactive pages belong in host UI. A video plays by itself only when the host turns autoplay on. Use GLB/glTF for shared 3D assets; iOS also supports Apple model formats. See each platform guide for asset formats and host requirements.

All platforms use the same field-tested navigation and recovery policy. Keep its defaults unless your application needs an intentional override. See Navigation Settings for all thresholds, timing, validation and platform examples. Tour localization arSettings remain dynamic and separate.