Esempio n. 1
0
        public static void JavaRequestPurchaseAsync(Purchasable purchasable)
        {
#if UNITY_ANDROID && !UNITY_EDITOR && !UNITY_STANDALONE_OSX && !UNITY_STANDALONE_WIN && !UNITY_STANDALONE_LINUX
            // again, make sure the thread is attached..
            AndroidJNI.AttachCurrentThread();

            AndroidJNI.PushLocalFrame(0);

            try
            {
                Debug.Log(string.Format("JavaRequestPurchaseAsync purchasable: {0}", purchasable.getProductId()));

                using (AndroidJavaClass ajc = new AndroidJavaClass(JAVA_CLASS))
                {
                    ajc.CallStatic <String>("requestPurchaseAsync", new object[] { purchasable.getProductId() + "\0" });
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(string.Format("OuyaSDK.JavaRequestPurchaseAsync exception={0}", ex));
            }
            finally
            {
                AndroidJNI.PopLocalFrame(IntPtr.Zero);
            }
#endif
        }
Esempio n. 2
0
        public static void JavaAddGetProduct(Purchasable purchasable)
        {
#if UNITY_ANDROID && !UNITY_EDITOR && !UNITY_STANDALONE_OSX && !UNITY_STANDALONE_WIN && !UNITY_STANDALONE_LINUX
            // again, make sure the thread is attached..
            AndroidJNI.AttachCurrentThread();

            AndroidJNI.PushLocalFrame(0);

            try
            {
                Debug.Log(string.Format("{0} OuyaSDK.JavaAddGetProduct", DateTime.Now));

                using (AndroidJavaClass ajc = new AndroidJavaClass(JAVA_CLASS))
                {
                    ajc.CallStatic("addGetProduct", purchasable.getProductId());
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(string.Format("OuyaSDK.JavaAddGetProduct exception={0}", ex));
            }
            finally
            {
                AndroidJNI.PopLocalFrame(IntPtr.Zero);
            }
#endif
        }