Run your app's immersive experiences on the emulator

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

As you test your app, use the Android XR Emulator to extend your testing capacity beyond your physical test devices. You can use the emulator controls to help you test how your app behaves in common scenarios with AI glasses. See the following sections for details about running your virtual Android XR devices in the emulator and the emulator controls you can use.

Run your app on the emulator

  1. To start the emulator, click Run for the AVD in the Device Manager.

    Android Studio device manager screen

    The emulator opens in the side panel.

    Android Studio emulator screen

  2. To launch your app in the emulator, click Run in the Android Studio main toolbar.

    Android Studio run app configurtion

Use emulator controls for XR headsets and XR glasses

When the Android XR Emulator loads, look for the menu like the one shown in figure 1. Use the controls in this menu to interact with the emulator.

Figure 1. Use the controls in the emulator menu to interact with the emulator.

Enable the mouse and keyboard

The emulator supports interaction through a mouse and keyboard. When you want to interact with the system or an Android app in the emulator, select the interaction controls option:

Icon for the Android XR Emulator interaction option

After selecting this, you can start interacting with elements within the virtual space by moving the mouse over the emulator window.

Look and move around in the virtual environment

The Android XR Emulator renders apps and their content in a virtual 3D environment. Use the following controls to change the direction of your view:

Android Studio rotate icon

Rotate: Drag the mouse to pivot your view in that direction.

Android Studio pan icon

Pan: Drag the mouse to move up, down, and side to side. This lets you view the emulator contents from different angles.

Android Studio dolly icon

Dolly: Drag the mouse to move closer or farther from the objects in view.

Android Studio reset icon

Reset: Click this button to return the emulator to the default view.

You can also use the following keyboard shortcuts to move around in the virtual environment. To use these while using mouse and keyboard input, hold the Option key (macOS) or Alt key (Windows).

  • W: (or up arrow key): Move forward in your current view.
  • A: (or left arrow key): Side-step left.
  • S: (or down arrow key): Move backward.
  • D: (or right arrow key): Side-step right.
  • Q: Move vertically downward.
  • E: Move vertically upward.

Enable passthrough mode

The menu at the top of the emulator includes the Toggle Passthrough option to enable or disable a simulated passthrough environment.

Figure 2. Toggle passthrough to see a simulated passthrough environment.

When enabled, passthrough mode displays a simulated indoor environment. Use this mode to test apps in mixed reality.

Figure 3. A simulated passthrough environment shows spatial UI elements anchored within a room.

Other emulator controls

You can also use the following emulator controls:

Android Studio power icon

Power: Simulates powering the device on or off.

Android Studio volume up icon Android Studio volume down icon

Volume: Simulates volume control.

Android Studio screenshot icon Android Studio screen record icon

Screenshot: Takes a screenshot or screen recording of the current state of the device.

Android Studio back icon Android Studio home icon Android Studio overview icon

Android 3 button controls: Simulates the Back, Home, and Overview buttons.