Example #1
0
        public AdMobVideoAds(string videoRewordID)
        {
            admobAdRequest = new AdmobAdRequest();

            this.adUnitId = videoRewordID;
            // Get singleton reward based video ad reference.
            this.rewardBasedVideo = RewardBasedVideoAd.Instance;

            // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
            this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
            this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
            this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
            this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
            this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
            this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
            this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;

            this.RequestRewardVideoAds();
        }
        public AdMobInterstitail(string _adUnitId)
        {
            admobAdRequest = new AdmobAdRequest();

            if (this.interstitial != null)
            {
                this.interstitial.Destroy();
            }

            // Create an interstitial.
            this.interstitial = new InterstitialAd(_adUnitId);

            // 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.
            RequestInterstitial();
        }
Example #3
0
        public AdMobBanner(string _bannerId, AdSize adSize, AdPosition positoin)
        {
            admobAdRequest = new AdmobAdRequest();

            if (this.bannerView != null)
            {
                this.bannerView.Destroy();
            }

            // Create a 320x50 banner at the top of the screen.
            this.bannerView = new BannerView(_bannerId, adSize, positoin);

            // Register for ad events.
            this.bannerView.OnAdLoaded             += this.HandleAdLoaded;
            this.bannerView.OnAdFailedToLoad       += this.HandleAdFailedToLoad;
            this.bannerView.OnAdOpening            += this.HandleAdOpened;
            this.bannerView.OnAdClosed             += this.HandleAdClosed;
            this.bannerView.OnAdLeavingApplication += this.HandleAdLeftApplication;

            // Load a banner ad.
            //this.bannerView.LoadAd(this.CreateAdRequest());
            RequestAds();
        }