Skip to Content
Android OptionsSession Configuration

Session configuration

Build an immutable GraffityARCloudConfiguration, then pass it to GraffityARCloudSDK(context, configuration). Android SDK 5.0.2 requires API 28+.

Builder

import android.content.Context import android.location.Location import tech.graffity.android.arcloud.publicapi.* fun makeNavigationSession(context: Context, accessToken: String): GraffityARCloudSDK { val seed = Location("host").apply { latitude = 13.7563 longitude = 100.5018 } val configuration = GraffityARCloudConfiguration.Builder(accessToken) .mode(GraffityARMode.Navigation) .environment(GraffityAREnvironment.Production) .userId("YOUR_USER_ID") .initialLocation(seed) .logging(GraffityARLogging.Default) .telemetry(GraffityARTelemetry.Disabled) .stringsProvider(null) .minimap(true) .preferredTransitionTypeId(null) .deepLink(null) .theme(GraffityARTheme.DEFAULT) .build() return GraffityARCloudSDK(context, configuration) }

Use a known location for your user or omit the seed. Use a stable player ID or omit it when user-scoped content and collection are not needed.

Every setter returns the builder. build() produces the configuration; its direct constructor is internal.

Builder argument / propertyTypeDefaultEffect
Builder(accessToken) / accessTokenStringRequiredGraffity-issued token; blank input is rejected.
mode(mode) / modeGraffityARModeNavigationDestination-first navigation or immediate ARContent localization.
environment(env) / environmentGraffityAREnvironmentProductionBackend selection; external apps use production. Staging is for Graffity QA credentials.
userId(id) / userIdString?nullUser-scoped content and collection player identity.
initialLocation(location) / initialLocationLocation?nullSeed before a live GPS fix; does not bypass authorization.
logging(logging) / loggingGraffityARLoggingDefaultLog sink and custom-sink threshold.
telemetry(telemetry) / telemetryGraffityARTelemetryDisabledOpt-in analytics.
stringsProvider(provider) / stringsProviderGraffityARStringsProvider?nullOverride native SDK strings; null results use bundled copy.
minimap(enabled) / minimapBooleanfalseDocked route map, honored only in Navigation.
preferredTransitionTypeId(id) / preferredTransitionTypeIdString?nullPreferred transition type across sections; falls back if it cannot cover every hop.
deepLink(deepLink) / deepLinkGraffityARDeepLink?nullDestination for the first picker presentation.
theme(theme) / themeGraffityARThemeDEFAULTNative UI palette.

Token validation

Both the builder and SDK constructor reject accessToken.isBlank() with InvalidAccessToken. There is no length threshold or JWT validation in this check. Pass the issued raw token; backend authorization can still fail later.

Catch construction errors before attaching a view and observe runtime errors through the listener or state. To use a refreshed token, shut down the session and construct a new configuration and SDK.

Configuration changes

Configuration properties are read-only. Change mode, user, token, seed, theme, strings provider, map, or route preferences by creating a new session. Runtime controls include setLogger(logger) and setTelemetryEnabled(enabled); see customization for current logging behavior.

See navigation, collection, and lifecycle.