Skip to Content
API ReferenceAndroid SDKGraffityARCloudSDK

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

MemberType / resultContract
ConstructorSessionRejects a blank token with InvalidAccessToken. Uses immutable configuration.
VERSIONStringEmbedded SDK identity metadata; select the dependency release by its Maven version.
BUILD_NUMBERIntEmbedded build identifier.
listenerGraffityARCloudListener?Weak event receiver; retain it in your host. Null detaches callbacks.

See configuration and listener events.

Surface factories

MethodReturn typeContract
createView(context: Context)ViewStandard Android view for an XML parent or Compose AndroidView.
createFragment()FragmentHost 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

MemberTypeContract
stateGraffityARStateCurrent snapshot; read-only and safe to read from any thread.
stateFlowStateFlow<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

MethodContract
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.