The Android XR SDK has reached Developer Preview 4, and we want your feedback! Try things out, and visit our support page to reach out.

Check device capabilities at runtime for audio glasses and display glasses

Applicable XR devices
This guidance helps you build experiences for these types of XR devices.
Audio &
Display Glasses

Different types of audio glasses and display glasses have different capabilities. After planning how you'll support different types of AI devices, you can check for device capabilities at runtime to provide the best experience for a user's device.

Check whether a device has a display

Display glasses can show UIs built with Jetpack Compose Glimmer. The following example shows how to check whether a glasses device has a display:

// Check device capabilities
valprojectedDeviceController=ProjectedDeviceController.create(this@ProjectedMainActivity)
isVisualUiSupported=projectedDeviceController.capabilities.contains(CAPABILITY_VISUAL_UI)

React to display state changes

On display glasses, the display can time out or the user can turn off the display. To design activities that run whether the display is on or off, use addPresentationModeChangedListener to be notified when the display state changes. You can tune your activity for the appropriate amount of audio information depending on display state.

ProjectedDisplayController.create(activity).addPresentationModeChangedListener{
presentationModeFlags->
valareVisualsOff=!presentationModeFlags.hasPresentationMode(VISUALS_ON)
}

Keep the display on

On display glasses, you can request that the system keep the screen on and prevent the screen from timing out using addLayoutParamsFlags.

varprojectedDisplayController=ProjectedDisplayController.create(activity)
projectedDisplayController.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026年07月21日 UTC.