cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Oculus Entitlement - Not sure how to Implement

ShardNZL
Level 3
The app is approved on all counts - except lack of entitlement check. Have tried to follow the documentation but to be honest - i am bewildered (more arty than codey - lol). I've setup the whole "can see in local store" procedure but need a whole bunch of help writing the initial check routine. Am currently using Playmaker to surround the user initially with a black tube so the timing for a call is easy (aka pass the check the wall goes) just not sure how to write the check loop. Any help greatly appreciated ๐Ÿ™‚
And yes .... I dislike ppl who come onto forums and effectively ask someone else to do all the work for them too - lol. I promise I am the type to learn something along the way.
4 REPLIES 4

ShardNZL
Level 3
Finally figured it out (see below for those wanting the same thing) uploaded the new build, but when i go to play it never completes the check (I am in the test group and can see in home screen) any ideas?? .....


using UnityEngine;
using System;
using Oculus.Platform;
using HutongGames;

public class Initialise : MonoBehaviour {

void Start () {
Core.Initialize();
}

public void CheckApplicationEntitlement() {
Oculus.Platform.Entitlements.IsUserEntitledToApplication().OnComplete(IsUserEntitledToApplicationCallback);
}

void IsUserEntitledToApplicationCallback(Message msg){
if (msg.IsError){
// User is NOT entitled.
PlayMakerFSM.BroadcastEvent("Authno");
}
else{
// User IS entitled
PlayMakerFSM.BroadcastEvent("Authyes");
}
}

}

Chromega
Level 2
I think you also need an Update() function that executes:
Oculus.Platform.Request.RunCallbacks();

Everything else looks reasonable to me assuming the other classes not in this snippet are working.

delphinius81
Level 8
In the initial release of the Platform you had to make manually make the RunCallbacks call, but it's handled automatically now.

CryptoHexPirate
Level 3
Hey there!
I know this be an old thread but I have almost identical code.
My app is visible in the library, at which point according to Oculus docs, it should pass entitlement check automatically.
When I launch the app from Oculus library I get Entitlement check fail.
However Entitlement Checks passes when in stand alone build (Unity 5.6.1f1 or
5.6.2f1) using User Tokens as well as working in Unity Editor Play mode.
So this indicates it's likely not the code, which is relatively simple anyhow. As the code validates correctly in standalone and PIE (Play In Editor).
We've made a few submissions to Oculus builds already as the only way to test if this is fixed is to upload a new build to manage in dev dashboard, wait for Oculus library to update the app version, then launch too check entitlement.
Can anyone offer any insights on this issue?

CODE:
Excuse all the DI but basically it's the same code. My app calls more complex data from Oculus runtime regarding user profile etc so relatively this call seems simple and due to it displaying in library and working PIE it seems unlikely this is the culprit but here is CS code for anyone wanting context.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Oculus;
using Oculus.Platform;

public class OculusEntitlementCheck : MonoBehaviour {
   
    public GameObject extraNotice;
    public GameObject warningNotice;
    public GameObject enabler;
   
    // Use this for initialization
    void Start () {
        Oculus.Platform.Core.Initialize();
        Oculus.Platform.Entitlements.IsUserEntitledToApplication().OnComplete(CallbackMethod);
    }
   
    void CallbackMethod(Message msg){
        if (msg.IsError){
            // User is NOT entitled.
            StartCoroutine(WaitForWarningShow(msg));
        } else {
            // User IS entitled
            if(enabler!=null){
                enabler.SetActive(true);
            }
        }
    }
   
    IEnumerator WaitForWarningShow(Message msg){   
        if(warningNotice!=null){
            warningNotice.SetActive(true);
        }
        if(extraNotice!=null){
            extraNotice.GetComponent<Text>().text = ""+msg;
            extraNotice.SetActive(true);
        }
        yield return new WaitForSeconds(30);
        NowQuit();
    }
   
    void NowQuit(){
        UnityEngine.Application.Quit();
    }
}