public void LoadRewardedVideo(string adUnit, AdMobRewardedOptions options = null)
        {
            if (!CrossAdMob.Current.IsEnabled)
            {
                return;
            }

            if (IsInTestMode || String.IsNullOrWhiteSpace(adUnit))
            {
                adUnit = GoogleSamplesAdUnitIds.AndroidSampleAdUnitId_RewardedVideo;
            }

            if (_rewardedVideoAds == null)
            {
                CreateRewardedVideo(adUnit);
            }

            if (!_rewardedVideoAds.IsLoaded)
            {
                //if (options != null)
                //{
                //    _rewardedVideoAds.UserId = options.UserId;
                //    _rewardedVideoAds.CustomData = options.CustomData;
                //}
                var loadCallback = new AdMobRewardedLoadCallback(adUnit);
                loadCallback.AdLoaded       += LoadCallback_AdLoaded;
                loadCallback.AdFailedToLoad += LoadCallback_AdFailedToLoad;

                _rewardedVideoAds.LoadAd(GetRequest(), loadCallback);
            }
            else
            {
                Console.WriteLine("RewardedVideo already loaded");
            }
        }
Ejemplo n.º 2
0
 public void LoadRewardedVideo(AdMobRewardedOptions options = null)
 {
     if (IsInTestMode || String.IsNullOrWhiteSpace(AdUnitId_RewardedVideo))
     {
         AdUnitId_RewardedVideo = GoogleSamplesAdUnitIds.iOSSampleAdUnitId_RewardedVideo;
     }
     LoadRewardedVideo(AdUnitId_RewardedVideo, options);
 }
Ejemplo n.º 3
0
        public void LoadRewardedVideo(string adUnit, AdMobRewardedOptions options = null)
        {
            if (!CrossAdMob.Current.IsEnabled)
            {
                return;
            }

            if (_rewardedAd == null)
            {
                _rewardedAd = new RewardedAd(adUnit);
            }

            //RewardBasedVideoAd.SharedInstance.CustomRewardString = options?.CustomData;
            _rewardedAd.LoadRequest(GetRequest(), LoadCompletionHandler);
        }