Are you a Google Cardboard Developer, and wishing you could push to a new runtime in Unity.x? Or maybe you added Google Cardboard functionality to your app, but still want to support older devices from the same build?
By default, Google Cardboards SDK only supports Android API 19 and later (4.4+). This works great, but sometimes you need to build for slightly older API levels. For example, lets say you wanted to build a BlackBerry 10 friendly Google Cardboard application.
To do this, you just need to change a couple files. Just remember though, there is a reason there is a minimum SDK level!
Prior to doing the following steps, I highly recommend opening the GoogleVR folder from inside Unity, and importing the package for older SDK compatibility.
Modify the Unity Build Settings
Step 1: Launch your Unity App
Step 2: Press File > Build Settings > Select Android, and press Player Settings
Step 3: In the Inspector panel, set the Minimum SDK level to whatever you want (it defaults to 2.3.3, but will be overridden by the Googel Cardboard SDK to use 4.4).
Tip: For BlackBerry 10 in this case, we would set the SDK minimum to 17.
Now we need to modify the plugin manifest files.
Step 1: In the Project panel, right click on the Plugins folder and press Open in Explorer
Step 2: Open Plugins -> Android
Step 3: Open all three manifest files, and set the Minimum SDK to your appropriate value (in this case, 17).
You'll still be unable to build. To complete our build, we need to update packaged third-party plugins
Step 1: In the same folder above, rename the unitygvractivity.aar to unitygvractivity.zip
Step 2: Extract the contents to the unitygvractivityfolder
Step 3: Double click on the folder. Edit the AndroidManifest.xml
Step 4: Set the Minimum SDK to your appropriate value (in this case, 17).
Step 5: Rezip the folder contents back into unitygvractivity.zip and rename back to unitygvractivity.aar
* TIP: Make sure that the Android manifest (and all associate files) are at the ROOT of the zip
Completing the Build
Step 1: Return to Unity and press Build
Note: This set of tricks can work on most any Android plugin set for Unity. But again, just remember, you almost always sacrifice "something" by downgrading a recommended minimum API level. So test, and build some alternative interaction methods for other devices. You also may need to try installing earlier Google Cardboard app like Cardboard 1.5 (supports 4.1 and later) to ensure matching compatibility.
You also may need to export builds with a different distortion mode than the default.
Last edited by KermEd; 12-09-2016 at 03:55 AM.
12-09-2016 02:14 AM