To setup an environment capable of AR development using WebXR, you'll need:
- A web server that serves resources in a secure context
Use a secure context
A secure context is a security mechanism that ensures that web resources have been transferred with a certain level of security. You'll need a secure context to provide a trusted XR experience with your new features.
In other to qualify as being served in a secure context, your resource must meet at least one of the following conditions:
- The resource must be delivered over TLS (
- The resource must be requested through
Set up port forwarding
If you don't have a development server accessible over TLS, you can still develop in a secure context by using Chrome DevTools' Port forwarding. Port forwarding enables an Android device to access content hosted on the development machine's web server. It creates a listening TCP port on the Android device that maps to a TCP port on the development machine. Traffic can then travel through the USB connection between these two ports.
Follow these steps to set up port forwarding:
- Follow the steps for Set up port forwarding in the Chrome DevTools instructions.
- Ensure that the web server on the development workstation is running.
- Verify that your connection works. Open Google Chrome on the Android device and browse to
localhoston the port number specified in Port forwarding settings, for example,
The resources on the web server should now be visible from the Android device. These resources are served in a Secure Context and can use WebXR capabilities.
Set up a supported device
AR experiences on Android can only be run on an ARCore supported device. Ensure that the device has Google Play Services for AR installed and enabled.
Now that you have set up your development environment to create AR experiences using WebXR, you can: