void RegisterDelegateForInterstitial()
    {
        interstitial.AdLoaded          += HandleInterstitialLoaded;
        interstitial.AdFailedToLoad    += HandleInterstitialFailedToLoad;
        interstitial.AdOpened          += HandleInterstitialOpened;
        interstitial.AdClosing         += HandleInterstitialClosing;
        interstitial.AdClosed          += HandleInterstitialClosed;
        interstitial.AdLeftApplication += HandleInterstitialLeftApplication;
        GoogleMobileAdsDemoHandler handler = new GoogleMobileAdsDemoHandler();

        interstitial.SetInAppPurchaseHandler(handler);
    }
    public static void RequestInterstitial()
    {
                #if UNITY_EDITOR
        string adUnitId = "ca-app-pub-3940256099942544/1033173712";
                #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-3940256099942544/1033173712";
                #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);
        // Register for ad events.
        interstitial.AdLoaded          += HandleInterstitialLoaded;
        interstitial.AdFailedToLoad    += HandleInterstitialFailedToLoad;
        interstitial.AdOpened          += HandleInterstitialOpened;
        interstitial.AdClosing         += HandleInterstitialClosing;
        interstitial.AdClosed          += HandleInterstitialClosed;
        interstitial.AdLeftApplication += HandleInterstitialLeftApplication;
        GoogleMobileAdsDemoHandler handler = new GoogleMobileAdsDemoHandler();
        interstitial.SetInAppPurchaseHandler(handler);
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }
Beispiel #3
0
    public void RequestInterstitial()
    {
        #if UNITY_EDITOR
        string adUnitId = "unused";
        #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-6631760566665115/4703961388";
        #elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-6631760566665115/1610894187";
        #else
        string adUnitId = "unexpected_platform";
        #endif

        // Create an interstitial.
        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;
        GoogleMobileAdsDemoHandler handler = new GoogleMobileAdsDemoHandler();
        interstitial.SetInAppPurchaseHandler(handler);
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }
Beispiel #4
0
    public void RequestInterstitial()
    {
        if (disableAds)
        {
            return;
        }

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

        #if UNITY_EDITOR
        string adUnitId = "unused";
        #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-2481366852569675/6767420744";
#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);
        // Register for ad events.
        interstitial.AdLoaded          += HandleInterstitialLoaded;
        interstitial.AdFailedToLoad    += HandleInterstitialFailedToLoad;
        interstitial.AdOpened          += HandleInterstitialOpened;
        interstitial.AdClosing         += HandleInterstitialClosing;
        interstitial.AdClosed          += HandleInterstitialClosed;
        interstitial.AdLeftApplication += HandleInterstitialLeftApplication;
        GoogleMobileAdsHandler handler = new GoogleMobileAdsHandler();
        interstitial.SetInAppPurchaseHandler(handler);
        // Load an interstitial ad.
        interstitial.LoadAd(createAdRequest());
    }