Jump to content

In Unity Wave SDK, how do I execute eye calibration?


wzs

Recommended Posts

Hello, I am developing an app with Unity Wave SDK on "Focus 3 + Eye Tracker".

Is there a way to execute eye calibration when the user clicks a button in my app?

I cannot found related APIs in document or source code.

Thank you.

Link to comment
Share on other sites

To the best of my knowledge, I can use AndroidJavaObject to start the Wave built-in eye calibration Activity if I know the package name of the eye calibration Activity, like "com.htc.usercalibration.focus3". I guess.

Link to comment
Share on other sites

@wzs I'll have to double check this, but the package name is "vive.wave.vr.eye.calibration"

And launching an intent looks roughly like this (I'm not sure this is the right answer right now... but htere are several approaches to launching an app), which should take "vive.wave.vr.eye.calibration" as the parameter
 https://stackoverflow.com/questions/51460822/unity-android-intents

Link to comment
Share on other sites

  • 3 weeks later...
On 11/15/2022 at 5:17 PM, Alex_HTC said:

@wzs I'll have to double check this, but the package name is "vive.wave.vr.eye.calibration"

And launching an intent looks roughly like this (I'm not sure this is the right answer right now... but htere are several approaches to launching an app), which should take "vive.wave.vr.eye.calibration" as the parameter
 https://stackoverflow.com/questions/51460822/unity-android-intents

Hi, Alex. Still not works. 

Our code works well on Pico Neo 2 eye while invoking built-in eye calibration activity.

Does it need pass any parameter when trying to launch "vive.wave.vr.eye.calibration"?

 

Our code:

public static void OpenPackage(string pkgName)
        {
            using (AndroidJavaClass jcPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            {
                using (AndroidJavaObject joActivity = jcPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
                {
                    using (AndroidJavaObject joPackageManager = joActivity.Call<AndroidJavaObject>("getPackageManager"))
                    {
                        using (AndroidJavaObject joIntent = joPackageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", pkgName))
                        {
                            if (null != joIntent)
                            {
                                joActivity.Call("startActivity", joIntent);
                            }
                        }
                    }
                }
            }
        }
                  
       // invoke eye calibration      
       #if UNITY_ANDROID
        Utils.Android.OS.OpenPackage("vive.wave.vr.eye.calibration");
       #endif
                  
        

 

 I aslo add queries to AndroidManifest.xml

<queries>
        <package android:name="vive.wave.vr.eye.calibration" />
    </queries>

 

Link to comment
Share on other sites

  • 1 month later...

I have solved this problem.

For somebody who may need:

 

Quote
public void RunEyeCalibration()
{    using (AndroidJavaObject joActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity"))
    {
        try
        {
            AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent");
            intentObject.Call<AndroidJavaObject>("setClassName", "vive.wave.vr.eye.calibration", "com.htc.vr.unity.WVRUnityVRActivity");
            intentObject.Call<AndroidJavaObject>("setAction", "android.intent.action.MAIN");
            joActivity.Call("startActivity", intentObject);
        }
        catch (Exception e)
        {
            
        }
    }
}

 

Notice that the code like that

AndroidJavaObject joIntent = joPackageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", "vive.wave.vr.eye.calibration")

will not return the Intent correctly may caused by our apk have no permission to get the list of package name, it seems a little weird.

However, it worked for me when I manually created an Intent and used hard-coded calls to the eye calibration activity.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...