Entitlement Checks

One of the requirements to sell an app in the Oculus Store is that you verify the user purchased or obtained your app legitimately. This check is called the entitlement check. You should make the entitlement check within 10 seconds of the user launching your app. For App Lab applications, an Entitlement Check is not required. 

 

For Unity applications, the simplest way to implement an Entitlement Check is to attach the following code snippet to an empty Game Object in your first loaded scene. You can create a new script and copy the following, or find EntitlementCheck.cs in the Oculus Integration SDK. 

 

EntitlementCheck.cs

using UnityEngine;
using Oculus.Platform;

public class AppEntitlementCheck: MonoBehaviour {

  void Awake ()
  {
    try
    {
      Core.AsyncInitialize();
      Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementCallback);
    }
    catch(UnityException e)
    {
      Debug.LogError("Platform failed to initialize due to exception.");
      Debug.LogException(e);
      // Immediately quit the application.
      UnityEngine.Application.Quit();
    }
  }


  // Called when the Oculus Platform completes the async entitlement check request and a result is available.
  void EntitlementCallback (Message msg)
  {
    if (msg.IsError) // User failed entitlement check
    {
      // Implements a default behavior for an entitlement check failure -- log the failure and exit the app.
      Debug.LogError("You are NOT entitled to use this app.");
      UnityEngine.Application.Quit();
    }
    else // User passed entitlement check
    {
      // Log the succeeded entitlement check for debugging.
      Debug.Log("You are entitled to use this app.");
    }
  }
}

 

How to Test the Entitlement Check:

1. First, you'll need to Enable Developer Mode

  1. Turn on your Oculus Quest device and open the Oculus application on your phone.

  2. Tap Menu in the lower right corner.

  3. Select Devices, choosing the appropriate device from the drop-down, and allow your Oculus application to connect to your device.

  4. Once connected, scroll down to find Developer Settings and then toggle Developer Mode ON.

NOTE: You may need to restart your headset after doing these steps. Once done, there will be a new option in your headset library called “Unknown Sources”.

 

2. After enabling Developer Mode, you'll be able to test the Entitlement Check.

  1. Replace your App ID within Unity with a random string of numbers.

  2. Launch the app.

  3. If the entitlement check results in a failure, and shows an error message in the console to the end user or enters a limited demo mode, then the check is successful for the failure case. 

  4. Replace the App ID with the correct App ID obtained from the Developer Dashboard
  5. Launch the app again. 
  6. If the entitlement check results in a success, then the check is successful for the passing case.

As the creator of your application, you have the "Entitlement" to your application. If you log out, and log into another Oculus account that has not purchase the application (and is not a member of the org associated with the app), the entitlement check should fail and result in a failed app launch. 

 

For the full Documentation and further Resources, follow the links below:

Unity: https://developer.oculus.com/documentation/unity/ps-entitlement-check/

Unreal: https://developer.oculus.com/documentation/unreal/ps-entitlement-check/ 

Native: https://developer.oculus.com/documentation/native/ps-entitlement-check/ 

 

 

Was this article helpful?

7 out of 21 found this helpful .