wzs Posted November 15, 2022 Share Posted November 15, 2022 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 More sharing options...
wzs Posted November 15, 2022 Author Share Posted November 15, 2022 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 More sharing options...
Alex_HTC Posted November 15, 2022 Share Posted November 15, 2022 @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 More sharing options...
wzs Posted November 30, 2022 Author Share Posted November 30, 2022 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 More sharing options...
wzs Posted January 5, 2023 Author Share Posted January 5, 2023 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 More sharing options...
Rodenstock-VR-Lab Posted 8 hours ago Share Posted 8 hours ago We are struggling with the same issue and have tried the code proposed by WZS: 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) { } } } However we get the following Android Error: Quote Error Unity AndroidJavaException: android.content.ActivityNotFoundException: Unable to find explicit activity class {vive.wave.vr.eye.calibration/com.htc.vr.unity.WVRUnityVRActivity}; have you declared this activity in your AndroidManifest.xml? Obviously we have to update our AndroidManifest accordingly, but we can't get it to work, currently it looks like that (this is the standard manifest included in the Wave SDK) <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools"> <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@style/Theme.WaveVR.Black" tools:replace="android:theme"> <!--You can use your theme here.--> <activity android:name="com.htc.vr.unity.WVRUnityVRActivity" android:exported="true" android:label="@string/app_name" android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:enableVrMode="@string/wvr_vr_mode_component"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="com.htc.intent.category.VRAPP" /> </intent-filter> <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" /> </activity> </application> <uses-feature android:name="wave.feature.handtracking" android:required="true" /> <uses-feature android:name="wave.feature.eyetracking" android:required="true" /> </manifest> @wzs Can you please show us the Manifest you used along your proposed code? @Alex_HTC Can you have a look as well? you indicated that vive.wave.vr.eye.calibration is the correct package name, but can you show us how to configure the AndroidManifest, and confirm us whether the code above is the right way to call-it? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now