Oculus Go Development

On 6/23/20 Oculus announced plans to sunset Oculus Go. Information about dates and alternatives can be found in the Oculus Go introduction.

Oculus Quest Development

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible. For additional information and context, please see Submitting Your App to the Oculus Quest Store.

Set Up for Platform Development with Native Apps

This guide will walk you through the basics of setting up your development environment, initializing the platform, and checking the user’s entitlement.

The Sample Apps are available as reference when implementing the steps on this page.

Prerequisites

Before you can integrate the Platform SDK, you’ll need to create an app, and have the associated App ID. To create an app see the information on the Creating and Managing Apps page.

When you have created your app, visit the Dashboard API page and choose your app or on developer.oculus.com under Manage > App Name, select Getting Started API. The App ID will display in the middle of the screen, You’ll need your App ID to call the initialization APIs described in the next few sections. The following image shows an example of where to find the App ID.

Configure Your Development Environment

The steps to configure your environment will be different depending on the type of app you’re building. Follow the steps for the app you’re building.

Configure Your Development Environment for Rift

Note: The steps in this section are only if you’re creating a Rift app.

Configuring Visual Studio for your Rift project is the first step in integrating the Oculus Platform SDK. Use the following steps to configure Visual Studio for Rift development. You will need to add the path to the Include directory and the platform SDK libraries, and change a couple of settings. In addition, the SDK download provides a loader that enables DLL signature verification and graceful detection of the Oculus Runtime. To configure Visual Studio to use the platform SDK, complete the following steps:

  • Download the Platform SDK if you haven’t already.
  • Extract the contents of the download.
  • Open Visual Studio and create a new C++ console application, or open an existing project.
  • Right click the project and select Properties.
  • Configure the path to the header files. To do this, under C/C++ > General, find Additional Include Directories, and select <Edit...>. Navigate to and select the platform SDK include directory [platform-sdk-extraction-dir]/OVRPlatformSDK_v1.28.0/Include.

Change the settings to not use precompiled headers and the mode to permissive. To do this:

  • Under C/C++ > All Options, find the Conformance mode entry and change the setting to No.
  • Find the Precompiled Headers entry, and use the drop-down to change the setting to Not Using Precompiled Headers.

Next, configure the linker and the platform loader. To do this:

  • Under Linker > General, find Additional Library Directories. Select <Edit...>. In the dialog, click the New Folder icon and add [platform-sdk-extraction-dir]/OVRPlatformSDK_v1.28.0/Windows to the list.
  • Configure additional dependencies by choosing Linker > Input. Under Additional Dependencies, click <Edit...> and add the name of the loader library, LibOVRPlatform32_1.lib or LibOVRPlatform64_1.lib, depending on whether your project is 32 or 64 bit.
  • Add the cpp loader file [platform-sdk-extraction-dir]/Windows/OVR_PlatformLoader.cpp to your project. To do this, select your project, right click and select Add Existing Item. Navigate to the platform loader project and select it.

Finally, add the platform include statement, #include "OVR_platform.h", to main.cpp and compile your project. It should compile without errors.

Configure Your Development Environment for Mobile Development

Note: The steps in this section are only if you’re creating a mobile app.

Configuring Android Studio for your mobile project is the first step in integrating the Oculus Platform SDK for your mobile app. There are two SDKs that you need to apply in the SDK Manager, Tools / Android / SDK Manager.

  • The Oculus Platform SDK provides a loader that enables .so signature verification and graceful detection of the Oculus Runtime. To use the loader, add the SDK location to the manager ([InstallFolder]/Android/libs/armeabi-v7a/libovrplatformloader.so).
  • Then, add the Android NDK (found in the SDK Tools tab of the SDK Manager). The NDK is a set of tools that allows you to use C++ code on Android devices. The NDK also manages device activities and allows your app access to device sensors and inputs.

Configuring Your App for Local Development

The configuration steps in this section will allow developers to run local builds of the application during the development process. This process is required, otherwise local versions of the app will not pass the entitlement check that you’ll integrate below.

  • Add the user(s) to your org. See the Manage Your Organization and Users for information about managing your organization.
  • If some of your developers are not part of the application’s organization, and they need to run your application outside the normal install directory. Add the registry key AllowDevSideloaded as DWORD(1) to the registry folder at HKLM\SOFTWARE\Wow6432Node\Oculus\Oculus

This does not bypass having a valid entitlement, it just bypasses the directory check. Once the steps above are completed the entitlement check will succeed when running a local build of your application.

Initialize the SDK and Perform the Entitlement Check

The first step to integrating the SDK is implementing the initialization function, and next you should perform the entitlement check. For instructions on how to do this, see Entitlement Check.

Use the Platform in Standalone Mode

Standalone mode allows you to initialize the Platform SDK in test and development environments. Standalone mode is useful for testing Matchmaking where you can run multiple apps on the same box to test your integration. Initializing in standalone mode limits the SDK from connecting any locally running Oculus Service processes.

Note: Initializing in standalone mode uses a different set of credentials from the other initialization processes. When initializing in standalone mode, use your Oculus developer account email and password. To initialize the SDK in standalone mode, call ovr_Platform_InitializeStandaloneOculus with the OculusInitParams identified below.

OVRPL_PUBLIC_FUNCTION(ovrRequest)
  ovr_Platform_InitializeStandaloneOculus(
  const ovrOculusInitParams *params)
Where the ovrOculusInitParams are formed:

typedef struct
{
 ovrPlatformStructureType sType;
 const char *email;
 const char *password;
 ovrID appId;
 const char *uriPrefixOverride;
} ovrOculusInitParams;

The Init Param values are:

ParameterDescription
sTypeCredential struct type, must be: ovrPlatformStructureType_OculusInitParams
emailEmail address associated with Oculus account
passwordPassword for the Oculus account
appIDID of the application (the user must be entitled to this app)
uriPrefixOverrideOptional override for https://graph.oculus.com

Checking Errors

Sometimes things go wrong and you’ll want to know what happened. Checking the error code and message can provide insight to what happened. Some errors have an accompanying message that you can display to your users if the error results from their actions.

To check for an error:

With every request you make to the Oculus Platform, check to see if the message is an error by calling ovr_Message_IsError(). If the message is an error, then call ovr_Message_GetError() to retrieve the error object. The error object contains information you can use to debug the reason for the error:

  • ovr_Error_GetHttpCode() returns an http code for the request, such as 400 or 500.
  • ovr_Error_GetCode() returns a code representing the class of error. For example, all errors with 100 as the code are invalid parameter errors. Different errors may map to the same code. Review the error message for specifics of what went wrong. For example, an invalid id or missing required param would both return errors with 100 as the code.
  • ovr_Error_getMessage() returns a the raw error as a JSON string, which include the fields:
    • message: the description of the what went wrong and possibly how to debug/fix the issue.
    • code: It typically matches ovr_Error_GetCode, except in cases when there is a conflict in client/server code. Use the value from ovr_Error_GetCode instead.
    • fbtrace_id: Helpful for when you are contacting support. We use this internally to find more information about the failing request. ovr_Error_getDisplayableMessage() returns a message that you may optionally display to the user. It has none of the technical information obtained from ovr_Error_getMessage. An example displayable message could be You're not yet ranked on this leaderboard. if you are querying for the leaderboard of the app that the user has not been placed in. The value may be empty in the cases where it is a developer-caused error rather than a user-caused error.