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.

isARSupportedOnDevice(notSupportedCallback, supportedCallback)

ArgumentTypeDescription
notSupportedCallbackFunctionCalled when the device does not support AR
supportedCallbackFunctionCalled when the device supports AR

🚧

Note

Per ARCore docs, in the notSupportedCallback we now return a String value between UNSUPPORTED, UNKNOWN or TRANSIENT. If ARCore returned TRANSIENT, the application should check back again soon for an updated state value.

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:

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

const isARSupportedOnDevice = ViroUtils.isARSupportedOnDevice(
  () => console.log('failed'), 
  () => console.log('success')
);