Hollowhead Posted April 10, 2019 Author Share Posted April 10, 2019 Yes, it was helpful, and I think I correctly implemented the code for the app to quit when it hits onfailure as Yaking suggested, but he didn't suggest anything further. I do not know when this would occur in a real situation so I have no way of testing it. I don't know how a reviewer would test the apk. using System.Collections;using System.Collections.Generic;using UnityEngine;using Viveport;public class VivePortDRMChecker : MonoBehaviour{ static string VIVEPORT_ID = ""; static string VIVEPORT_KEY = ""; // Use this for initialization void Start() { Api.Init(InitStatusHandler, VIVEPORT_ID); } private static void InitStatusHandler(int nResult) { Viveport.Core.Logger.Log("Init(): " + nResult); if (nResult != 0) { Viveport.Core.Logger.Log("Init setup error ..."); // Handle error Api.Shutdown(ShutdownHandler); } Api.GetLicense(new MyLicenseChecker(), VIVEPORT_ID, VIVEPORT_KEY); } class MyLicenseChecker : Api.LicenseChecker { public override void OnSuccess(long issueTime, long expirationTime, int latestVersion, bool updateRequired) { Viveport.Core.Logger.Log("[MyLicenseChecker] issueTime: " + issueTime); Viveport.Core.Logger.Log("[MyLicenseChecker] expirationTime: " + expirationTime); Viveport.Core.Logger.Log("[MyLicenseChecker] latestVersion: " + latestVersion); Viveport.Core.Logger.Log("[MyLicenseChecker] updateRequired: " + updateRequired); // Do more things } public override void OnFailure(int errorCode, string errorMessage) { Viveport.Core.Logger.Log("[MyLicenseChecker] errorCode: " + errorCode); Viveport.Core.Logger.Log("[MyLicenseChecker] errorMessage: " + errorMessage); Api.Shutdown(ShutdownHandler); } } private static void ShutdownHandler(int nResult) { Viveport.Core.Logger.Log("Shutdown(): " + nResult); if (nResult != 0) { // Handle error Viveport.Core.Logger.Log("Shutdown error ..."); Application.Quit(); } // Do something // Do more things Application.Quit(); } } Should I submit this code as is? Is there anybody at HTC that ...like...knows how to do this and confirm this is the approach I should take? Telling me what I'm doing wrong is sort of helpful. I want to know how to do it right and the documentation is pretty sparse. The documentation presents a half-finished example: https://developer.viveport.com/documents/sdk/en/api_drm.html Link to comment Share on other sites More sharing options...
Hollowhead Posted April 10, 2019 Author Share Posted April 10, 2019 Yes, I received your e-mail. told me what I was doing wrong but did not offer any suggestions. The documentation is sparse, but I think I stumbled my way through to the solution. I implemented the code as follows: using System.Collections;using System.Collections.Generic;using UnityEngine;using Viveport;public class VivePortDRMChecker : MonoBehaviour{ static string VIVEPORT_ID = ""; static string VIVEPORT_KEY = ""; // Use this for initialization void Start() { Api.Init(InitStatusHandler, VIVEPORT_ID); } private static void InitStatusHandler(int nResult) { Viveport.Core.Logger.Log("Init(): " + nResult); if (nResult != 0) { Viveport.Core.Logger.Log("Init setup error ..."); // Handle error Api.Shutdown(ShutdownHandler); } Api.GetLicense(new MyLicenseChecker(), VIVEPORT_ID, VIVEPORT_KEY); } class MyLicenseChecker : Api.LicenseChecker { public override void OnSuccess(long issueTime, long expirationTime, int latestVersion, bool updateRequired) { Viveport.Core.Logger.Log("[MyLicenseChecker] issueTime: " + issueTime); Viveport.Core.Logger.Log("[MyLicenseChecker] expirationTime: " + expirationTime); Viveport.Core.Logger.Log("[MyLicenseChecker] latestVersion: " + latestVersion); Viveport.Core.Logger.Log("[MyLicenseChecker] updateRequired: " + updateRequired); // Do more things } public override void OnFailure(int errorCode, string errorMessage) { Viveport.Core.Logger.Log("[MyLicenseChecker] errorCode: " + errorCode); Viveport.Core.Logger.Log("[MyLicenseChecker] errorMessage: " + errorMessage); Api.Shutdown(ShutdownHandler); } } private static void ShutdownHandler(int nResult) { Viveport.Core.Logger.Log("Shutdown(): " + nResult); if (nResult != 0) { // Handle error Viveport.Core.Logger.Log("Shutdown error ..."); Application.Quit(); } // Do something // Do more things Application.Quit(); } } I don't know if this is accurate. I don't know how to test it to make it fail. When I tried to make it fail by putting the wrong key in I received a strange error message and the app failed to shutdown. I suspect my test is not the proper way to test the failure. Should I submit the apk with the code above? Is there anyone at HTC that can provide further guidance? Thank you. Link to comment Share on other sites More sharing options...
Codest Posted April 29, 2019 Share Posted April 29, 2019 Hey I also get these errors when trying to test failure. Is it normal behaviour? Should it be submitted as is? Link to comment Share on other sites More sharing options...
yakingkuo1 Posted May 1, 2019 Share Posted May 1, 2019 Hello , Could you show me the errors you get? -Yaking Link to comment Share on other sites More sharing options...
Codest Posted May 1, 2019 Share Posted May 1, 2019 Thanks for the response Here's my error: E/Unity: AndroidJavaException: java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0c0000af:ASN.1 encoding routines:OPENSSL_internal:TOO_LONG java.lang.IllegalArgumentException: java.security.spec.InvalidKeySpecException: java.lang.RuntimeException: error:0c0000af:ASN.1 encoding routines:OPENSSL_internal:TOO_LONG at com.htc.store.licensing._LicenseChecker.generatePublicKey(LicenseChecker.java:383) at com.htc.store.licensing._LicenseChecker.<init>(LicenseChecker.java:351) at com.htc.store.licensing.LicenseChecker.<init>(LicenseChecker.java:63) at com.htc.store.licensing.ViveportSDK_DRM_Adapter.getLicense(ViveportSDK_DRM_Adapter.java:72) at com.htc.viveport.Api.getLicense(Api.java:60) at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method) at com.unity3d.player.ReflectionHelper.a(Unknown Source) at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source) at java.lang.reflect.Proxy.invoke(Proxy.java:813) at $Proxy6.onResult(Unkno... Link to comment Share on other sites More sharing options...
yakingkuo1 Posted May 2, 2019 Share Posted May 2, 2019 Hello , Could you show me your code snippet for GetLicense part? -Yaking Link to comment Share on other sites More sharing options...
Codest Posted May 2, 2019 Share Posted May 2, 2019 Hey ,Sure, here are the parts connected to GetLicense. As you can see I call Init in Awake(), then upon success I call GetLicense in InitStatusHandler() using LicenseChecker.I get the same error on the account that the app is on and a different account that shouldn't have a license. And I'm using the correct app id and app key because I have IAP working properly. private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); mListener = new Result(); Api.Init(InitStatusHandler, IAP_APP_ID); } private static void InitStatusHandler(int nResult) { instance.Log("InitStatusHandler: " + nResult); if (nResult != 0) { Viveport.Core.Logger.Log("Init setup error ..."); // Handle error Api.Shutdown(ShutdownStatusHandler); } Api.GetLicense(new LicenseChecker(), IAP_APP_ID, IAP_APP_KEY); } class LicenseChecker : Api.LicenseChecker { public override void OnSuccess(long issueTime, long expirationTime, int latestVersion, bool updateRequired) { instance.Log("[MyLicenseChecker] issueTime: " + issueTime); instance.Log("[MyLicenseChecker] expirationTime: " + expirationTime); instance.Log("[MyLicenseChecker] latestVersion: " + latestVersion); instance.Log("[MyLicenseChecker] updateRequired: " + updateRequired); // Do more things } public override void OnFailure(int errorCode, string errorMessage) { instance.Log("[MyLicenseChecker] errorCode: " + errorCode); instance.Log("[MyLicenseChecker] errorMessage: " + errorMessage); //Application.Quit(); } } Link to comment Share on other sites More sharing options...
Codest Posted May 9, 2019 Share Posted May 9, 2019 Hi , Just wondering if there was an update on this? This is the only thing we are waiting on for submission, so any help is appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.