Provider Setup
ViroReact v2.53.0 supports two anchor providers: ReactVision (default) and ARCore (Google). The provider prop on ViroARSceneNavigator controls which backend is used for both Cloud Anchors and Geospatial Anchors simultaneously.
// ReactVision (default — can be omitted)
<ViroARSceneNavigator initialScene={{ scene: MyARScene }} />
// ARCore (explicit)
<ViroARSceneNavigator provider="arcore" initialScene={{ scene: MyARScene }} />
New in v2.53.0: The old
cloudAnchorProviderandgeospatialAnchorProviderprops are deprecated. Use the singleproviderprop instead.ViroCloudAnchorProviderandViroGeospatialAnchorProvidertypes are deprecated aliases for the newViroProvidertype — they still compile with a deprecation warning.
Provider Comparison
| ReactVision (Default) | ARCore | |
|---|---|---|
| API Keys | A client key as rvApiKey, plus rvProjectId, from ReactVision Editor | Google Cloud API key with ARCore API enabled |
| Cloud Anchors | Host, resolve, GPS proximity search and resolve analytics with a client key; list, edit, delete and asset linking with a secret key | Host and resolve only |
| Geospatial Anchors | Host, resolve and proximity search with a client key; list, edit and delete with a secret key. No VPS or ARCore pods required | Requires ARCore Geospatial API + VPS |
| Asset Uploads | rvUploadAsset for 3D models, images and video, with a secret key | Not available |
| Platform Support | iOS + Android | iOS + Android |
ReactVision provider in 3.2.1 (ReactVision Spatial 1.5.0)
- Android: hosting a cloud anchor no longer fails with
timeouton a slow uplink; the upload timeout grows with its size, up to 140 s, and a failed upload is sent once more.- Android: a resolved cloud anchor is an ARCore anchor that content can follow. The resolve result's
anchor.anchorIdis now the ARCore anchor's id;cloudAnchorIdis unchanged. See Cloud Anchors.- Resolve analytics are accurate: each resolve report carries the real match and inlier counts and why it failed or was cancelled, and hosting sends the device and descriptor format.
Deprecated provider props in 3.1.0
From 3.1.0,
ViroARSceneNavigatorhonours the deprecatedcloudAnchorProviderandgeospatialAnchorProviderprops whenprovideris not set. In 3.0 they were always overridden with"reactvision". If your app still passescloudAnchorProvider="arcore", it now uses ARCore Cloud Anchors, which needs a Google Cloud API key. Remove the prop, or passprovider, to keep ReactVision's.
ReactVision Provider (Default)
Get a client key and project ID from ReactVision Editor.
Expo Projects
Configure app.json or app.config.js:
{
"expo": {
"plugins": [
[
"@reactvision/react-viro",
{
"provider": "reactvision",
"rvApiKey": "YOUR_REACTVISION_API_KEY",
"rvProjectId": "YOUR_REACTVISION_PROJECT_ID"
}
]
]
}
}
Then rebuild:
npx expo prebuild --clean
npx expo run:ios
# or
npx expo run:android
Bare React Native (Non-Expo)
iOS
1. Add your API key and Project ID to Info.plist:
<key>RVApiKey</key>
<string>YOUR_REACTVISION_API_KEY</string>
<key>RVProjectId</key>
<string>YOUR_REACTVISION_PROJECT_ID</string>
2. Add required permissions to Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app uses the camera for augmented reality.</string>
Geospatial features only: If you are using Geospatial Anchors, also add location permissions:
<key>NSLocationWhenInUseUsageDescription</key> <string>This app uses your location to place AR content in the real world.</string> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>This app uses your location to place AR content in the real world.</string>
3. Install pods:
cd ios && pod install && cd ..
Android
1. Add your API key and Project ID to AndroidManifest.xml:
Add the following inside the <application> tag:
<meta-data
android:name="com.reactvision.RVApiKey"
android:value="YOUR_REACTVISION_API_KEY" />
<meta-data
android:name="com.reactvision.RVProjectId"
android:value="YOUR_REACTVISION_PROJECT_ID" />
2. Add required permissions to AndroidManifest.xml:
Add the following outside the <application> tag:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
Geospatial features only: If you are using Geospatial Anchors, also add:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
3. Rebuild your app:
npx react-native run-android
ARCore Provider
The following setup is only required if you explicitly set
provider="arcore".
Google Cloud Setup
Before configuring your app, you need to set up Google Cloud:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the ARCore API:
- Navigate to "APIs & Services" > "Library"
- Search for "ARCore API"
- Click "Enable"
- Create an API key:
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "API key"
- (Recommended) Restrict the key to the ARCore API
Expo Projects
Configure app.json or app.config.js:
{
"expo": {
"plugins": [
[
"@reactvision/react-viro",
{
"googleCloudApiKey": "YOUR_GOOGLE_CLOUD_API_KEY",
"provider": "arcore",
"android": {
"xRMode": ["AR"]
}
}
]
]
}
}
Then rebuild:
npx expo prebuild --clean
npx expo run:ios
# or
npx expo run:android
The Expo plugin automatically configures:
| Platform | What the plugin adds |
|---|---|
| iOS | GARAPIKey in Info.plist, use_frameworks! :linkage => :dynamic in Podfile, ARCore/CloudAnchors, ARCore/Geospatial, and ARCore/Semantics pods, location permission descriptions |
| Android | com.google.android.ar.API_KEY meta-data, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, CAMERA, and INTERNET permissions in AndroidManifest.xml |
Bare React Native (Non-Expo)
iOS
1. Modify your Podfile:
Add the following to your ios/Podfile:
# Enable dynamic frameworks (required for ARCore)
use_frameworks! :linkage => :dynamic
# Add ARCore pods
pod 'ARCore/CloudAnchors', '~> 1.51.0'
pod 'ARCore/Geospatial', '~> 1.51.0'
pod 'ARCore/Semantics', '~> 1.51.0' # Required for Scene Semantics support
Important: ARCore SDK requires
use_frameworks!with dynamic linkage. This may affect other dependencies in your project.
2. Add API key to Info.plist:
<key>GARAPIKey</key>
<string>YOUR_GOOGLE_CLOUD_API_KEY</string>
3. Add required permissions to Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app uses the camera for augmented reality.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app uses your location to place AR content in the real world.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app uses your location to place AR content in the real world.</string>
4. Install pods:
cd ios && pod install && cd ..
Android
1. Add API key to AndroidManifest.xml:
Add the following inside the <application> tag:
<meta-data
android:name="com.google.android.ar.API_KEY"
android:value="YOUR_GOOGLE_CLOUD_API_KEY" />
2. Add required permissions to AndroidManifest.xml:
Add the following outside the <application> tag:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
3. (Optional) Override ARCore version in build.gradle:
ViroReact includes ARCore as a dependency, but you can override the version if needed:
dependencies {
implementation 'com.google.ar:core:1.44.0'
}
4. Rebuild your app:
npx react-native run-android
Troubleshooting
"API key not found" errors
iOS (ReactVision): Verify RVApiKey and RVProjectId are in your Info.plist.
iOS (ARCore): Verify GARAPIKey is in your Info.plist.
Android (ReactVision): Verify com.reactvision.RVApiKey and com.reactvision.RVProjectId meta-data are in AndroidManifest.xml.
Android (ARCore): Verify com.google.android.ar.API_KEY meta-data is in AndroidManifest.xml.
"This endpoint does not accept this type of API key"
The method needs a secret key, and your app holds a client key. Listing, editing and deleting anchors, attaching content to them and uploading images, videos and 3D models are secret-key operations, because anyone who has your app holds its client key. Make those calls from your backend with a secret key, or test them from an internal build that holds one. See Authentication for which key each operation accepts.
Android: hosting fails with timeout
timeoutUse ViroReact 3.2.1 or later. Earlier versions gave the descriptor upload 30 s, so a slow uplink failed even while it was still sending. From 3.2.1 the timeout grows with the upload, up to 140 s.
"Not authorized" errors
- Your API key may be invalid or expired
- ReactVision: Visit ReactVision Editor to verify your credentials
- ARCore: Check your Google Cloud Console to ensure the ARCore API is enabled and the key is not restricted incorrectly
ARCore pods not linking (iOS)
- Ensure
use_frameworks! :linkage => :dynamicis in your Podfile - Run
pod install --repo-updateto refresh pod specs - Check that no other dependency is forcing static linkage
Updated 3 days ago