Esempio n. 1
0
	void Start () {
	
		// Keep this object around for entire game
		DontDestroyOnLoad(transform.gameObject);
		
		AdRequest request = new AdRequest.Builder().Build();
		
		// Banner view ad always present at bottom of screen
		//bannerView = new BannerView("ca-app-pub-6877754457671498/9780611568", AdSize.Banner, AdPosition.Bottom);
		//bannerView.LoadAd(request);
		
		// Interstitial ad only present before play begins
		interstitial = new InterstitialAd("ca-app-pub-6877754457671498/4235971961");

		// Register for ad events.
		interstitial.AdLoaded += delegate(object sender, System.EventArgs args) {};
		interstitial.AdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) {};
		interstitial.AdOpened += delegate(object sender, System.EventArgs args) {};
		interstitial.AdClosing += delegate(object sender, System.EventArgs args) {};
		interstitial.AdClosed += delegate(object sender, System.EventArgs args) {};
		interstitial.AdLeftApplication += delegate(object sender, System.EventArgs args) {};
		
		interstitial.LoadAd(request);		
		
	}
    private void RequestInterstitial()
    {
#if UNITY_ANDROID
        string adUnitId = "ca-app-pub-7413680112188055/9660693727";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
        string adUnitId = "unexpected_platform";
#endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);


        //interstitial.OnAdLoaded += HandleOnAdLoaded;
        // Called when an ad request failed to load.
        // interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;        
        // Called when the user returned from the app after an ad click.
        //interstitial.OnAdClosed += HandleOnAdClosed;
        // Called when the ad click caused the user to leave the application.
        //interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);


        rewardBasedVideo = RewardBasedVideoAd.Instance;
    }
Esempio n. 3
0
    public void RequestInterstitial()
    {
        #if UNITY_ANDROID
        string adUnitId = Android_Interstitial;
        #elif UNITY_IPHONE
        string adUnitId = ios_Interstitial;
        #else
        string adUnitId = "unexpected_platform";
        #endif

        if (is_close_interstitial == true) {
            interstitial.Destroy ();
        }

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd (adUnitId);
        // Create an empty ad request.
        request = new AdRequest.Builder ().Build ();
        // Load the interstitial with the request.
        interstitial.LoadAd (request);

        interstitial.AdClosed += HandleAdClosed;

        is_close_interstitial = false;
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        // 초기화
        // 앱아이디, 배너 사이즈, 배너 위치
        m_BannerView = new BannerView("ca-app-pub-3215701313685151/6171564220", AdSize.SmartBanner, AdPosition.Bottom);

        // 전면광고
        m_InterstitialAd = new InterstitialAd("ca-app-pub-3215701313685151/7648297427");

        // 테스트 단말기 등록
        //
        AdRequest.Builder adBuilder = new AdRequest.Builder();

        // 테스트기기가 많으면 .AddTestDevice(""). 으로 계속 추가
        AdRequest adRequst = adBuilder.AddTestDevice("3AEB4134537BE358").AddTestDevice(AdRequest.TestDeviceSimulator).Build();
        // 광고 요청
        m_BannerView.LoadAd(adRequst);
        // 광고 출력
        m_BannerView.Show();

        // 광고 요청
        m_InterstitialAd.LoadAd(adRequst);
        // 이벤트 종료후 callback함수 호출 추가
        m_InterstitialAd.AdClosed += AdCloseCallback;
    }
 public void RequestInterstitial()
 {
     // Create an interstitial.
     if(interstitial == null || !loaded)
     {
         moreAG.SetActive(false);
         #if UNITY_EDITOR
         string adUnitId = "unused";
         #elif UNITY_ANDROID
         string adUnitId = "/6087/defy_gaming_apps";
         #elif UNITY_IPHONE
         string adUnitId = "/6087/defy_gaming_apps";
         #else
         string adUnitId = "unexpected_platform";
         #endif
         interstitial = new InterstitialAd(adUnitId);
         // Register for ad events.
         interstitial.AdLoaded += HandleInterstitialLoaded;
         interstitial.AdFailedToLoad += HandleInterstitialFailedToLoad;
         interstitial.AdOpened += HandleInterstitialOpened;
         interstitial.AdClosing += HandleInterstitialClosing;
         interstitial.AdClosed += HandleInterstitialClosed;
         interstitial.AdLeftApplication += HandleInterstitialLeftApplication;
         // Load an interstitial ad.
         interstitial.LoadAd(createAdRequest());
     }
     else
     {
         moreAG.SetActive(true);
     }
 }
	public void BuildInterstitial(){
		failedLoading = false;
		interstitial = new InterstitialAd(adUnitID);
		// Events
		interstitial.OnAdClosed += HandleInterstitialClosed;
		interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
		interstitial.OnAdLeavingApplication += HandleLeftApplication;
		interstitial.OnAdLoaded += HandleLoaded;
		interstitial.OnAdOpening += HandleOpened;
		// AdRequest
		AdRequest.Builder builder = new AdRequest.Builder ();
		if (useEmulatorAsATestDevice) {
			builder.AddTestDevice(AdRequest.TestDeviceSimulator);
		}
		if (testDeviceIDs != null && testDeviceIDs.Length > 0) {
			foreach(string testDeviceID in testDeviceIDs){
				builder.AddTestDevice(testDeviceID);
			}
		}
		if (keywords != null && keywords.Length > 0) {
			foreach (string keyword in keywords) {
				builder.AddKeyword (keyword);
			}
		}
		if (gender.HasValue) {
			builder.SetGender (gender.Value);
		}
		if (childDirectedTreatment.HasValue) {
			builder.TagForChildDirectedTreatment (childDirectedTreatment.Value);
		}
		AdRequest request = builder.Build();
		interstitial.LoadAd(request);
	}
Esempio n. 7
0
 public static void Init()
 {
     banner = new BannerView(
        banerUnitId, AdSize.Banner, AdPosition.Bottom);
     interstitial = new InterstitialAd(interstitialId);
     interstitialReq = new AdRequest.Builder().Build();
     interstitial.LoadAd(interstitialReq);
 }
Esempio n. 8
0
 public void LoadAdmobInterstial()
 {
     interstialAd = new InterstitialAd (INTERSTIAL_ID);
     AdRequest request = new AdRequest.Builder ().Build ();
     if (!interstialAd.IsLoaded ()) {
         interstialAd.LoadAd (request);
     }
 }
Esempio n. 9
0
 public void LoadAd()
 {
     Debug.Log("Load Ad");
     MainCamera.isBreakAdLoaded = true;
     breakAd = new InterstitialAd ("YOUR_ADD_ID");
     AdRequest adrequest = new AdRequest.Builder ().Build ();
     breakAd.LoadAd (adrequest);
 }
	private void requestNewInterstitial() {
		interstitialAd = new InterstitialAd("<YOUR_HASHED_DEVICE_ID>");

		requestInterstitial = new AdRequest.Builder()
			.AddTestDevice("<YOUR_HASHED_DEVICE_ID>") //Add a test device
				.Build();
		interstitialAd.LoadAd(requestInterstitial); // Load the interstitial
	}
Esempio n. 11
0
 private static void initializeInterstitialAd()
 {
     if(inAd != null)
     {
         inAd.Destroy();
     }
     inAd = new InterstitialAd(adUnitId);
     inAd.OnAdClosed += HandleInterstitialClosed;
 }
    void Start()
    {
        if (string.IsNullOrEmpty(c_addMobID)) return;

        interstitial = new InterstitialAd(c_addMobID);
        request = new AdRequest.Builder().Build();
        interstitial.LoadAd(request);

        interstitial.AdClosed += AdsClosed;
    }
Esempio n. 13
0
	void CreatFullScreenBanner() {

		interstitialBanner = new InterstitialAd( GameConsts.AdIdGameOver );
		// Create an empty ad request.
		AdRequest request = new AdRequest.Builder().Build();

		// Load the interstitial with the request.
		interstitialBanner.LoadAd(request);

	}
Esempio n. 14
0
    void Start()
    {
        GetComponent<AudioSource>().Play();
        startAd = new InterstitialAd ("YOUR_ADD_ID");
        isBreakAdLoaded = false;
        AdRequest adrequest =new AdRequest.Builder().Build();

        startAd.LoadAd(adrequest);
        startAd.AdLoaded += HandleAdLoaded;
        //googleAnalytics.StartSession ();
    }
Esempio n. 15
0
 public static void RequestInterstitial(bool isShow)
 {
     // Initialize an InterstitialAd.
     interstitial = new InterstitialAd(adUnitIdInterstitial);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the interstitial with the request.
     interstitial.LoadAd(request);
     if(isShow)
         interstitial.AdLoaded += HandleAdLoaded;
 }
Esempio n. 16
0
 public void StartInterstitial()
 {
     #if SIMULATOR
     return;
     #endif
     #if UNITY_ANDROID || UNITY_IPHONE
     interstitial = new InterstitialAd(adUnitId);
     AdRequest request = new AdRequest.Builder().Build();
     interstitial.LoadAd(request);
     #endif
 }
Esempio n. 17
0
 public static void ShowAndDestroyInterstitialAd(InterstitialAd interstitial)
 {
     try
     {
         if (interstitial.IsLoaded())
         {
             interstitial.Show();
         }
     }
     catch (Exception e) { }
 }
Esempio n. 18
0
    void ShowInterstitial()
    {
        // Initialize an InterstitialAd.
        InterstitialAd interstitial = new InterstitialAd("ca-app-pub-9688313728956513/9454822785");
        // Create an empty ad request.
        AdRequest intrequest = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(intrequest);

        interstitial.Show ();
    }
Esempio n. 19
0
                public AdMobInterstitialAd(string zoneId)
                {
                    _zoneId = zoneId;

                    _ad = new gmd.InterstitialAd(zoneId);

                    _ad.OnAdLoaded             += OnAdLoadedHandler;
                    _ad.OnAdFailedToLoad       += OnFailedToLoadHandler;
                    _ad.OnAdOpening            += OnAdOpeningHandler;
                    _ad.OnAdClosed             += OnAdClosedHandler;
                    _ad.OnAdLeavingApplication += OnLeavingApplicationHandler;
                }
Esempio n. 20
0
    private void RequestInterstitialAds()
    {
        string text     = "ca-app-pub-3411062052281263/9258044518";
        string adUnitId = text;

        interstitial = new GoogleMobileAds.Api.InterstitialAd(adUnitId);
        AdRequest request = new AdRequest.Builder().Build();

        interstitial.OnAdClosed += Interstitial_OnAdClosed;
        interstitial.LoadAd(request);
        UnityEngine.Debug.Log("AD LOADED XXX");
    }
Esempio n. 21
0
 public void DestroyAD()
 {
     if (banner != null)
     {
         banner.Destroy();
         banner = null;
     }
     if (interstitial != null)
     {
         interstitial.Destroy();
         interstitial = null;
     }
 }
Esempio n. 22
0
    public void LoadInterstitial()
    {
        //Initialize AdUnitId if not set
        if (adUnitInterstitialId == ""){
            InitializeAdUnitId();
        }

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitInterstitialId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }
    private void RequestInterstitial()
    {
		interstitial = new InterstitialAd(adUnitId);

        interstitial.AdLoaded += HandleInterstitialLoaded;
        interstitial.AdFailedToLoad += HandleInterstitialFailedToLoad;
        interstitial.AdOpened += HandleInterstitialOpened;
        interstitial.AdClosing += HandleInterstitialClosing;
        interstitial.AdClosed += HandleInterstitialClosed;
        interstitial.AdLeftApplication += HandleInterstitialLeftApplication;

		//interstitial.LoadAd(new AdRequest.Builder().Build());
		interstitial.LoadAd(createAdRequest());
    }
Esempio n. 24
0
    public void InitAdmobInterstitial()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            this.interstitialAdmob = new GoogleMobileAds.Api.InterstitialAd(AdmobIntertestialID);

            this.interstitialAdmob.OnAdClosed += HandleOnAdClosed;
            // Create an empty ad request.
            AdRequest request = new AdRequest.Builder().Build();
            // Load the interstitial with the request.
            this.interstitialAdmob.LoadAd(request);

            // Advertising.LoadInterstitialAd();
        }
    }
Esempio n. 25
0
	private static void RequestInterstitialAds2()
	{
		try
		{
			string text = "ca-app-pub-3411062052281263/9258044518";
			string adUnitId = text;
			interstitial2 = new GoogleMobileAds.Api.InterstitialAd(adUnitId);
			AdRequest request = new AdRequest.Builder().Build();
			interstitial2.LoadAd(request);
			interstitial2.OnAdClosed += Interstitial_OnAdClosed;
		}
		catch (Exception)
		{
		}
	}
Esempio n. 26
0
    private void RequestInterstitial()
    {
        #if UNITY_ANDROID
        string adUnitId = "ca-app-pub-1215085077559999/3564479460";
        #elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-1215085077559999/5180813465";
        #endif

        // Initialize an InterstitialAd.

        interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }
Esempio n. 27
0
	private static void RequestInterstitialAds()
	{
		try
		{
			string text = "ca-app-pub-3411062052281263/8502865308";
			string adUnitId = text;
			interstitial = new GoogleMobileAds.Api.InterstitialAd(adUnitId);
			AdRequest request = new AdRequest.Builder().Build();
			interstitial.LoadAd(request);
			interstitial.OnAdClosed += Interstitial_OnAdClosed;
			interstitial.OnAdFailedToLoad += Interstitial_OnFailToLoad;
		}
		catch (Exception)
		{
		}
	}
Esempio n. 28
0
    public void RequestInterstitial()
    {
        #if UNITY_EDITOR
        string adUnitId = "unused";
        #elif UNITY_ANDROID
            string adUnitId = "ca-app-pub-3617707839468603/8111153894";
        #elif UNITY_IPHONE
            string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
        #else
            string adUnitId = "unexpected_platform";
        #endif

        // Create an interstitial.
        interstitial = new InterstitialAd(adUnitId);
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }
Esempio n. 29
0
    public void ShowInterstitialAd()
    {
        isAdFinished = false;
        myAudio.PauseAudio();
        interstitial = new InterstitialAd(adUnitId);
        interstitial.OnAdLoaded += HandleOnAdLoaded;
        interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
        interstitial.OnAdClosed += HandleOnAdClosed;

        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder()
            .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
            .AddTestDevice("212F4933DB3419310DFEF94DC783D96D")  // K10000
            .Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
        pleaseWaitPanel.SetActive(true);
    }
Esempio n. 30
0
    private void RequestInterstitial()
    {
        #if UNITY_EDITOR
        string adUnitId = "unused";
        #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-1991895393724672/8186664146";
        #elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
        #else
        string adUnitId = "unexpected_platform";
        #endif

        interstitial = new InterstitialAd(adUnitId);

        interstitial.AdFailedToLoad += HandleAdFailedToLoad;

        interstitial.LoadAd(createAdRequest());
    }
Esempio n. 31
0
        private void LoadAd()
        {
            if (null != interstitial)
            {
                interstitial.Destroy();
            }

            interstitial                         = new GoogleMobileAds.Api.InterstitialAd(ad_unit_id);
            interstitial.OnAdLoaded             += HandleOnAdLoaded;
            interstitial.OnAdFailedToLoad       += HandleOnAdFailedToLoad;
            interstitial.OnAdOpening            += HandleOnAdOpened;
            interstitial.OnAdClosed             += HandleOnAdClosed;
            interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;

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

            interstitial.LoadAd(request);
        }
Esempio n. 32
0
    public static InterstitialAd LoadInterstistialAd()
    {
        #if UNITY_ANDROID
                string adUnitId = "ca-app-pub-1854171409216273/6644924948";
        #elif UNITY_IPHONE
                string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
        #else
                string adUnitId = "unexpected_platform";
        #endif

        // Initialize an InterstitialAd.
        InterstitialAd interstitial = new InterstitialAd(adUnitId);

        // Load the interstitial with the request.

        interstitial.LoadAd(CreateRequest());

        return interstitial;
    }
    private void RequestInterstitial()
    {
        #if UNITY_EDITOR
        string adUnitId = "unused";
        #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-8831771291359638/3960735902";
        #elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
        #else
        string adUnitId = "unexpected_platform";
        #endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }
Esempio n. 34
0
 private void LoadInterstitialAdmob()
 {
     this.interstitial = new GoogleMobileAds.Api.InterstitialAd(admob.instertitial);
     if (this.interstitial != null)
     {
         vi = "interstitial inited";
     }
     this.interstitial.OnAdClosed += (delegate(System.Object sender, EventArgs args) {
         vi = "interstitial video new load";
         this.interstitial.LoadAd(new AdRequest.Builder().Build());
     });
     this.interstitial.OnAdLoaded += (delegate(System.Object sender, EventArgs args) {
         vi = "Video Loaded";
     });
     this.interstitial.OnAdFailedToLoad += (delegate(System.Object sender, AdFailedToLoadEventArgs args) {
         vi = "Video fail to load";
         this.bannerView.LoadAd(new AdRequest.Builder().Build());
     });
     this.interstitial.LoadAd(new AdRequest.Builder().Build());
 }
Esempio n. 35
0
    /*	public void RequestBanner()
    {
        // Create a 320x50 banner at the top of the screen.
        bannerView = new BannerView(
            BANNER_ID, AdSize.SmartBanner, AdPosition.Top);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder()
            //.AddTestDevice("A4D94C6CCCC78F95136843C5B0579088")
            .Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
    }*/
    public void RequestInterstitial()
    {
        #if UNITY_ANDROID
        string adUnitId = INTERSTITIAL_ID;
        #elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
        #else
        string adUnitId = "unexpected_platform";
        #endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        // ADD TEST DEVICE HERE
        AdRequest request = new AdRequest.Builder()
            .AddTestDevice("A4D94C6CCCC78F95136843C5B0579088")
                .Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }
Esempio n. 36
0
    void Start()
    {
        if (!ControlAd.m_useAd)
        {
            return;
        }
		if (string.IsNullOrEmpty(c_interstitial_addMobID)) return;

        Debug.Log("Admob View Start");
//        bannerView = new BannerView(c_bannerView_addMobID, m_type, m_postion);
        request = new AdRequest.Builder().Build();
//        bannerView.LoadAd(request);

        interstitial = new InterstitialAd(c_interstitial_addMobID);
        interstitial.LoadAd(request);

//        bannerView.Show();

        interstitial.AdClosed += AdsClosed;

    }
Esempio n. 37
0
    // Interstitial
    public void RequestInterstitial()
    {
        #if UNITY_EDITOR
        string adUnitId = "xxx";
        #elif UNITY_ANDROID
        string adUnitId = "xx";
        #elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-9144026334547134/7242351206";
        #else
        string adUnitId = "unexpected_platform";
        #endif

        interstitial = new InterstitialAd (adUnitId);
        //		AdRequest request = new AdRequest.Builder ()
        //			.AddTestDevice (AdRequest.TestDeviceSimulator)
        //				.AddTestDevice ("0123456789ABCDEF0123456789ABCDEF")
        //				.Build ();

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

        interstitial.LoadAd (request);
    }
Esempio n. 38
0
        public override void init()
        {
            Debug.Log("Init Admob");
#if UNITY_ANDROID
            string adUnitId = AdMobAndroid_ID;
#elif UNITY_IPHONE
            string adUnitId = AdMobIOS_ID;
#else
            string adUnitId = "unexpected_platform";
#endif

            // Initialize an InterstitialAd.
            interstitialAd = new GoogleMobileAds.Api.InterstitialAd(adUnitId);
            // Create an empty ad request.

            interstitialAd.OnAdLoaded += HandleOnAdLoaded;
            // Called when an ad request failed to load.
            interstitialAd.OnAdFailedToLoad += HandleOnAdFailedToLoad;
            // Called when the user returned from the app after an ad click.
            interstitialAd.OnAdClosed += HandleOnAdClosed;
            // Load the interstitial with the request.
            requestInterstitial();
        }