Search code examples
unity-game-enginevirtual-realityoculusgear-vr

Oculus entitlement gear vr


I am developing a game for Gear VR in Unity 5.6.1p1 with Oculus Utils 1.9.0. It is on technical review now on developer console. However I keep getting entitlement error even after adding it to the project.

Here is their explanation:

It appears that your app does not support entitlement checks to prevent unauthorized use of your content. Documentation on how to add entitlement checks can be found here: https://developer.oculus.com/documentation/platform/latest/concepts/pgsg-get-started-with-sdk/

And here is my entitlement code:

public class PlatformManager : MonoBehaviour
{
    public static bool entitled = false;
    private static PlatformManager s_instance;
    private ulong m_myID;

    private string m_myOculusID;

    void Awake()
    {
        if(s_instance != null)
        {
            Destroy(gameObject);
            return;
        }
        s_instance = this;
        DontDestroyOnLoad(gameObject);
        Core.Initialize();
    }

    private void Start()
    {
        entitled = false;
        Entitlements.IsUserEntitledToApplication().OnComplete(IsEntitledCallback);
    }

    void IsEntitledCallback(Message msg)
    {
        if(msg.IsError)
        {
            entitled = false;
            TerminateWithError(msg);
            return;
        }
        entitled = true;
        Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
    }

    public static void TerminateWithError(Message msg)
    {
        Debug.Log("Error: " + msg.GetError().Message);
        UnityEngine.Application.Quit();
    }

    void GetLoggedInUserCallback(Message<User> msg)
    {
        if(msg.IsError)
        {
            TerminateWithError(msg);
            return;
        }

        m_myID = msg.Data.ID;
        m_myOculusID = msg.Data.OculusID;
    }
}

I am not doing anything with ID after entitling. Should I do something? Is there a mistake in my code? I do get true value after entitling.


Solution

  • My app has passed entitlement check and techical review. The code was good, but I had to add a message to let the user know that he is not entitled, and then exit the app.