Enhance app experiences with perception using ARCore for Jetpack XR

Applicable XR devices
This guidance helps you build experiences for these types of XR devices.
XR Headsets
Wired XR Glasses
AI Glasses

ARCore for Jetpack XR brings powerful perception capabilities for your app to understand the real world through a variety of APIs. Some of these APIs help you enhance immersive experiences for devices such as XR headsets and wired XR glasses, some help you enhance augmented experiences for devices such as AI glasses, and some help you enhance app experiences for all types of Android XR devices.

For example, you can use ARCore for Jetpack XR to retrieve planar data, anchor content to a fixed location in space, or use a geospatial pose to anchor content to a real-world location.

Add library dependencies

Before you begin using perception features in your XR app, add the necessary dependencies, depending on the type of app experiences you are enhancing with AR.

Access a session

Perception features in ARCore for Jetpack XR rely on a Session, which uses the Jetpack XR Runtime.

How your app should access a session depends on the types of app experiences that you're enhancing with perception features:

Access a session from Jetpack XR Runtime

To access a session from Jetpack XR Runtime, you'll create it:

To create a session, pass an activity to the create() method, as shown in the following example:

when (val result = Session.create(this)) {
    is SessionCreateSuccess -> {
        val xrSession = result.session
        // ...
    }
    else ->
        TODO(/* A different unhandled exception was thrown. */)
}

When a session's activity is destroyed, all AR content associated with that session is destroyed, and the session is no longer valid.

Configure a session

Some features might be disabled by default and must be configured in order to function. To configure a session, use configure() and specify the configuration options that your Session needs. For details about the required configuration for different AR features, see the corresponding pages for each AR feature.

Next steps

After your app has a session, explore the ways you can use it to enhance app experiences for different XR devices: