Exemplo n.º 1
0
        void OnGUI()
        {
            beginColumn();

            if (GUILayout.Button("Initialize IAB"))
            {
                var key = "your public key from the Android developer portal here";
                key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmffbbQPr/zqRjP3vkxr1601/eKsXm5kO2NzQge8m7PeUj5V+saeounyL34U8WoZ3BvCRKbw6DrRLs2DMoVuCLq7QtJggBHT/bBSHGczEXGIPjWpw6OQb24EWM0PaTRTH2x2mC/X6RwIKcPLJFmy68T38Eh0DXnF4jjiIoaD0W8AYLjLzv0WvbIfgtJlvmmwvI2/Kta1LRnW3/Ggi5jb9UmXZAUIBz8kQtSH5FUCmFOQHMzekfg8rQ4VO1nlWhnB58UPwsxWt/DNyDfqv2VMeA2+VJG0fkiMl/6vWA7+ianVTU3owXcvxJHseEDUVYo1wEKfhK7ErGB7sxDJx5wHXAwIDAQAB";
                GoogleIAB.init(key);
            }


            if (GUILayout.Button("Query Inventory"))
            {
                // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
                var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.noads" };
                GoogleIAB.queryInventory(skus);
            }


            if (GUILayout.Button("Are subscriptions supported?"))
            {
                Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
            }


            if (GUILayout.Button("Purchase Test Product"))
            {
                GoogleIAB.purchaseProduct("android.test.purchased");
            }


            if (GUILayout.Button("Consume Test Purchase"))
            {
                GoogleIAB.consumeProduct("android.test.purchased");
            }


            if (GUILayout.Button("Test Unavailable Item"))
            {
                GoogleIAB.purchaseProduct("android.test.item_unavailable");
            }


            endColumn(true);


            if (GUILayout.Button("Purchase Real Product"))
            {
                GoogleIAB.purchaseProduct("com.prime31.testproduct", "payload that gets stored and returned");
            }


            if (GUILayout.Button("Purchase Real Subscription"))
            {
                GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
            }


            if (GUILayout.Button("Consume Real Purchase"))
            {
                GoogleIAB.consumeProduct("com.prime31.testproduct");
            }


            if (GUILayout.Button("Enable High Details Logs"))
            {
                GoogleIAB.enableLogging(true);
            }


            if (GUILayout.Button("Consume Multiple Purchases"))
            {
                var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
                GoogleIAB.consumeProducts(skus);
            }

            endColumn();
        }
Exemplo n.º 2
0
        void OnGUI()
        {
            beginColumn();

            if (GUILayout.Button("Initialize IAB"))
            {
                var key = "your public key from the Android developer portal here";
                key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmffbbQPr/zqRjP3vkxr1601/eKsXm5kO2NzQge8m7PeUj5V+saeounyL34U8WoZ3BvCRKbw6DrRLs2DMoVuCLq7QtJggBHT/bBSHGczEXGIPjWpw6OQb24EWM0PaTRTH2x2mC/X6RwIKcPLJFmy68T38Eh0DXnF4jjiIoaD0W8AYLjLzv0WvbIfgtJlvmmwvI2/Kta1LRnW3/Ggi5jb9UmXZAUIBz8kQtSH5FUCmFOQHMzekfg8rQ4VO1nlWhnB58UPwsxWt/DNyDfqv2VMeA2+VJG0fkiMl/6vWA7+ianVTU3owXcvxJHseEDUVYo1wEKfhK7ErGB7sxDJx5wHXAwIDAQAB";

                //"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwoEtQFcqjLFQJ0wXu8mkFjowH8t4I7tcG1G6Ais7Vx8qZWYidwNPzdp2pvPCQS4/BZDgtRyk1+FsPbaCOndof2e4OlVmdlGUXVQOtJl5hT40xxmlotliBG9IzO1A5Huvy0tjv2pQ6Et0g72k1qxJPFI1O/L7mzQDHPzawYEqHv47U/yGD1GTE6jHK0u1apgxUI89UJsiYIhVlwdZ40390LGWAR8+LrUhk+q//NYjxfKBd3fotgV4QZecNPQks1fz9bk5oWOwOpOz2pQ3aZ62RInlueAk8ttsfow6+M4rmdfBDVGOkVKgScwhBjeCAcsXQaO+qwWdr1GhLPNuYck39wIDAQAB";
                GoogleIAB.init(key);
            }


            if (GUILayout.Button("Query Inventory"))
            {
                // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
                var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
                GoogleIAB.queryInventory(skus);
            }


            if (GUILayout.Button("Are subscriptions supported?"))
            {
                Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
            }


            if (GUILayout.Button("Purchase Test Product"))
            {
                GoogleIAB.purchaseProduct("android.test.purchased");
            }


            if (GUILayout.Button("Consume Test Purchase"))
            {
                GoogleIAB.consumeProduct("android.test.purchased");
            }


            if (GUILayout.Button("Test Unavailable Item"))
            {
                GoogleIAB.purchaseProduct("android.test.item_unavailable");
            }


            endColumn(true);


            if (GUILayout.Button("Purchase Real Product"))
            {
                GoogleIAB.purchaseProduct("com.prime31.testproduct", "payload that gets stored and returned");
            }


            if (GUILayout.Button("Purchase Real Subscription"))
            {
                GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
            }


            if (GUILayout.Button("Consume Real Purchase"))
            {
                GoogleIAB.consumeProduct("com.prime31.testproduct");
            }


            if (GUILayout.Button("Enable High Details Logs"))
            {
                GoogleIAB.enableLogging(true);
            }


            if (GUILayout.Button("Consume Multiple Purchases"))
            {
                var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
                GoogleIAB.consumeProducts(skus);
            }

            endColumn();
        }