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 / property | Type | Default | Effect |
|---|---|---|---|
Builder(accessToken) / accessToken | String | Required | Graffity-issued token; blank input is rejected. |
mode(mode) / mode | GraffityARMode | Navigation | Destination-first navigation or immediate ARContent localization. |
environment(env) / environment | GraffityAREnvironment | Production | Backend selection; external apps use production. Staging is for Graffity QA credentials. |
userId(id) / userId | String? | null | User-scoped content and collection player identity. |
initialLocation(location) / initialLocation | Location? | null | Seed before a live GPS fix; does not bypass authorization. |
logging(logging) / logging | GraffityARLogging | Default | Log sink and custom-sink threshold. |
telemetry(telemetry) / telemetry | GraffityARTelemetry | Disabled | Opt-in analytics. |
stringsProvider(provider) / stringsProvider | GraffityARStringsProvider? | null | Override native SDK strings; null results use bundled copy. |
minimap(enabled) / minimap | Boolean | false | Docked route map, honored only in Navigation. |
preferredTransitionTypeId(id) / preferredTransitionTypeId | String? | null | Preferred transition type across sections; falls back if it cannot cover every hop. |
deepLink(deepLink) / deepLink | GraffityARDeepLink? | null | Destination for the first picker presentation. |
theme(theme) / theme | GraffityARTheme | DEFAULT | Native 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.