void onVdopiaEventReceiver(string adType, string eventName) //Ad Event Receiver { Debug.Log("Ad Event Received : " + eventName + " : For Ad Type : " + adType); if (adType.Equals(VdopiaPlugin.INTERSTITIAL_AD_TYPE)) { if (eventName.Equals(VdopiaPlugin.INTERSTITIAL_AD_LOADED)) { Debug.Log("INTERSTITIAL_AD_LOADED..."); } if (eventName.Equals(VdopiaPlugin.INTERSTITIAL_AD_FAILED)) { Debug.Log("INTERSTITIAL_AD_FAILED..."); } if (eventName.Equals(VdopiaPlugin.INTERSTITIAL_AD_SHOWN)) { Debug.Log("INTERSTITIAL_AD_SHOWN..."); plugin.PrefetchInterstitialAd("EnP5f4"); } if (eventName.Equals(VdopiaPlugin.INTERSTITIAL_AD_CLICKED)) { Debug.Log("INTERSTITIAL_AD_CLICKED..."); } if (eventName.Equals(VdopiaPlugin.INTERSTITIAL_AD_DISMISSED)) { Debug.Log("INTERSTITIAL_AD_DISMISSED..."); } } }
//This is your defined ad event receiver; invoked after you //call loadInterstitialAd() or loadRewardAd() which are defined below. void onVdopiaEventReceiver(string adType, string eventName) //Ad Event Receiver { Debug.Log("Ad Event Received : " + eventName + " : For Ad Type : " + adType); if (eventName == "INTERSTITIAL_LOADED") { showInterstitialAd(); } else if (eventName == "INTERSTITIAL_FAILED") { } else if (eventName == "INTERSTITIAL_SHOWN") { } else if (eventName == "INTERSTITIAL_DISMISSED") { //New! Optional. Silently pre-fetch the next interstitial ad without making //any callbacks. The pre-fetched ad will remain in cache until you call //the next LoadInterstitialAd. //feel free to use our test app key 'XqjhRR' chocoPlugin.PrefetchInterstitialAd("XqjhRR"); } else if (eventName == "INTERSTITIAL_CLICKED") { } else if (eventName == "REWARD_AD_LOADED") { showRewardAd(); } else if (eventName == "REWARD_AD_FAILED") { } else if (eventName == "REWARD_AD_SHOWN") { } else if (eventName == "REWARD_AD_SHOWN_ERROR") { } else if (eventName == "REWARD_AD_DISMISSED") { //Pre-fetch: Silently pre-fetch the next reward ad without making //any callbacks. The pre-fetched ad will remain in cache until you call //the next LoadRewardAd. //feel free to use our test app key 'XqjhRR' chocoPlugin.PrefetchRewardAd("XqjhRR"); } else if (eventName == "REWARD_AD_COMPLETED") { //If you setup server-to-server (S2S) rewarded callbacks you can //assume your server url will get hit at this time. //Or you may choose to reward your user from the client here. } }
public void showInterstitial() //called when btnShowInterstitial Clicked { Debug.Log("Show Interstitial..."); if (Application.platform == RuntimePlatform.Android && plugin != null) { //Make sure Interstitial Ad is loaded before call this method plugin.ShowInterstitialAd(); //New! Optional. Silently pre-fetch the next interstitial ad without making //any callbacks. The pre-fetched ad will remain in cache until you call //the next LoadInterstitialAd. plugin.PrefetchInterstitialAd("JB9dhz"); } }
void Start() { if (Application.platform == RuntimePlatform.Android) { plugin = VdopiaPlugin.GetInstance(); //Initialize Plugin Instance if (plugin != null) { Debug.Log("Vdopia Plugin Initialized."); //Set Delegate Receiver For Vdopia SDK Ad Event (Not compulsory) VdopiaListener.GetInstance().VdopiaAdDelegateEventHandler += onVdopiaEventReceiver; //plugin.SetAdRequestUserData("23", "23/11/1990", "m", "single", "Asian", "999", "123123", "321321", “”, “”); plugin.SetAdRequestAppData("UnityDemo", "Chocolate", "unity-demo.com", "chocolateplatform.com", "", "IAB9"); plugin.PrefetchInterstitialAd("EnP5f4"); } else { Debug.Log("Vdopia Plugin Initialize Error."); } } }