Google VR SDK integration in mobile app

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Google VR SDK integration in mobile app
Medium
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Google VR SDK Integration in Mobile Apps

Google VR SDK (Cardboard SDK after 2021 rebranding) — official library for adding Cardboard VR to mobile apps on iOS and Android. SDK handles lens distortion, head tracking, stereo projection, and device profile QR scanning.

Current Status: Cardboard SDK vs Deprecated Google VR SDK

Important: original Google VR SDK (gvr-android-sdk) deprecated since 2019. Current version — open Google Cardboard SDK, actively maintained. If project uses old com.google.vr.sdk — migration recommended.

New Cardboard SDK supports:

  • Unity via UPM package com.google.cardboard
  • Native Android (C++ via JNI + Java wrapper)
  • Native iOS (Objective-C/Swift)

Unity Integration

Most common path. Via Package Manager add com.google.cardboard from git URL:

https://github.com/googlevr/cardboard.git#upm

After installation add CardboardCamera component to Main Camera. SDK automatically:

  • Splits screen in half for stereo rendering
  • Applies lens distortion correction
  • Reads head tracking from IMU
  • Handles trigger button
// First launch: show UI for QR scanning
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) {
    // Get matrices for each eye
    long monotonic_time_ns = System.nanoTime();
    float[] leftEyeViewMatrix  = new float[16];
    float[] rightEyeViewMatrix = new float[16];

    headTracker.getPose(monotonic_time_ns, leftEyeViewMatrix, rightEyeViewMatrix);

    // Render each eye...

    // Apply lens distortion via SDK
    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'

// CardboardV1API — main entry point
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()
        }
    }
}

QR Scanning: Handling Edge Cases

QR scanner opens on first launch or explicit user request. Potential issues:

  • User declined scanning → SDK uses default Cardboard v1 parameters. Lens distortion incorrect for non-standard housings.
  • QR not readable (poor lighting, damaged code) → "enter manually" button or "use standard Cardboard."
  • After housing change → settings screen "change headset" button, calls CardboardQrCode.scanQrCodeAndSaveDeviceParams().

Split-screen and Fullscreen Mode

Cardboard SDK expects landscape orientation. On iOS means lock UIInterfaceOrientationMask to .landscapeRight. On Android — android:screenOrientation="landscape" in manifest + handle onConfigurationChanged to avoid activity recreation.

Screen cutouts (notch, Dynamic Island) in landscape may cover part of VR image. Use WindowInsets.displayCutout (Android) and safeAreaInsets (iOS) for correct render region positioning.

Common Integration Issues

IllegalStateException: Surface is not valid on Android startup — GLSurfaceView not ready at Cardboard initialization. Solved by initializing in surfaceCreated() callback, not onCreate().

SDK doesn't compile with new NDK — Cardboard SDK has native C++ part, sometimes requires explicit abiFilters "armeabi-v7a", "arm64-v8a" in gradle.

On iOS 17+ CMMotionManager requires NSMotionUsageDescription in Info.plist — without it crash on VR mode start.

Workflow

Audit existing project: Unity or native, current dependencies, target iOS/Android versions.

Integrate Cardboard SDK, configure QR scanning.

Adapt rendering: split-screen, lens distortion, stereo projections.

Gaze interaction and Cardboard button.

Test on real devices from different manufacturers.

Timeline Estimates

Basic Cardboard SDK integration into Unity project — 2–3 days. Native integration with custom renderer for iOS or Android — 3–5 days.