HomeGuidesAPI ReferenceChangelogDiscussions
Hire a ReactVision Expert 🛠️Launch Studio 🖥️Sponsor on GitHub ❤️Log In
Guides

IsARSupportedOnDevice

We provide a helpful utility module isARSupportedOnDevice to enable our developers to check their app users' device for compatibility to support their AR experiences conditionally. This way app developers can check and render appropriate views depending on whether the device is supported by the underlying AR system.

async isARSupportedOnDevice()

Example Use:

To take advantage of this utility, simply import ViroUtils on top of your scene and create an alias to the function like below:

Android, 3.2.0+: an app built without the AR xRMode (for example xRMode: "QUEST" only) leaves ARCore out, and the native check reports UNSUPPORTED, so the promise rejects with an error whose message is UNSUPPORTED. See Integrating ViroReact with Expo.

Web, 3.2.2+: isARSupportedOnDevice answers from what the browser offers: a secure context (HTTPS), a camera API and motion events. Whether the device has a motion sensor is only known once events arrive, so a desktop browser can pass this check and then report missing motion when AR starts (see onMotionUnavailable).

import {  ViroUtils } from '@reactvision/react-viro';

try {
  const result = await isARSupportedOnDevice();
  console.log(result.isARSupported);
} catch (err) {
  console.error(err);
}