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)
Argument | Type | Description |
---|---|---|
notSupportedCallback | Function | Called when the device does not support AR |
supportedCallback | Function | Called when the device supports AR |
Note
Per ARCore docs, in the
notSupportedCallback
we now return a String value betweenUNSUPPORTED
,UNKNOWN
orTRANSIENT
. If ARCore returnedTRANSIENT
, 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')
);
Updated over 1 year ago