示例#1
0
    public void Start()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
        this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
        this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
        this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
        this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
        this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
        this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;
    }
    void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);

        List <String> deviceIds = new List <String>();

        RequestConfiguration requestConfiguration;

        if (isTestMode)
        {
            deviceIds.Add(AdRequest.TestDeviceSimulator);
            for (int i = 0; i < testDevices.Count; i++)
            {
                deviceIds.Add(testDevices[i]);
            }

            requestConfiguration = new RequestConfiguration.Builder()
                                   .SetTagForChildDirectedTreatment(tagForChildDirectedTreatment)
                                   .SetTestDeviceIds(deviceIds).build();
        }
        else
        {
            requestConfiguration = new RequestConfiguration.Builder()
                                   .SetTagForChildDirectedTreatment(tagForChildDirectedTreatment).build();
        }

        MobileAds.SetRequestConfiguration(requestConfiguration);

        MobileAds.Initialize(OnInit);
    }
示例#3
0
    void Start()
    {
        //ADS
        rewardBasedVideo = RewardBasedVideoAd.Instance;
                #if UNITY_ANDROID
        string appId = "ca-app-pub-5917530822811665~6054041533";
                #elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
                #else
        string appId = "unexpected_platform";
                #endif

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        RequestRewardedVideo();

        //ADS
        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        //Level actual
        actualLevel = app.model.LevelActual;
        //Refresh elements
        refreshElements = true;
    }
示例#4
0
        protected override void Awake()
        {
            base.Awake();
            MobileAds.Initialize(idsApp);
            MobileAds.SetiOSAppPauseOnBackground(true);


#if UNITY_IOS || UNITY_EDITOR
            idsApp          = IOS_idsApp;
            idsBanner       = IOS_idsBanner;
            idsInterstitial = IOS_idsInterstitial;
            idsRewarded     = IOS_idsRewarded;
#endif

            if (testMode)
            {
                idsBanner       = idsTestBannerId;
                idsInterstitial = idsTestInterstitial;
                idsRewarded     = idsTestRewarded;
            }

            IsPremiumUser = PlayerPrefs.HasKey(keyPremium);

            if (!IsPremiumUser)
            {
                this.RequestBanner();
                this.RequestInterstitialAd();
                this.RequestRewardBasedVideo();
            }
        }
        public void InitAdNetwork()
        {
            Debug.Log("[ADS] [ADMOB] INIT AD CONTROLLER");

#if UNITY_ANDROID
            string appId = AdMobQuixelIDAndroid;
#elif UNITY_IPHONE
            string appId = AdMobQuixelIDiOS;
#else
            string appId = "unexpected_platform";
#endif

            MobileAds.SetiOSAppPauseOnBackground(true);

            // Initialize the Google Mobile Ads SDK.
            MobileAds.Initialize(appId);

            // TODO: show banner on start up?
            //RequestBanner();

            // Get singleton reward based video ad reference.
            this.rewardBasedVideo = RewardBasedVideoAd.Instance;

            // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
            this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
            this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
            this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
            this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
            this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
            this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
            this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;

            Fetch(AdType.RewardedVideo);
            Fetch(AdType.Interstitial);
        }
    public void Start()
    {
#if UNITY_ANDROID
        string appId = AndroidID.AppID;
#elif UNITY_IPHONE
        string appId = IOSID.AppID;
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // RewardBasedVideoAd is a singleton, so rs should only be registered once.
        this.rewardBasedVideo.OnAdLoaded             += this.RewardBasedVideoLoaded;
        this.rewardBasedVideo.OnAdFailedToLoad       += this.RewardBasedVideoFailedToLoad;
        this.rewardBasedVideo.OnAdOpening            += this.RewardBasedVideoOpened;
        this.rewardBasedVideo.OnAdStarted            += this.RewardBasedVideoStarted;
        this.rewardBasedVideo.OnAdRewarded           += this.RewardBasedVideoRewarded;
        this.rewardBasedVideo.OnAdClosed             += this.RewardBasedVideoClosed;
        this.rewardBasedVideo.OnAdLeavingApplication += this.RewardBasedVideoLeftApplication;

        RequestBanner(AdPosition.Bottom);
        RequestInterstitial();
        RequestRewardBasedVideo();
    }
        /// <summary>
        /// 初始化广告
        /// </summary>
        /// <param name="InAppId">AdMob App Id,不能为空</param>
        /// <param name="InBannerId">AdMob Banner Id,如果不需要banner ad传null</param>
        /// <param name="InInterstitialId">AdMob Banner Id,如果不需要banner ad传null</param>
        /// <param name="InRewardId">AdMob Banner Id,如果不需要banner ad传null</param>
        /// <param name="InAdSize">Banner Ad Size.</param>
        /// <param name="InAdPosition">Banner Ad Position.</param>
        public static void Init(string InAppId, string InBannerId, string InInterstitialId, string InRewardId,
                                AdSize InAdSize, AdPosition InAdPosition)
        {
            if (string.IsNullOrEmpty(InAppId))
            {
                Debug.LogError(
                    "The AdMobTest id is empty. Please set the corresponding platform ID in the 'AdMobConfig' script. ");
            }
            else
            {
                MobileAds.SetiOSAppPauseOnBackground(true);

                // Initialize the Google Mobile Ads SDK.
                MobileAds.Initialize(InAppId);

                if (!string.IsNullOrEmpty(InBannerId))
                {
                    BannerAd = new BannerAdController(InBannerId, InAdSize, InAdPosition);
                }

                if (!string.IsNullOrEmpty(InInterstitialId))
                {
                    InterstitialAd = new InterstitialAdController(InInterstitialId);
                }

                if (!string.IsNullOrEmpty(InRewardId))
                {
                    RewardAd = new RewardAdController(InRewardId);
                }
            }
        }
示例#8
0
    public void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);

        List <String> deviceIds = new List <String>()
        {
            AdRequest.TestDeviceSimulator
        };

        // Add some test device IDs (replace with your own device IDs).
#if UNITY_IPHONE
        deviceIds.Add("96e23e80653bb28980d3f40beb58915c");
#elif UNITY_ANDROID
        deviceIds.Add("");
#endif

        // Configure TagForChildDirectedTreatment and test device IDs.
        RequestConfiguration requestConfiguration =
            new RequestConfiguration.Builder()
            .SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.Unspecified)
            .SetTestDeviceIds(deviceIds).build();

        MobileAds.SetRequestConfiguration(requestConfiguration);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(HandleInitCompleteAction);
    }
    private void Start()
    {
        Instance = this;

#if UNITY_ANDROID
        string appId = "ca-app-pub-3670795233890103~6318560251";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3670795233890103~9778173553";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);
        MobileAds.Initialize(appId);

        video                         = RewardBasedVideoAd.Instance;
        video.OnAdLoaded             += HandleRewardBasedVideoLoaded;
        video.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
        video.OnAdOpening            += HandleRewardBasedVideoOpened;
        video.OnAdStarted            += HandleRewardBasedVideoStarted;
        video.OnAdClosed             += HandleRewardBasedVideoClosed;
        video.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
        RequestBanner();
        RequestInterstitial();
        RequestRewardBasedVideo();
    }
示例#10
0
    void init()
    {
        string appId = get_app_id();

        MobileAds.SetiOSAppPauseOnBackground(true);
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
    }
示例#11
0
 void Start()
 {
     //PlayerPrefs.DeleteAll();
     // Initialize the Google Mobile Ads SDK.
     MobileAds.Initialize("ca-app-pub-4738062221647171~1836833926");
     //RequestAd();
     MobileAds.SetiOSAppPauseOnBackground(true);
 }
    public void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(HandleInitCompleteAction);

        RequestAndLoadRewardedAd();
    }
示例#13
0
    string InterstitialAdUnitId = "/21617015150/40789737/21740466811"; //Replace with your interstitial unit id

    // Use this for initialization
    void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(AppId);

        this.InitBanner();
    }
示例#14
0
    public const string PrecompileDirectiveName = "ACTIVATE_ADS_CALLS"; // used by game settings to activate third party calls. Has to match the name of the directives used below.

    public FMCAds()
    {
#if ACTIVATE_ADS_CALLS
        MobileAds.SetiOSAppPauseOnBackground(true);
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        InitAdmobIdentifiers();
#endif
    }
示例#15
0
    void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);
        RewardVideoInit();
//         #if UNITY_IPHONE
//             APP_ID = "ca-app-pub-5173937614720313~6422463612";
//         #elif UNITY_ANDROID
//             APP_ID = "ca-app-pub-5173937614720313~1281817572";
// #endif
//         MobileAds.Initialize(APP_ID);
    }
示例#16
0
    private void Start()
    {
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(initStatus => { });
        MobileAds.SetiOSAppPauseOnBackground(true);

        if (!CUtils.IsAdsRemoved())
        {
            RequestInterstitial();
        }

        InitRewardedVideo();
        RequestRewardBasedVideo();
    }
示例#17
0
        public static void Init()
        {
            //admob init;
            MobileAds.Initialize(AppID);
#if UNITY_IOS
            MobileAds.SetiOSAppPauseOnBackground(true);
#endif
            ad                   = RewardBasedVideoAd.Instance;
            ad.OnAdLoaded       += OnAdLoaded;
            ad.OnAdFailedToLoad += OnAdFailedToLoad;
            ad.OnAdRewarded     += OnEarnedReward;
            ad.OnAdClosed       += OnAdClosed;

            LoadAd();
        }
示例#18
0
    public void Start()
    {
#if USE_PLAY_ADMOB
#if UNITY_ANDROID
        string appId = ids.appID_ANDROID;
#elif UNITY_IPHONE
        string appId = ids.appID_IPHONE;
#else
        string appId = "unexpected_platform";
#endif

        if (adsSaveEnabled == true)
        {
            MobileAds.SetiOSAppPauseOnBackground(true);

            // Initialize the Google Mobile Ads SDK.
            MobileAds.Initialize(appId);

            // Get singleton reward based video ad reference.
            this.rewardBasedVideo = RewardBasedVideoAd.Instance;

            // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
            this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
            this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
            this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
            this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
            this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
            this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
            this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;

            generalEvents.OnInitialization.Invoke();

            // enable the load of a banner/interstitial/rewardedVideo at the beginning of the scene
            if (bannerConfiguration.requestAtStart == true)
            {
                RequestBanner();
            }
            if (interstitialConfiguration.requestAtStart == true)
            {
                RequestInterstitial();
            }
            if (rewardBasedVideoConfiguration.requestAtStart == true)
            {
                RequestRewardBasedVideo();
            }
        }
#endif
    }
示例#19
0
    public void Start()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IOS
        string appId = "ca-app-pub-5093627727358595~8235073586";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);
        MobileAds.Initialize(appId);

        RequestInterstitial();
        RequestBanner();
    }
示例#20
0
    public Vector2Int adSize;  //サイズ

    public void OnEnable()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        Request();
    }
示例#21
0
    public void Start()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        this.CreateAndLoadRewardedAd();
    }
示例#22
0
    // Init
    void Start()
    {
        if (PlayerPrefs.GetInt("removed_ads") == 1)
        {
            removedAds = true;
        }
        else
        {
            removedAds = false;

            MobileAds.Initialize(initStatus => { });
            MobileAds.SetiOSAppPauseOnBackground(true);

            RequestBanner();
            RequestInterstitial();
            RequestRewardAd();
        }
    }
示例#23
0
    public void Initialize()
    {
        Debug.LogError("Initializing admanager");
        SceneManager.Instance.OnSceneLoaded += OnSceneLoadHandler;

        MobileAds.SetiOSAppPauseOnBackground(true);

        MobileAds.Initialize(initStatus => {
            Debug.LogError("MobileAds is initialized!");
            RequestRewardedVideo();
            if (DataManager.Instance.PlayerData.NoAds.Value != 10000)
            {
                RequestBanner();
                RequestInterstitial();
            }
        });

        // InvokeRepeating("HideBannerCheckInterval", 0, UpdateRate);
    }
    public void Start()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        this.RequestBanner();
        this.RequestInterstitial();
        this.RequestRewardBasedVideo();
    }
示例#25
0
    private void GoogleInite()
    {
        // These ad units are configured to always serve test ads.
                #if UNITY_EDITOR
        string adUnitId = "unused";
                #elif UNITY_ANDROID
        string adUnitId = "ca-app-pub-3940256099942544/6300978111";
                #elif UNITY_IPHONE
        string adUnitId = appIdAll;
                #else
        string adUnitId = "unexpected_platform";
                #endif



        MobileAds.SetiOSAppPauseOnBackground(true);
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(adUnitId);
    }
示例#26
0
    public void Start()
    {
        if (!isAdMobInitialized)
        {
#if UNITY_ANDROID
            string appId = "ca-app-pub-4472054890564612~9408933086";
#elif UNITY_IPHONE
            string appId = "ca-app-pub-4472054890564612~9408933086";
#else
            string appId = "unexpected_platform";
#endif

            // Initialize the Google Mobile Ads SDK.
            MobileAds.Initialize(appId);

            MobileAds.SetiOSAppPauseOnBackground(true);

            isAdMobInitialized = true;
        }
    }
    public void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(AppID);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
        this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
        this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
        this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
        this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
        this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
        this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;
        RequestInterstitial();
        RequestRewardBasedVideo();
    }
示例#28
0
    public void Start()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-9184116991089390~7276697203";
        //string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#elif UNITY_EDITOR
        string appId = "ca-app-pub-9184116991089390~7276697203";
#else
        string appId = "unexpected_platform";
#endif

        MobileAds.SetiOSAppPauseOnBackground(true);
        // Initialize the Google Mobile Ads SDK.
        //MobileAds.Initialize(InitializationStatus => { });
        MobileAds.Initialize(appId);
        //rewardTimer = StartCoroutine(RewardTimer());
        //StartCoroutine(IntersitialTimer());
        //Invoke("ShowRewardedAd", 10);
    }
示例#29
0
    public void Start()
    {
        AdRequest request = new AdRequest.Builder().Build();

        bannerView = new BannerView(BannerAdUnitID, AdSize.Banner, AdPosition.Bottom);
        bannerView.LoadAd(request);
        bannerView.Show();

/*#if UNITY_ANDROID
 *      string appId = "ca-app-pub-3940256099942544~3347511713";
 #elif UNITY_IPHONE
 *      string appId = "ca-app-pub-3940256099942544~1458002511";
 #else
 *      string appId = "unexpected_platform";
 #endif*/

        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        this.CreateAndLoadRewardedAd();
    }
    void Start()
    {
#if UNITY_IOS && !UNITY_EDITOR
        rewardADUnit = iOS_RewardADUnit;
#elif UNITY_ANDROID && !UNITY_EDITOR
        rewardADUnit = android_RewardADUnit;
#elif UNITY_EDITOR
        rewardADUnit = android_RewardADUnit;
#endif
        MobileAds.SetiOSAppPauseOnBackground(true);

        List <String> deviceIds = new List <String>();

        RequestConfiguration requestConfiguration;
        if (isTestMode)
        {
            deviceIds.Add(AdRequest.TestDeviceSimulator);
            for (int i = 0; i < testDevices.Count; i++)
            {
                deviceIds.Add(testDevices[i]);
            }

            requestConfiguration = new RequestConfiguration.Builder()
                                   .SetTagForChildDirectedTreatment(tagForChildDirectedTreatment)
                                   .SetTestDeviceIds(deviceIds).build();
        }
        else
        {
            requestConfiguration = new RequestConfiguration.Builder()
                                   .SetTagForChildDirectedTreatment(tagForChildDirectedTreatment).build();
        }

        MobileAds.SetRequestConfiguration(requestConfiguration);

        MobileAds.Initialize(OnInit);
    }