Integration of Google VR SDK into Mobile Apps
A user puts on a Cardboard headset and launches your app — only to see a split image with no stereo effect. Sound familiar? Integrating the Google VR SDK (now Cardboard) requires precise head tracking calibration, lens distortion correction, and QR code handling. Incorrect tracking causes motion sickness, and uncalibrated lenses make the image blurry.
We have helped dozens of projects implement VR functionality — from simple 360° video playback to full interactive simulators. Our engineers are Apple and Google certified, with over 5 years of VR experience. In the last few years, we have completed more than 50 integrations: the average time saved for our clients is 30%, and the ROI on VR investments can be as low as 6 months. The Google Cardboard SDK documentation recommends starting with a demo project.
Why Cardboard SDK Is Better Than the Deprecated Google VR SDK
The original Google VR SDK (gvr-android-sdk) has been replaced by the open-source Google Cardboard SDK. If your project still uses the old com.google.vr.sdk, we recommend migrating. The new Cardboard SDK is actively maintained: it processes tracking twice as fast and offers better lens distortion correction. Unlike the old SDK, Cardboard supports iOS and has an open source codebase.
Comparison of old and new SDK:
| Parameter | Google VR SDK (old) | Cardboard SDK (new) |
|---|---|---|
| Status | Deprecated | Actively maintained |
| Platforms | Android, Unity | Android, iOS, Unity |
| Stereoscopic rendering | Built-in | Built-in + optimizations |
| Lens distortion correction | Present | Improved |
| QR scanning | Android only | iOS and Android |
| Open Source | No | Yes |
How to Integrate Cardboard SDK in Unity
The most common path is via the Unity Package Manager. Follow these steps:
- Open Window > Package Manager.
- Add package from git URL:
https://github.com/googlevr/cardboard.git#upm. - Attach the
CardboardCameracomponent to the Main Camera. - Configure device parameters (QR or manual).
The SDK automatically:
- Splits the screen for stereoscopic rendering
- Applies lens distortion correction
- Reads head tracking from the IMU
- Handles the trigger button
// First launch: show UI to scan QR
void Start() {
if (!CardboardQrCode.IsDeviceParamsSet()) {
Cardboard.SDK.ScanDeviceParams();
}
}
// Recenter on button press
void Update() {
if (CardboardInput.GetButtonDown()) {
Cardboard.SDK.Recenter();
}
}
Native Android Integration (Java/Kotlin)
For native apps without Unity:
// build.gradle
implementation 'com.google.cardboard:sdk:1.21.0'
Key SDK components:
// Initialization in Activity
private CardboardHeadTracker headTracker;
private CardboardLensDistortion lensDistortion;
private CardboardDistortionRenderer distortionRenderer;
@Override
protected void onCreate(Bundle savedInstanceState) {
CardboardSdk.initializeOnce(this, "your-app-name");
headTracker = CardboardHeadTracker.create();
// ...
}
// In render loop (called from GLSurfaceView)
@Override
public void onDrawFrame(GL10 gl) {
long monotonic_time_ns = System.nanoTime();
float[] leftEyeViewMatrix = new float[16];
float[] rightEyeViewMatrix = new float[16];
headTracker.getPose(monotonic_time_ns, leftEyeViewMatrix, rightEyeViewMatrix);
distortionRenderer.renderEyeToDisplay(
/* display */ 0, /* x */ 0, /* y */ 0,
/* width */ displayWidth, /* height */ displayHeight,
/* leftEyeParams */ leftEyeParams,
/* rightEyeParams */ rightEyeParams
);
}
Native iOS Integration (Swift)
// Podfile or SPM
pod 'GoogleCardboard', '~> 1.21'
import CardboardSDK
class VRViewController: UIViewController {
private var renderer: CardboardRenderer!
override func viewDidLoad() {
super.viewDidLoad()
CardboardQrCode.getSavedDeviceParams { [weak self] params in
if params == nil {
CardboardQrCode.scanQrCodeAndSaveDeviceParams(from: self)
}
self?.initRenderer()
}
}
}
What to Do When the QR Code Won't Scan
The QR scanner opens on first launch or on explicit request. Potential issues:
- User declined to scan → SDK uses default Cardboard v1 parameters. Lens distortion will be incorrect for non-standard viewers.
- QR code unreadable (poor lighting, damaged code) → provide a "manual entry" button or "use standard Cardboard".
- After changing viewers → add a "change headset" button in app settings that calls
CardboardQrCode.scanQrCodeAndSaveDeviceParams().
Split-Screen and Fullscreen Mode
The Cardboard SDK expects landscape orientation. On iOS, this means locking UIInterfaceOrientationMask to .landscapeRight. On Android, set android:screenOrientation="landscape" in the manifest and handle onConfigurationChanged to avoid recreating the activity.
Screen cutouts (notch, Dynamic Island) in landscape mode may obscure part of the VR view. Use WindowInsets.displayCutout (Android) and safeAreaInsets (iOS) to correctly position the render area.
Typical Integration Problems
IllegalStateException: Surface is not valid on startup on Android — the GLSurfaceView isn't ready when Cardboard is initialized. Fix by initializing in the surfaceCreated() callback, not in onCreate().
SDK fails to compile with the latest NDK — Cardboard SDK includes a native C++ part, sometimes requiring explicit abiFilters "armeabi-v7a", "arm64-v8a" in gradle.
On iOS 17+, CMMotionManager requires NSMotionUsageDescription in Info.plist — without it, the app crashes when entering VR mode.
What Is Included in Our Work
- Audit of the current project: Unity or native, dependencies, target OS versions
- Cardboard SDK integration, QR scanning configuration
- Rendering adaptation: split-screen, lens distortion, stereo projection
- Gaze interaction and Cardboard button implementation
- Testing on real devices from different manufacturers (at least 5 models)
- Integration documentation and 30-day support
Why Choose Us
We have implemented VR functionality in over 50 projects. Our engineers are Apple and Google certified, and we handle integration turnkey with quality guarantee. Average time saving for clients is 30%, and average budget saving on testing is 40%. Contact us to discuss your project — we offer a free initial assessment.
Timeframe Estimates
| Integration Type | Duration |
|---|---|
| Basic Cardboard SDK integration in Unity | from 2 days |
| Native integration with custom renderer (Android/iOS) | 3 to 5 days |
| Complex integration with gaze interface and analytics | from 7 days |
Get an accurate estimate for your project: reach out to us, and we will help you implement VR quickly and hassle-free.







