After you've installed and configured Android Studio, created a project, and set up the Jetpack XR SDK, you're ready to start building immersive experiences.
Before you start exploring all the ways you can build, 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_HOME_SPACE(Jetpack XR SDK only)XR_ACTIVITY_START_MODE_FULL_SPACE_MANAGED(Jetpack XR SDK only)
XR_ACTIVITY_START_MODE_HOME_SPACE
Use this start mode to launch your app in Home Space. In Home Space, multiple apps can run side-by-side, so users can multitask. Any mobile or large screen Android app can operate in Home Space, as well as XR apps built using the Jetpack XR SDK.
<manifest ... >
<application ... >
<property
android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
android:value="XR_ACTIVITY_START_MODE_HOME_SPACE" />
<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>
XR_ACTIVITY_START_MODE_FULL_SPACE_MANAGED
Use this start mode to launch your app in Full Space. In Full Space, only one app runs at a time, with no space boundaries, and all other apps are hidden.
<manifest ... >
<application ... >
<property
android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
android:value="XR_ACTIVITY_START_MODE_FULL_SPACE_MANAGED" />
<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>
PROPERTY_XR_BOUNDARY_TYPE_RECOMMENDED property
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>
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.spatial
Apps that are built using the Jetpack XR SDK must
include this feature in the app manifest. The value you set for the
android:required attribute depends on your app's
release track.
If your app bundles XR-differentiated features or content into an existing
mobile APK and is published on the mobile release track, then set the
android:required attribute to false:
<!-- If you are publishing an existing mobile APK using the mobile release track, set android:required to false.-->
<uses-feature android:name="android.software.xr.api.spatial" android:required="false" />
If your app is built specifically for XR-enabled devices and is published to the
Android XR dedicated release track, then set the android:required attribute to
true:
<!-- If you are publishing a separate APK for XR using the dedicated Android XR release track, set android:required to true.-->
<uses-feature android:name="android.software.xr.api.spatial" 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" />
App manifest compatibility considerations for mobile and large screen apps
As described in the PackageManager features for XR apps section, apps
declare that they use a feature by declaring it in a <uses-feature>
element in the app manifest. Some features, such as telephony or GPS, might not
be compatible with all devices.
To get a listing of the features that are enabled for a device, run adb
shell pm list features.
Unsupported features
The Google Play store filters applications available for installation on a device by using the following Android feature declarations.
Camera Hardware
android.hardware.camera.autofocus
android.hardware.camera.capability.manual_post_processing
android.hardware.camera.capability.manual_sensor
android.hardware.camera.capability.raw
android.hardware.camera.concurrent
android.hardware.camera.external
android.hardware.camera.level.full
Connectivity
android.hardware.ipsec_tunnel_migration
Device Configuration
Form Factor Configuration
android.hardware.type.automotive
android.hardware.type.embedded
android.hardware.type.television
android.software.leanback_only
Input
android.software.input_methods
Location
Near Field Communication
Security Configuration and Hardware
android.hardware.se.omapi.uicc
android.hardware.biometrics.face
android.hardware.identity_credential
android.hardware.identity_credential_direct_access
android.hardware.keystore.limited_use_key
android.hardware.keystore.single_use_key
android.hardware.strongbox_keystore
Sensors
android.hardware.sensor.accelerometer_limited_axes
android.hardware.sensor.accelerometer_limited_axes_uncalibrated
android.hardware.sensor.ambient_temperature
android.hardware.sensor.barometer
android.hardware.sensor.gyroscope_limited_axes
android.hardware.sensor.gyroscope_limited_axes_uncalibrated
android.hardware.sensor.heading
android.hardware.sensor.heartrate
android.hardware.sensor.heartrate.ecg
android.hardware.sensor.hinge_angle
android.hardware.sensor.relative_humidity
android.hardware.sensor.stepcounter
android.hardware.sensor.stepdetector
Software Configuration
android.software.connectionservice
android.software.expanded_picture_in_picture
android.software.live_wallpaper
android.software.picture_in_picture
android.software.wallet_location_based_suggestions
Telephony
android.hardware.telephony.calling
android.hardware.telephony.cdma
android.hardware.telephony.data
android.hardware.telephony.euicc
android.hardware.telephony.euicc.mep
android.hardware.telephony.gsm
android.hardware.telephony.ims
android.hardware.telephony.mbms
android.hardware.telephony.messaging
android.hardware.telephony.radio.access
android.hardware.telephony.subscription
Virtual Reality (Legacy)
android.hardware.vr.headtracking
android.hardware.vr.high_performance
Widgets
Next steps
Now that you've finished configuring your app's manifest and reviewing important information, explore ways that you can build immersive experiences:
- Bring your Android app into 3D with XR
- Develop spatial UI with Jetpack Compose for XR
- Implement Material Design for your spatial UI
- Add spatial environments to your app
- Create, control, and manage entities