GraffityARCloudSDK
public class GraffityARCloudSDK(context: Context, configuration: GraffityARCloudConfiguration)
The SDK session entry point, available on API 28+. Retain one instance per logical experience and use one active hosted surface.
Initialization and identity
| Member | Type / result | Contract |
|---|---|---|
| Constructor | Session | Rejects a blank token with InvalidAccessToken. Uses immutable configuration. |
VERSION | String | Embedded SDK identity metadata; select the dependency release by its Maven version. |
BUILD_NUMBER | Int | Embedded build identifier. |
listener | GraffityARCloudListener? | Weak event receiver; retain it in your host. Null detaches callbacks. |
See configuration and listener events.
Surface factories
| Method | Return type | Contract |
|---|---|---|
createView(context: Context) | View | Standard Android view for an XML parent or Compose AndroidView. |
createFragment() | Fragment | Host through FragmentManager, with SDK binding stored in arguments. |
Use the factories for correct binding and lifecycle behavior. GraffityARCloudHost supplies a fallback SDK for restored surfaces. See presentation examples.
State
| Member | Type | Contract |
|---|---|---|
state | GraffityARState | Current snapshot; read-only and safe to read from any thread. |
stateFlow | StateFlow<GraffityARState> | Shared current value and subsequent updates. |
stateStream() | Flow<GraffityARState> | The same backing StateFlow exposed as Flow. |
StateFlow does not complete on shutdown. Use lifecycle-aware observation.
Controls
| Method | Contract |
|---|---|
suspend fun startNavigation(toPoiId: String) | Navigates to a loaded active-section POI. Blank/unknown IDs, missing localization, or an unavailable route graph throw NavigationGraphUnavailable. |
fun stopNavigation() | Clears navigation/journey state and returns to the destination picker in navigation mode. |
suspend fun reset() | Resets localization and the current leg while retaining the selected destination. |
suspend fun shutdown() | Idempotent, terminal session cleanup. Remove the surface and create a fresh session afterward. |
fun setLogger(logger: GraffityARLogger?) | Updates the container sink, preserving configured severity. Null selects the default/no-op sink according to that severity. |
fun setTelemetryEnabled(enabled: Boolean) | Enables/disables analytics at runtime. Initially disabled. |
Use coroutines for suspending operations and preserve cancellation when catching errors. See navigation, teardown, and logging behavior and limits.