Example #1
0
    public static void RefreshBanner(int id)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("DestroyCurrentBanner shoudl be called only after Init function. Call ignored");
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.GetBanner(id).Refresh();
            }
            break;

        case RuntimePlatform.Android:
            GoogleMobileAd.GetBanner(id).Refresh();
            break;

        case RuntimePlatform.WP8Player:
            GoogleMobileAd.GetBanner(id).Refresh();
            break;
        }
    }
Example #2
0
    //--------------------------------------
    //  Initalization
    //--------------------------------------

    public static void Init()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.Init();
                GoogleMobileAdInterstitialSubscribe();
            }
            else
            {
                iAdBannerController.InterstitialAdDidLoadAction        += InterstitialLoadedHandler;
                iAdBannerController.InterstitialDidFailWithErrorAction += InterstitialLoadFailHandler;
                iAdBannerController.InterstitialAdDidFinishAction      += InterstitialClosedHandler;
            }
            break;

        case RuntimePlatform.Android:
            GoogleMobileAd.Init();
            GoogleMobileAdInterstitialSubscribe();
            break;

        case RuntimePlatform.WP8Player:
            GoogleMobileAd.Init();
            GoogleMobileAdInterstitialSubscribe();
            break;
        }

        _IsInited = true;
    }
Example #3
0
    public static void ShowInterstitialAd()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.ShowInterstitialAd();
            }
            else
            {
                iAdBannerController.instance.ShowInterstitialAd();
            }
            break;

        case RuntimePlatform.Android:
            GoogleMobileAd.ShowInterstitialAd();
            break;

        case RuntimePlatform.WP8Player:
            GoogleMobileAd.ShowInterstitialAd();
            break;
        }
    }
Example #4
0
    //--------------------------------------
    //  Public Methods
    //--------------------------------------


    public static int CreateAdBanner(TextAnchor anchor)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("CreateBannerAd shoudl be called only after Init function. Call ignored");
            return(0);
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                return(GoogleMobileAd.CreateAdBanner(anchor, GADBannerSize.BANNER).id);
            }
            else
            {
                return(iAdBannerController.instance.CreateAdBanner(anchor).id);
            }

        case RuntimePlatform.Android:
            return(GoogleMobileAd.CreateAdBanner(anchor, GADBannerSize.BANNER).id);

        case RuntimePlatform.WP8Player:
            return(GoogleMobileAd.CreateAdBanner(anchor, GADBannerSize.BANNER).id);
        }

        return(0);
    }
Example #5
0
 public void ShowInterstitialAd()
 {
     if (GoogleMobileAd.IsInterstitialReady)
     {
         GoogleMobileAd.ShowInterstitialAd();
     }
 }
 private void OnInAppRequest(string productId)
 {
     Debug.Log("In App Request for product Id: " + productId + " received");
     //Then you should perfrom purchase  for this product id, using this or another game billing plugin
     //Once the purchase is complete, you should call RecordInAppResolution with one of the constants defined in GADInAppResolution:
     GoogleMobileAd.RecordInAppResolution(GADInAppResolution.RESOLUTION_SUCCESS);
 }
Example #7
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Start()
    {
        //Required
        GoogleMobileAd.Init();


        //Optional, add data for better ad targeting
        GoogleMobileAd.SetGender(GoogleGender.Male);
        GoogleMobileAd.AddKeyword("game");
        GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);
        GoogleMobileAd.TagForChildDirectedTreatment(false);

        //Causes a device to receive test ads. The deviceId can be obtained by viewing the device log output after creating a new ad
        //Fill your test device in the plugin setting, or you can add your device using example code bellow

        GoogleMobileAd.AddTestDevice("733770c317dcbf4675fe870d3df9ca42");



        GoogleMobileAd.OnInterstitialLoaded += OnInterstisialsLoaded;
        GoogleMobileAd.OnInterstitialOpened += OnInterstisialsOpen;


        //listening for InApp Event
        //You will only receive in-app purchase (IAP) ads if you specifically configure an IAP ad campaign in the AdMob front end.
        GoogleMobileAd.OnAdInAppRequest += OnInAppRequest;
        InitStyles();
    }
Example #8
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Start()
    {
        //Required
        GoogleMobileAd.Init();


        //Optional, add data for better ad targeting
        GoogleMobileAd.SetGender(GoogleGenger.Male);
        GoogleMobileAd.AddKeyword("game");
        GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);
        GoogleMobileAd.TagForChildDirectedTreatment(false);

        //Causes a device to receive test ads. The deviceId can be obtained by viewing the device log output after creating a new ad
        GoogleMobileAd.AddTestDevice("733770c317dcbf4675fe870d3df9ca42");



        //More eventts ot explore under GoogleMobileAdEvents class
        GoogleMobileAd.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_LOADED, OnInterstisialsLoaded);
        GoogleMobileAd.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_OPENED, OnInterstisialsOpen);

        //listening for InApp Event
        //You will only receive in-app purchase (IAP) ads if you specifically configure an IAP ad campaign in the AdMob front end.
        GoogleMobileAd.addEventListener(GoogleMobileAdEvents.ON_AD_IN_APP_REQUEST, OnInAppRequest);

        InitStyles();
    }
Example #9
0
    public static bool IsBannerOnScreen(int id)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("IsBannerOnScreen shoudl be called only after Init function. Call ignored");
            return(false);
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                return(GoogleMobileAd.GetBanner(id).IsOnScreen);
            }
            else
            {
                return(iAdBannerController.instance.GetBanner(id).IsOnScreen);
            }

        case RuntimePlatform.Android:
            return(GoogleMobileAd.GetBanner(id).IsOnScreen);

        case RuntimePlatform.WP8Player:
            return(GoogleMobileAd.GetBanner(id).IsOnScreen);
        }

        return(false);
    }
Example #10
0
    // --------------------------------------
    // Unity Events
    // --------------------------------------

    void Awake()
    {
        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
        }
    }
    //--------------------------------------
    //  Public Methods
    //--------------------------------------


    public static int CreateAdBanner(TextAnchor anchor, GADBannerSize size = GADBannerSize.BANNER)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("CreateBannerAd shoudl be called only after Init function. Call ignored");
            return(0);
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                return(GoogleMobileAd.CreateAdBanner(anchor, size).id);
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                return(SA_AmazonAdsManager.Instance.CreateBanner(AmazonAdBanner.BannerAligns.Bottom));
            }
            else
            {
                return(GoogleMobileAd.CreateAdBanner(anchor, size).id);
            }

        case RuntimePlatform.WP8Player:
            return(GoogleMobileAd.CreateAdBanner(anchor, size).id);
        }

        return(0);
    }
    public static void LoadInterstitialAd()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.LoadInterstitialAd();
            }
            else
            {
                //iAdBannerController.instance.LoadInterstitialAd();
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                SA_AmazonAdsManager.Instance.LoadInterstitial();
            }
            else
            {
                GoogleMobileAd.LoadInterstitialAd();
            }
            break;

        case RuntimePlatform.WP8Player:
            GoogleMobileAd.LoadInterstitialAd();
            break;
        }
    }
    public static bool IsBannerLoaded(int id)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("IsBannerLoaded shoudl be called only after Init function. Call ignored");
            return(false);
        }


        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                return(GoogleMobileAd.GetBanner(id).IsLoaded);
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                return(SA_AmazonAdsManager.Instance.IsBannerLoaded(id));
            }
            else
            {
                return(GoogleMobileAd.GetBanner(id).IsLoaded);
            }

        case RuntimePlatform.WP8Player:
            return(GoogleMobileAd.GetBanner(id).IsLoaded);
        }

        return(false);
    }
Example #14
0
    // Use this for initialization
    void Start()
    {
        rewardedVideoZoneCount   = 0;
        requestInterstitialCount = 0;
        mIsShow = false;

        //Required
        GoogleMobileAd.Init();
    }
Example #15
0
 public void Clicked()
 {
     clickTimes++;
     if (clickTimes >= Random.Range(config.googleconfig.min_times, config.googleconfig.max_times))
     {
         clickTimes = 0;
         GoogleMobileAd.StartInterstitialAd();
     }
 }
 public void ShowInterstitialAd()
 {
     if (!IsMyDevice() && !scr.gM.isNoAds)
     {
         if (GoogleMobileAd.IsInterstitialReady)
         {
             GoogleMobileAd.ShowInterstitialAd();
         }
     }
 }
    public void SmartBanner()
    {
        banner2 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerLeft, GADBannerSize.SMART_BANNER);

        //listening for banner to load example using C# actions:
        banner2.OnLoadedAction += OnBannerLoadedAction;

        //By setting this flsg to fals we will prevent banner to show when it's loaded
        //e will listner for OnLoadedAction event and show it by our selfs instead
        banner2.ShowOnLoad = false;
    }
    void Start()
    {
        GoogleMobileAd.Init();

        GoogleMobileAd.OnInterstitialLoaded += HandleOnInterstitialLoaded;
        GoogleMobileAd.OnInterstitialClosed += OnInterstisialsClosed;
        GoogleMobileAd.OnInterstitialOpened += OnInterstisialsOpen;


        //loadin ad:
        GoogleMobileAd.LoadInterstitialAd();
    }
Example #19
0
    void HandleOnInterstitialLoadedGameOverBackUp()
    {
                #if STAN_ASSET_GOOGLEMOBILEADS
        GoogleMobileAd.OnInterstitialLoaded -= HandleOnInterstitialLoadedGameOverBackUp;
        GoogleMobileAd.ShowInterstitialAd();
                #endif

                #if STAN_ASSET_ANDROIDNATIVE
        AndroidAdMobController.Instance.OnInterstitialLoaded -= HandleOnInterstitialLoadedGameOverBackUp;
        AndroidAdMobController.Instance.ShowInterstitialAd();
                #endif
    }
    void Start()
    {
        GoogleMobileAd.Init();


        GoogleMobileAd.controller.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_LOADED, OnInterstisialsLoaded);
        GoogleMobileAd.controller.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_OPENED, OnInterstisialsOpen);

        GoogleMobileAd.controller.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_CLOSED, OnInterstisialsClosed);

        //loadin ad:
        GoogleMobileAd.LoadInterstitialAd();
    }
Example #21
0
 private GoogleAds()
 {
     GoogleMobileAd.Init();
     GoogleMobileAd.SetBannersUnitID("ca-app-pub-7468307217611497/1999630365", "", "");
     GoogleMobileAd.SetInterstisialsUnitID("ca-app-pub-7468307217611497/5313023562", "", "");
     GoogleMobileAd.SetGender(GoogleGender.Male);
     //GoogleMobileAd.AddKeyword("girl");
     //GoogleMobileAd.AddKeyword("sexy");
     //GoogleMobileAd.AddKeyword("big");
     //GoogleMobileAd.AddKeyword("hot");
     //GoogleMobileAd.AddKeyword("ass");
     GoogleMobileAd.CreateAdBanner(TextAnchor.LowerCenter, GADBannerSize.SMART_BANNER);
 }
    void Awake()
    {
        Inst = this;

        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
        }
        banner            = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperCenter, GADBannerSize.SMART_BANNER);
        banner.ShowOnLoad = false;
        DontDestroyOnLoad(transform.gameObject);
        LoadFullScreen();
        GoogleMobileAd.OnInterstitialClosed += OnInterstitialClosed;
    }
Example #23
0
    public static void ShowBanner(int id)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("DestroyCurrentBanner shoudl be called only after Init function. Call ignored");
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.GetBanner(id).Show();
            }
            else
            {
                //iAdBannerController.instance.GetBanner(id).Show();
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                SA_AmazonAdsManager.Instance.HideBanner(false, id);
            }
            else
            {
                GoogleMobileAd.GetBanner(id).Show();
            }
            break;

                #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
        case RuntimePlatform.WP8Player:
                #else
        case RuntimePlatform.WSAPlayerARM:
        case RuntimePlatform.WSAPlayerX64:
        case RuntimePlatform.WSAPlayerX86:
                #endif
            GoogleMobileAd.GetBanner(id).Show();
            break;
        }
    }
 public void ButtonGoToMainMenuHandler()
 {
     RS_PlayerData.Instance.AdsCD--;
     if (RS_PlayerData.Instance.AdsCD == 0)
     {
         if (GoogleMobileAd.IsInterstitialReady)
         {
             GoogleMobileAd.ShowInterstitialAd();
         }
         else
         {
             RS_PlayerData.Instance.AdsCD = 1;
         }
     }
     else
     {
         ButtonGoToMainMenuEvent();
     }
 }
Example #25
0
    // --------------------------------------
    // PUBLIC METHODS
    // --------------------------------------

    public void ShowBanner()
    {
        GoogleMobileAdBanner banner;

        if (registerdBanners.ContainsKey(sceneBannerId))
        {
            banner = registerdBanners[sceneBannerId];
        }
        else
        {
            banner = GoogleMobileAd.CreateAdBanner(anchor, size);
            registerdBanners.Add(sceneBannerId, banner);
        }

        if (banner.IsLoaded && !banner.IsOnScreen)
        {
            banner.Show();
        }
    }
Example #26
0
    //--------------------------------------
    //  Initalization
    //--------------------------------------

    public static void Init()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.Init();
                GoogleMobileAdInterstitialSubscribe();
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                SA_AmazonAdsManager.Instance.Create();
                SA_AmazonAdsManager.Instance.Init(AmazonNativeSettings.Instance.AppAPIKey, AmazonNativeSettings.Instance.IsTestMode);

                SA_AmazonAdsManager.Instance.OnInterstitialDataReceived += AmazonInterstitialDataReceived;
                SA_AmazonAdsManager.Instance.OnInterstitialDismissed    += AmazonInterstitialDismissed;
            }
            else
            {
                GoogleMobileAd.Init();
                GoogleMobileAdInterstitialSubscribe();
            }
            break;

                #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
        case RuntimePlatform.WP8Player:
                #else
        case RuntimePlatform.WSAPlayerARM:
        case RuntimePlatform.WSAPlayerX64:
        case RuntimePlatform.WSAPlayerX86:
                #endif
            GoogleMobileAd.Init();
            GoogleMobileAdInterstitialSubscribe();
            break;
        }

        _IsInited = true;
    }
Example #27
0
    void Start()
    {
        Tickets.text = RS_PlayerData.Instance.MultiplayerTickets.ToString() + "/" + RS_PlayerData.MAX_TICKETS.ToString();
        Wins.text    = RS_PlayerData.Instance.MultiplayerWins.ToString();

        if (UM_GameServiceManager.Instance.ConnectionSate == UM_ConnectionState.CONNECTED)
        {
            PlayerName.text = UM_GameServiceManager.Instance.Player.Name;
            LoadPlayerAvatar();
        }
        else
        {
            UM_GameServiceManager.OnPlayerConnected += HandleOnPlayerConnected;
        }

        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
            GoogleMobileAd.LoadInterstitialAd();
        }
    }
Example #28
0
    public static bool IsBannerOnScreen(int id)
    {
        if (!_IsInited)
        {
            Debug.LogWarning("IsBannerOnScreen shoudl be called only after Init function. Call ignored");
            return(false);
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                return(GoogleMobileAd.GetBanner(id).IsOnScreen);
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                return(SA_AmazonAdsManager.Instance.IsBannerOnScreen(id));
            }
            else
            {
                return(GoogleMobileAd.GetBanner(id).IsOnScreen);
            }

                #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
        case RuntimePlatform.WP8Player:
                #else
        case RuntimePlatform.WSAPlayerARM:
        case RuntimePlatform.WSAPlayerX64:
        case RuntimePlatform.WSAPlayerX86:
                #endif
            return(GoogleMobileAd.GetBanner(id).IsOnScreen);
        }

        return(false);
    }
Example #29
0
    public static void StartInterstitialAd()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.StartInterstitialAd();
            }
            else
            {
                //iAdBannerController.instance.StartInterstitialAd();
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                _AmazonAdsShowOnLoad = true;
                SA_AmazonAdsManager.Instance.LoadInterstitial();
            }
            else
            {
                GoogleMobileAd.StartInterstitialAd();
            }
            break;

                #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
        case RuntimePlatform.WP8Player:
                #else
        case RuntimePlatform.WSAPlayerARM:
        case RuntimePlatform.WSAPlayerX64:
        case RuntimePlatform.WSAPlayerX86:
                #endif
            GoogleMobileAd.StartInterstitialAd();
            break;
        }
    }
    public void Init()
    {
        GoogleMobileAd.Init();
        //Optional, add data for better ad targeting
        GoogleMobileAd.SetGender(GoogleGender.Male);
        GoogleMobileAd.AddKeyword("game");
        GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);
        GoogleMobileAd.TagForChildDirectedTreatment(false);

        //Causes a device to receive test ads. The deviceId can be obtained by viewing the logcat output after creating a new ad
        //AndroidAdMobController.instance.AddTestDevice("6B9FA8031AEFDC4758B7D8987F77A5A6");

        GoogleMobileAd.OnInterstitialLoaded += OnInterstisialsLoaded;
        GoogleMobileAd.OnInterstitialOpened += OnInterstisialsOpen;

        AndroidAdMobController.Instance.OnRewardedVideoLoaded   += HandleOnRewardedVideoLoaded;
        AndroidAdMobController.Instance.OnRewardedVideoAdClosed += HandleOnRewardedVideoAdClosed;

        //listening for InApp Event
        //You will only receive in-app purchase (IAP) ads if you specifically configure an IAP ad campaign in the AdMob front end.
        GoogleMobileAd.OnAdInAppRequest += OnInAppRequest;
    }