Run ARCore for Jetpack XR apps on mobile devices

ARCore for Jetpack XR can run on supported mobile devices as well as Android XR devices. The ARCore for Jetpack XR library can use the Google Play Services for AR runtime on those devices. This lets you write apps for AR experiences that use a shared codebase to interact with the ARCore for Jetpack XR perception APIs.

Feature compatibility

The following features provided by ARCore for Jetpack XR are not supported on the mobile runtime:

  • Locally-persistent anchors
  • Face tracking
  • Eye tracking

Access the underlying mobile runtime

Your app might need to access features from the underlying mobile runtime that are not exposed in ARCore for Jetpack XR, for example, to access Lighting Estimation values or to use Recording and Playback.

Add dependencies

Your app needs to explicitly depend on the following libraries as an implementation dependency to access these classes directly.

Use the following dependency specification in your build.gradle file:

Groovy

dependencies {
    implementation "androidx.xr.arcore:arcore-play-services:1.0.0-alpha09"
    implementation "com.google.ar:core:1.51.0"
}

Kotlin

dependencies {
    implementation("androidx.xr.arcore:arcore-play-services:1.0.0-alpha09")
    implementation("com.google.ar:core:1.51.0")
}

Access the ArCoreRuntime

Your app can obtain a Session and Frame from the underlying runtime and use those objects directly:

val arCoreRuntime = session.runtimes.firstNotNullOfOrNull { it as? ArCoreRuntime } ?: return
val originalSession = arCoreRuntime.lifecycleManager.session()
val originalFrame = arCoreRuntime.perceptionManager.lastFrame()