Skip to Content
API ReferenceAndroid SDKErrors

GraffityARCloudError

A public sealed class extending Exception. Object cases are singletons; cases with parameters are data classes.

Error cases

CaseMeaning and host response
InvalidAccessTokenBlank token or rejected credentials. Obtain a valid token and construct a fresh session.
LocationNotAuthorizedPrecise foreground location permission missing. Request it before starting the surface.
CameraNotAuthorizedCamera permission missing. Request it before starting AR.
UnsupportedDeviceARCore requirements unmet. Check device support and service installation.
ContentFetchFailed(reason: String, underlying: Throwable?)Content/backend failure; inspect reason and underlying cause.
VpsUnavailableVPS unavailable for this attempt. Check connection and mapped-venue coverage.
VpsAllAttemptsFailedLocalization attempts exhausted. Follow camera guidance and retry in a mapped area.
LocalizationUnavailableShort-lived localization credential unavailable/refused; does not itself prove the configured token is invalid.
NavigationGraphUnavailableLocalization, loaded POI, or route graph unavailable. Wait for section data or correct authored data.
NavigationRouteUnavailable(destination: String, fromSection: String)No authored route connects the sections. Both values are display names. Choose another destination or correct transition data.
NetworkUnavailableRestore connectivity and retry.
ServerError(statusCode: Int)Other non-success HTTP response; inspect status.
CancelledSDK operation cancelled; usually no user-facing message is needed.

Catch construction and suspending operation errors. For ongoing events, use onError and state.lastError. A failed VPS state’s associated error is currently generalized by the bridge; listener/lastError can carry the specific reason.

Localized messages

fun localizedMessage(context: Context, provider: GraffityARStringsProvider? = null): String

Pass your strings provider explicitly when displaying errors in host UI. Without it, Android resources supply the localized message. Use error cases, not message text, as identifiers.

import android.content.Context import tech.graffity.android.arcloud.publicapi.* class SessionErrors( private val context: Context, private val strings: GraffityARStringsProvider? = null ) : GraffityARCloudListener { override fun onError(sdk: GraffityARCloudSDK, error: GraffityARCloudError) { when (error) { GraffityARCloudError.Cancelled -> return GraffityARCloudError.InvalidAccessToken -> println("A new access token is required.") GraffityARCloudError.CameraNotAuthorized, GraffityARCloudError.LocationNotAuthorized -> println(error.localizedMessage(context, strings)) else -> println(error.localizedMessage(context, strings)) } } }

Retain this listener before assignment. Suspending calls can also throw coroutine CancellationException; rethrow it rather than treating it as an SDK failure.

See permissions and session replacement.