コード例 #1
0
    void OnGUI()
    {
        // Make a background box
        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Gree Ads Reward Sample");

        if (GUI.Button(new Rect(35, 100, Screen.width - 70, 100), "OfferWall"))
        {
            // Show Offerwall
            // オファーウォールを表示する
            GreeAdsReward.showOfferwall(this.info().mediaID, "identifier");
        }

        if (GUI.Button(new Rect(35, 250, Screen.width - 70, 100), "Interstitial"))
        {
            //  shwo interstitial ads.
            // インタースティシャル広告を表示する
            GreeAdsReward.showInterstitial(this.info().mediaID, "identifier", CampaignType.XPROMOTION, "Main Camera");
        }

#if UNITY_ANDROID
        if (GUI.Button(new Rect(35, 400, Screen.width - 70, 100), "send Action"))
        {
            // send achieve(conversion) info
            // 成果通信
            string campaignId    = this.info().campaignID.Trim();
            string advertisement = this.info().advertisement.Trim();
            string urlScheme     = this.info().url_scheme.Trim();
            Debug.Log("campaignId: " + campaignId);
            Debug.Log("advertisement: " + advertisement);
            Debug.Log("urlScheme: " + urlScheme);

            Debug.Log("Call Android function");
            using (AndroidJavaClass javaCalss = new AndroidJavaClass("com.kddi.alml.AlmlLicensePlugin")) {
                bool loginResult = javaCalss.CallStatic <bool> ("showLoginResult");
                Debug.Log("Login Result: " + loginResult);

                if (!loginResult)
                {
                    // Close the application if login has failed.
                    Application.Quit();
                }
            }
            int randomId = Random.Range(0, 100);
            GreeAdsReward.sendAction(this.info().campaignID.Trim(), this.info().advertisement.Trim(), this.info().url_scheme.Trim(), "sample_identifier_" + randomId.ToString());
        }
#endif

#if UNITY_IPHONE
        if (GUI.Button(new Rect(35, 400, Screen.width - 70, 100), "send Action for iOS"))
        {
            // send achieve(conversion) info
            // 成果通信
            GreeAdsReward.sendAction(this.info().campaignID.Trim(), this.info().advertisement.Trim());
        }
#endif
    }
コード例 #2
0
    private void performSupershipSDKAction()
    {
        GreeAdsReward.setAppInfo(this.info().siteId.Trim(), this.info().siteKey.Trim(), this.info().useSandbox);
        GreeAdsReward.setDevMode(true);

        // Trigger sendAction() call with deviceUniqueIdentifier.
        // string uniqueId = SystemInfo.deviceUniqueIdentifier;
        int randomId = Random.Range(1, 999999);

        GreeAdsReward.sendAction(this.info().campaignID.Trim(), this.info().advertisement.Trim(), this.info().url_scheme.Trim(), "identifier" + randomId);
    }