static void InitAdNetworks() { AppLaunchTime = DateTime.Now; #if ADMOB // Admob plugin không hỗ trợ Editor. Không sử dụng #if lồng nhau được admobProvider = instance.gameObject.AddComponent <AdmobProvider>(); Providers.Add(admobProvider); #endif #if CHARTBOOST var Chartboost = instance.gameObject.AddComponent <ChartBoostProvider>(); Providers.Add(Chartboost); #endif #if UNITYAD var UnityAd = instance.gameObject.AddComponent <UnityAdProvider>(); Providers.Add(UnityAd); #endif #if VUNGLE var vungle = instance.gameObject.AddComponent <VungleProvider>(); Providers.Add(vungle); #endif #if FBAD var fbad = instance.gameObject.AddComponent <FbAdProvider>(); Providers.Add(fbad); #endif foreach (AdProvider partner in Providers) { if (partner != null) { partner.Initialize(instance); } } }
protected override void OnSendRequest() { // Create an interstitial. this.interstitial = new InterstitialAd(AdUnit.AdId); // Register for ad events. this.interstitial.OnAdLoaded += this.HandleInterstitialLoaded; this.interstitial.OnAdFailedToLoad += this.HandleInterstitialFailedToLoad; this.interstitial.OnAdOpening += this.HandleInterstitialOpened; this.interstitial.OnAdClosed += this.HandleInterstitialClosed; this.interstitial.OnAdLeavingApplication += this.HandleInterstitialLeftApplication; // Load an interstitial ad. this.interstitial.LoadAd(AdmobProvider.CreateAdRequest()); }
protected override void OnSendRequest() { // Create a 320x50 banner at the top of the screen. this.bannerView = new BannerView(AdUnit.AdId, admobSize, admobPosition); // Register for ad events. this.bannerView.OnAdLoaded += this.HandleBannerLoaded; this.bannerView.OnAdFailedToLoad += this.HandleBannerFailedToLoad; this.bannerView.OnAdLoaded += this.HandleBannerOpened; this.bannerView.OnAdClosed += this.HandleBannerClosed; this.bannerView.OnAdLeavingApplication += this.HandleBannerLeftApplication; // Load a banner ad. this.bannerView.LoadAd(AdmobProvider.CreateAdRequest()); this.bannerView.Hide(); //CLog.Log(this, "Send ad request :" + AdUnit.key + "\t" + AdUnit.AdId + "\t" + admobSize.ToString() + "\t" + admobPosition.ToString()); }
protected override void OnSentRequest() { AdRequest request = AdmobProvider.CreateAdRequest(); RewardBasedVideoAd.Instance.LoadAd(request, AdsMaster.config.AdmobRewarded); }