public void onRewardLoaded(string msg) { updateStatusUI("Rewarded Ad Winner: " + ChocolateUnityBridge.GetRewardAdWinner()); //reward ad is ready! You can display now, or you can wait until a later time. showRewardAd(); }
public void buttonRequestRewardClicked() //Reward Ad Button Request Clicked { Debug.Log("Button Request Reward Clicked..."); ChocolateUnityBridge.setDemograpics(23, "23/11/1990", "m", "single", "Asian"); ChocolateUnityBridge.setLocation("999", "123123", "321321", latitude, longitude); ChocolateUnityBridge.setAppInfo("UnityDemo", "Vdopia", "unity-demo.com", "vdopia.com", "", "Movie"); ChocolateUnityBridge.loadRewardAd(); }
private void Start() { log("Start"); //ChocolateUnityBridge.SetAdRequestTestMode(true, "xxxxxxxx"); //OPTIONAL TEST MODE //appInfo is mandatory. However, ads can still be fetched. ChocolateUnityBridge.setAppInfo("MyAppName", "MyPublisherName", "MyDomainName", "PublisherDomain", "MyPlayStoreUrl", "My IAB Category"); //OPTIONAL: Ad Request User Parameters //ChocolateUnityBridge.SetAdRequestUserParams(18, "", "M", "Single", "Asian", "", "", "", "", ""); ChocolateUnityBridge.initWithAPIKey("XqjhRR"); //Our test key. Replace with yours in production. ChocolateUnityBridge.setInterstitialAdListener(this); ChocolateUnityBridge.setRewardAdListener(this); }
void SetupListener() { // ChocolateUnityBridge.setupWithListener("Canvas"); ChocolateUnityBridge.setInterstitialAdListener(this); ChocolateUnityBridge.setRewardAdListener(this); listenerSetup = true; //Debug.Log("Listener info:"); //Debug.Log("" + this.ToString() + " | " + // this.name + " | " + // this.tag + " | " + // this.gameObject.ToString() + " | " + // this.gameObject.tag); }
public void YesClicked() { Debug.Log("Yes Clicked..."); AlertCanvas.enabled = false; ButtonSetup("reward", false); // isRewardLoaded = false; // // buttonLoadReward.interactable = true; // buttonShowReward.interactable = false; //Parma 1 : Secret Key (Get it from Vdopia Portal : Required if server-to-server callback enabled) //Parma 2 : User name //Param 3 : Reward Name or measure //Param 4 : Reward Amount or quantity ChocolateUnityBridge.showRewardAd(30, "coin", "Chocolate1", "XNydpzNLIj2pBRM8"); }
private void showRewardAd() //called when btnShowReward Clicked { log("Show Reward Ad..."); ChocolateUnityBridge.showRewardAd(30, "coins", "", "qwer1234"); }
//===============Rewarded Video Ad Methods=============== public void loadRewardAd() //called when btnRequestReward Clicked { log("Request Reward Ad..."); //can take anywhere from 0 to 7 seconds ChocolateUnityBridge.loadRewardAd(); }
private void showInterstitialAd() //called when btnShowInterstitial Clicked { log("Show Interstitial Ad..."); ChocolateUnityBridge.showInterstitialAd(); }
//===============Interstitial Ad Methods=============== public void loadInterstitialAd() //called when btnLoadInterstitial Clicked { log("Load Interstitial Ad..."); ChocolateUnityBridge.loadInterstitialAd(); }
public void onInterstitialLoaded(string msg) { //interstitial ad is ready! You can display now, or you can wait until a later time. updateStatusUI("Interstitial Ad Winner: " + ChocolateUnityBridge.GetInterstitialAdWinner()); showInterstitialAd(); }
//Be sure to unRegister before loading a new scene. private void unRegisterAdListener() { ChocolateUnityBridge.removeRewardAdListener(); ChocolateUnityBridge.removeInterstitialAdListener(); }
public void buttonShowInterstitialClicked() //Interstitial Ad Button Show Clicked { Debug.Log("Button Show Interstitial Clicked..."); ChocolateUnityBridge.showInterstitialAd(); }
IEnumerator Start() { Screen.fullScreen = false; //Disable Fullscreen App AlertCanvas.enabled = false; GUITextMessage.enabled = false; string apiKey = ""; #if UNITY_IOS apiKey = "X4mdFv"; #endif #if UNITY_ANDROID apiKey = "XqjhRR"; #endif ChocolateUnityBridge.initWithAPIKey(apiKey); ChocolateUnityBridge.SetAdRequestTestMode(true, "dinosaur"); ChocolateUnityBridge.setPrivacySettings( true, //whether GDPR applies null //consent string in format defined by IAB, or null if no consent was obtained ); // First, check if user has location service enabled if (!Input.location.isEnabledByUser) { yield break; } // Start service before querying location Input.location.Start(); // Wait until service initializes int maxWait = 20; while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) { yield return(new WaitForSeconds(1)); maxWait--; } // Service didn't initialize in 20 seconds if (maxWait < 1) { print("Timed out"); yield break; } // Connection has failed if (Input.location.status == LocationServiceStatus.Failed) { print("Unable to determine device location"); yield break; } else { // Access granted and location value could be retrieved latitude = string.Format("{0:N3}", Input.location.lastData.latitude); longitude = string.Format("{0:N3}", Input.location.lastData.longitude); print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp); } // Stop service if there is no need to query location updates continuously Input.location.Stop(); }