Get started with OpenXR for Android XR

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

Before you start building with supported OpenXR extensions or with a supported engine, review the information and complete any tasks in the following sections to make sure your app is configured for immersive XR development.

Configure your app's manifest file

As with other Android app projects, your Android XR app must have an AndroidManifest.xml file with specific manifest settings. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play. See the app manifest overview guide for more information.

For XR differentiated apps, your manifest file must contain the following elements and attributes:

PROPERTY_XR_ACTIVITY_START_MODE property

The android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE" property lets the system know that an activity should be launched in a specific mode when the activity is started.

This property has the following values:

  • XR_ACTIVITY_START_MODE_FULL_SPACE_UNMANAGED (OpenXR only)

XR_ACTIVITY_START_MODE_FULL_SPACE_UNMANAGED

Apps built with OpenXR launch in Full Space and must use XR_ACTIVITY_START_MODE_FULL_SPACE_UNMANAGED start mode. Unmanaged Full Space signals to Android XR the app uses OpenXR.


<manifest ... >

   <application ... >
       <property
           android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
           android:value="XR_ACTIVITY_START_MODE_FULL_SPACE_UNMANAGED" />
       <activity
           android:name="com.example.myapp.MainActivity" ... >

           <intent-filter>
               <action android:name="android.intent.action.MAIN" />

               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
   </application>
</manifest>

The android:name="android.window.PROPERTY_XR_BOUNDARY_TYPE_RECOMMENDED" property indicates that the application should be launched with a specific type of boundary. Your app needs to specify XR_BOUNDARY_TYPE_LARGE if it's designed to let users move around their physical space. Specifying XR_BOUNDARY_TYPE_NO_RECOMMENDATION provides no recommendations for the type of safety boundary, so the system uses the type that is already in use.

<manifest ... >

   <application ... >
       <property
           android:name="android.window.PROPERTY_XR_BOUNDARY_TYPE_RECOMMENDED"
           android:value="XR_BOUNDARY_TYPE_LARGE" />
   </application>
</manifest>

<uses-native-library> OpenXR

OpenXR applications must declare the use of the native OpenXR library to successfully load its runtime. Without this declaration, the runtime fails to load.

<manifest ... >

    <application ... >

    <uses-native-library android:name="libopenxr.google.so" android:required="false" />

       <activity
           android:name="com.example.myapp.MainActivity" ... >

           <intent-filter>
               <action android:name="android.intent.action.MAIN" />

               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
        </activity>
    </application>
</manifest>

PackageManager features for XR apps

When you distribute apps through the Google Play Store, you can specify required hardware or software features in the app manifest. The uses-feature element allows the Play Store to appropriately filter apps shown to users.

The following features are specific to XR-differentiated apps.

android.software.xr.api.openxr

Apps that target the Android XR platform and are built with OpenXR or Unity must include this feature in the app manifest with the android:required attribute set to true.

Apps that use the Android XR Extensions Package for Unity version 1.0.0 or higher or the Unity OpenXR: Android XR Package version 0.5.0-exp.1 or higher don't have to add this element manually to the app manifest. These two packages will inject this element into the app manifest for you.

Devices may specify a version for this feature, which indicates the highest version of OpenXR supported by the device. The higher 16 bits represent the major number, and the lower 16 bits represent the minor number. For example, to specify OpenXR version 1.1, the value would be set to "0x00010001".

Apps can use the feature version to indicate a minimum version of OpenXR that the app requires. For example, if your app requires OpenXR version 1.1 support, declare the following feature:

<uses-feature android:name="android.software.xr.api.openxr"
    android:version="0x00010001"
    android:required="true" />

android.hardware.xr.input.controller

This feature indicates that the app requires input from a high precision, 6DoF (degrees of freedom) motion controller to function correctly. If your app supports controllers and can't function without them, set the value to true. If your app supports controllers but can operate without them, set it to false.

<!-- Sets android:required to true, indicating that your app can't function on devices without controllers. -->
<uses-feature android:name="android.hardware.xr.input.controller" android:required="true" />

android.hardware.xr.input.hand_tracking

This flag indicates that the app requires high fidelity hand tracking to function correctly, including position, orientation, and velocity of joints in the user's hand. If your app supports hand tracking and can't function without it, set the value to true. If your app supports hand tracking, but can operate without it, set it to false.

<!-- Sets android:required to true, indicating that your app can't function on devices without hand tracking. -->
<uses-feature android:name="android.hardware.xr.input.hand_tracking" android:required="true" />

android.hardware.xr.input.eye_tracking

This flag indicates that the app requires high-fidelity eye tracking for input to function correctly. If your app supports eye tracking for input and can't function without it, set the value to true. If your app supports eye tracking for input, but can operate without it, set it to false.

<!-- Sets android:required to true, indicating that your app can't function on devices without eye tracking. -->
<uses-feature android:name="android.hardware.xr.input.eye_tracking" android:required="true" />

Next steps

Now that you've finished configuring your app's manifest and reviewing important information, explore ways that you can build with OpenXR: