VrApi Native Samples (Deprecated)
Updated: Sep 29, 2022
Mobile SDK Deprecation
As of August 31, 2022, Mobile SDK and the VrApi library are no longer supported. Future updates will be delivered through OpenXR extensions and our OpenXR Mobile SDK, not through any new updates to Meta Mobile or PC APIs. - New apps must use OpenXR unless a waiver is granted.
- New apps will not have access to Meta Native Mobile APIs, but existing apps can continue using them.
- No assistance will be provided for creating new apps with Meta Native APIs. You will find recommendations for migrating existing apps to OpenXR in the developer guides.
- Only critical security, privacy, or safety issues in Meta Native APIs will be addressed.
- Any testing of Meta Native Mobile will be restricted to automated QA tests, only to ensure core features remain functional.
The Mobile SDK includes a set of VrAPi sample projects that prove out virtual reality application development on the Android platform and demonstrate high-performance virtual reality experiences on mobile devices. The native sample projects can be found in the
Mobile SDK at
\ovr_sdk_mobile\VrSamples
.
The sample projects included with the SDK are provided as a convenience for development purposes. Some of these projects are similar to apps available for download from the Meta Store. Due to the potential for conflict with these versions, we do not recommend running these sample apps on the same device on which you have installed your retail experience.
Note: Due to limitations of Android ndk-build
, your Oculus Mobile SDK path must not contain spaces. If you have placed your Oculus Mobile SDK in a path or folder name that contains spaces, you must move or rename the folder before you build our samples.
The following samples can be found in \VrSamples
:
- VrInput: A simple scene illustrating use of the VrApi Input API.
- VrInputStandard: Use of standard input API’s to read poses and primary action state for hands and tracked controllers through a simple device representation.
- VR Compositor_NativeActivity: A simple scene using the Android
NativeActivity
class to illustrate the use of the different layer types available with vrapi_SubmitFrame2
. - VrCubeWorld samples: A simple scene with colorful cubes illustrating construction of basic native apps using different tools provided by the SDK. There are four versions of VrCubeWorld:
- VrCubeWorld_SurfaceView is closest to the metal. This sample uses a plain Android SurfaceView and handles all Android activity and Android surface lifecycle events in native code. This sample does not use the application framework - it only uses the VrApi. It provides a good example of how to integrate the VrApi in an existing engine. The
MULTI_THREADED
define encapsulates the code that shows how the VrApi can be integrated into an engine with a separate renderer thread. - VrCubeWorld_NativeActivity uses the Android
NativeActivity
class to avoid manually handling all lifecycle events. This sample does not use the application framework, onlyVrAPI. It provides a good example of how to integrate the VrApi in an existing engine that uses NativeActivity
. The MULTI_THREADED
define encapsulates the code that shows how the VrApi can be integrated into an engine with a separate renderer thread. - VrCubeWorld_Vulkan uses the Android NativeActivity class similar to VrCubeWorld_NativeActivity. The difference is that it provides an example of how to integrate the VrApi into an existing Vulkan-based engine. This sample includes examples of Vulkan Fixed Foveated Rendering (FFR), multiview, and MSAA usage.
- VrCubeworld_Framework shows how to implement the scene using the SampleFramework.
- VrSampleBase: Demonstrates minimal use of the SampleFramework to create an Android app.
- VrHands: Demonstrates how to use hand tracking to drive simple pointer-based input and provide visual feedback for hand meshes and simple skinning.
How to Build a Sample App
Use one of the following methods to install the sample media on your mobile device.
- Use the supplied script.
- Connect to the device via USB.
- Ensure you have permissions to transfer files to the device.
- Run
installtophone.bat
from your Oculus Mobile SDK directory (e.g., C:\Dev\Oculus\Mobile\installToPhone.bat
).
- Use an ADB command.
- Connect to the device via USB.
- Ensure you have permissions to transfer files to the device.
- Issue the following commands from your development folder (e.g.,
C:\Dev\Oculus\Mobile\
).
adb push sdcard\_SDK /sdcard/
- Connect to the device via USB.
- Ensure you have permissions to transfer files to the device.
- Transfer the contents of the sample media folder (e.g.,
\Dev\Oculus\Mobile\sdcard\_SDK\oculus\
) to the mobile device location (e.g., \MobileDevice\Phone\Oculus\
).