The following guide details how to setup an AR application.
AR is not supported on all platforms. The full list of devices supporting AR can be found on Google's ARCore page. To programmatically detect if a device supports ARCore, use the ViroViewARCore.isDeviceCompatible(Context) method. If a given device isn't compatible, an UnavailableDeviceNotCompatibleException will be thrown if you attempt to construct a ViroViewARCore.
If a device is compatible, then when the ViroViewARCore is constructed users will be prompted to download ARCore, if they haven't already. This is an asynchronous flow that you can listen to by passing a StartupListener into the ViroViewARCore constructor. If the download and install of ARCore was successful, the StartupListener's onSuccess() callback will be invoked. Otherwise, onFailure() will be invoked with the corresponding error code.
To summarize, the workflow is as follows:
ViroCore requires access to the device's camera for AR enabled features like tracking / SLAM to function properly. This permission check automatically occurs during the onActivityResumed phase within the ViroViewARCore view. If the user has already previously given Camera permissions for your application, everything should work as per normal.
However, if no camera permissions have yet been given, Viro will automatically ask for Camera permissions via Android's requestPermissions() API. This should pop up a friendly permission request dialog as shown below:
If user then denies camera permissions, the StartupListener's onFailure() callback will be invoked with the corresponding CAMERA_PERMISSIONS_NOT_GRANTED error code. Note that like other Android permissions, you can also preemptively call and check for Camera permissions within your Android application before constructing the ViroViewARCore control.
Updated less than a minute ago