How do I verify that the user has completed the video in AdMob for Unity?

0

Code:

 using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using GoogleMobileAds.Api;
    using UnityEngine.UI;
    public class AdmobScript : MonoBehaviour
{

   int CoinOld;
   public Text coins;

   public string VideoAdID;
   RewardBasedVideoAd MyRewardVideoAd;

   // Use this for initialization
   void Start ()
   {

      MyRewardVideoAd = RewardBasedVideoAd.Instance;


   }




   public void LoadVideoAd() {

      if (!MyRewardVideoAd.IsLoaded()) {

         AdRequest request = new AdRequest.Builder().Build();

         MyRewardVideoAd.LoadAd(request, VideoAdID);
      }

      }

   public void ShowVideoAd() {

      if (MyRewardVideoAd.IsLoaded())
      {

         MyRewardVideoAd.Show();

      }
      else
      {

         LoadVideoAd();

      }
      }
      public void HandleRewardBasedVideoRewarded(object sender, Reward args)   { 

      CoinOld += 200;
      coins.text = "" + CoinOld;
      }
}
    
asked by anonymous 25.07.2018 / 15:35

0 answers