private void Start() { List <string> deviceIds = new List <string>(); deviceIds.Add("5ED557A5AF39EFAE351F90661FACB3CD"); RequestConfiguration requestConfiguration = new RequestConfiguration .Builder() .SetTestDeviceIds(deviceIds) .build(); MobileAds.Initialize(initStatus => { }); MobileAds.SetRequestConfiguration(requestConfiguration); this.rewardedAd = new RewardedAd("ca-app-pub-1822284172999308/7197718228"); this.rewardedAd.OnAdLoaded += HandleRewardedAdLoaded; this.rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad; this.rewardedAd.OnAdOpening += HandleRewardedAdOpening; this.rewardedAd.OnAdFailedToShow += HandleRewardedAdFailedToShow; this.rewardedAd.OnUserEarnedReward += HandleUserEarnedReward; this.rewardedAd.OnAdClosed += HandleRewardedAdClosed; AdRequest request = new AdRequest.Builder().Build(); this.rewardedAd.LoadAd(request); }
private void RequestInterstitial() { //TEST: ca-app-pub-3940256099942544/1033173712 //REAL ANDROID: ca-app-pub-1691376898912539/1533815312 //REAL IOS ca-app-pub-3940256099942544/4411468910 #if UNITY_ANDROID string adUnitId = "ca-app-pub-1691376898912539/1533815312"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-3940256099942544/4411468910"; #else string adUnitId = "ca-app-pub-3940256099942544/1033173712"; #endif // Initialize an InterstitialAd. this.interstitial = new InterstitialAd(adUnitId); // Create an empty ad request. RequestConfiguration requestConfiguration = new RequestConfiguration.Builder() .SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.True) .SetTagForUnderAgeOfConsent(TagForUnderAgeOfConsent.True) .SetMaxAdContentRating(MaxAdContentRating.G) .build(); MobileAds.SetRequestConfiguration(requestConfiguration); AdRequest request = new AdRequest .Builder() .TagForChildDirectedTreatment(true) .Build(); // Load the interstitial with the request. this.interstitial.LoadAd(request); }
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); }
// Use this for initialization void Start() { // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(initStatus => { }); List <string> deviceIds = new List <string>(); deviceIds.Add("4JPNU18502103746"); RequestConfiguration requestConfiguration = new RequestConfiguration .Builder() .SetTestDeviceIds(deviceIds) .build(); MobileAds.SetRequestConfiguration(requestConfiguration); if (enableBanner && PlayerPrefs.GetInt("EnableAds", 1) == 1) { this.RequestBanner(); } if (enableInterstitial) { this.RequestInterstitial(); } if (enableRewarded) { this.CreateAndLoadRewardedAd(); } }
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); }
public void Start() { PlatformInterface.instance.logger.Log("PlatformAdMobAdsInit.Start()"); // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(status => { }); var testDeviceList = new List <string> { //"751709a03251817c6a3d7d3f7072ec57" // iPhone 6s }; var requestConfiguration = new RequestConfiguration.Builder().SetTestDeviceIds(testDeviceList).build(); MobileAds.SetRequestConfiguration(requestConfiguration); // 광고 사운드 끄기 MobileAds.SetApplicationMuted(true); var adUnitId = PlatformInterface.instance.config.GetAdMobRewardVideoAdUnitId(); // Get singleton reward based video ad reference. rewardBasedVideo = new RewardedAd(adUnitId); rewardBasedVideo.OnAdLoaded += HandleOnAdLoaded; rewardBasedVideo.OnAdFailedToLoad += HandleAdFailedToLoad; rewardBasedVideo.OnAdOpening += HandleAdOpening; rewardBasedVideo.OnAdClosed += HandleAdClosed; rewardBasedVideo.OnAdFailedToShow += HandleAdFailedToShow; rewardBasedVideo.OnAdDidRecordImpression += HandleAdDidRecordImpression; rewardBasedVideo.OnUserEarnedReward += HandleUserEarnedReward; rewardBasedVideo.OnPaidEvent += HandlePaidEvent; RequestRewardBasedVideo(); #if UNITY_IOS var trackingStatus = ATTrackingStatusBinding.GetAuthorizationTrackingStatus(); Debug.Log($"ATTrackingStatusBinding.GetAuthorizationTrackingStatus()={trackingStatus}"); switch (trackingStatus) { case ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED: ATTrackingStatusBinding.RequestAuthorizationTracking(); break; case ATTrackingStatusBinding.AuthorizationTrackingStatus.AUTHORIZED: AudienceNetwork.AdSettings.SetAdvertiserTrackingEnabled(true); break; case ATTrackingStatusBinding.AuthorizationTrackingStatus.RESTRICTED: case ATTrackingStatusBinding.AuthorizationTrackingStatus.DENIED: AudienceNetwork.AdSettings.SetAdvertiserTrackingEnabled(false); break; } #endif }
void Start() { if (PlayerPrefs.HasKey("HighScore")) { highScore = PlayerPrefs.GetInt("HighScore"); } if (PlayerPrefs.GetInt("GameContinued") == 1) { score = PlayerPrefs.GetInt("GameContinueScore"); scoreText.text = "SCORE: " + score.ToString(); if (score >= highScore) { scoreText.color = Color.yellow; } } cam = Camera.main; height = 2f * cam.orthographicSize; width = height * cam.aspect; screenMin = -1f * width / 2; screenMax = 1f * width / 2; heightMin = -1f * height / 2; heightMax = 1f * height / 2; coinSpawnRate = Random.Range(minCoinSpawnRate, maxCoinSpawnRate); cubeEnemySpawnRate = Random.Range(minCubeEnemySpawnRate, maxCubeEnemySpawnRate); badPotionSpawnRate = Random.Range(minBadPotionSpawnRate, maxBadPotionSpawnRate); circleEnemySpawnRate = Random.Range(minCircleEnemySpawnRate, maxCircleEnemySpawnRate); heartSpawnRate = Random.Range(minHeartSpawnRate, maxHeartSpawnRate); List <string> deviceIds = new List <string>(); deviceIds.Add("ee4ec563d1de0b1daa96d57376b9bbc6"); deviceIds.Add("23baaa41c248b5765cc77f732a706877"); RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetTestDeviceIds(deviceIds).build(); MobileAds.SetRequestConfiguration(requestConfiguration); Time.timeScale = 1f; hearts = new List <GameObject>(); whiteHearts = new List <GameObject>(); for (int i = 0; i < 3; i++) { whiteHearts.Add((GameObject)Instantiate(whiteHeartPrefab, new Vector2((screenMin + (0.8f * i + heartXOffset)), cam.transform.position.y - heightMax + heartYOffset), Quaternion.identity)); } }
void Start() { // init MobileAds.Initialize(initStatus => { }); RequestBanner(); List <string> deviceIds = new List <string> { "9C49BF91A8843A303BC5E65EF2FCE985", "5A436D87B8422ACF30CF5BCD1CBC704A" }; RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetTestDeviceIds(deviceIds).build(); MobileAds.SetRequestConfiguration(requestConfiguration); }
private void Start() { // if server Ad Units is enabled then use server units: if (serverAdUnitsEnabled) { idBanner = (string.IsNullOrEmpty(AdmobServerAdUnits.BannerId)) ? idBanner : AdmobServerAdUnits.BannerId; idInterstitial = (string.IsNullOrEmpty(AdmobServerAdUnits.InterstitialId)) ? idInterstitial : AdmobServerAdUnits.InterstitialId; idReward = (string.IsNullOrEmpty(AdmobServerAdUnits.RewardId)) ? idReward : AdmobServerAdUnits.RewardId; } #if UNITY_EDITOR //this block is just for debugging in the editor string color; if (AdmobServer.adUnitsLoaded) { color = "yellow"; Debug.Log(">><color=yellow>You're using <b>SERVER</b> ad units :</color>"); } else { color = "orange"; Debug.Log(">><color=orange>You're using default ad units :</color>"); } Debug.Log("<color=" + color + "><b>Banner : </b>" + idBanner + "</color>"); Debug.Log("<color=" + color + "><b>Interstitial : </b>" + idInterstitial + "</color>"); Debug.Log("<color=" + color + "><b>Reward : </b>" + idReward + "</color>"); #endif RequestConfiguration requestConfiguration = new RequestConfiguration.Builder() .SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.Unspecified) .build(); MobileAds.SetRequestConfiguration(requestConfiguration); MobileAds.Initialize(initstatus => { MobileAdsEventExecutor.ExecuteInUpdate(() => { if (OnInitComplete != null) { OnInitComplete.Invoke(); } }); }); }
private void InitializeServices() { GPGSManager.Initialize(false); FirestoreManager.Initialize(); IAPManager.Initialize((status) => purchasesIsReady = true); MobileAds.Initialize((status) => { RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetMaxAdContentRating(_maxAdContentRating).build(); MobileAds.SetRequestConfiguration(requestConfiguration); RewardedAdManager.CreateAndRequestAd(); InterstitialAdManager.CreateAndRequestAd(); adsIsReady = true; }); }
// Start is called before the first frame update void Start() { MobileAds.Initialize(initStatus => { }); List <string> deviceIds = new List <string>(); deviceIds.Add("14A008DCDEBB64EFE258EE71E0835FA1"); RequestConfiguration requestConfiguration = new RequestConfiguration .Builder() .SetTestDeviceIds(deviceIds) .build(); MobileAds.SetRequestConfiguration(requestConfiguration); text.text = "Raul"; string adUnitId; if (Application.platform == RuntimePlatform.Android) { adUnitId = "ca-app-pub-6874205512651144/5373847119"; } else { adUnitId = "Unexpected Platform"; } this.interstitial = new InterstitialAd(adUnitId); AdRequest request = new AdRequest.Builder().Build(); // Load the interstitial with the request. this.interstitial.OnAdClosed += OnInterstitialClose; this.interstitial.OnAdLoaded += HandleOnAdLoaded; this.interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad; this.interstitial.LoadAd(request); if (File.Exists(Application.persistentDataPath + "/gamesave.save")) { continueGameButton.GetComponent <Button>().interactable = true; } }
// Start is called before the first frame update void Start() { MobileAds.Initialize(initStatus => { }); #if UNITY_ANDROID adUnitId = "ca-app-pub-3693486173534414/8716904757"; #elif UNITY_IPHONE adUnitId = "ca-app-pub-3940256099942544/1712485313"; #else adUnitId = "unexpected_platform"; #endif RequestConfiguration requestConfiguration = new RequestConfiguration .Builder() .SetTestDeviceIds(new List <string>() { "7077D997C41C2D19C8ABE05CFDC1EA19", "FCB7C947606E60164A44C2DAF121B8C0" }) .build(); MobileAds.SetRequestConfiguration(requestConfiguration); CreateAdRequest(); }
void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!SceneLoaded) { SceneLoaded = true; MobileAds.Initialize(initStatus => { }); RequestConfiguration childConfig = new RequestConfiguration.Builder().SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.True).build(); MobileAds.SetRequestConfiguration(childConfig); RequestConfiguration contentConfig = new RequestConfiguration.Builder().SetMaxAdContentRating(MaxAdContentRating.G).build(); MobileAds.SetRequestConfiguration(contentConfig); RequestFullScreenAd(); SetupRewardedAds(); if (scene.buildIndex == 0) { RequestBanner(); } SceneLoaded = false; } }
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); }
//public Text statusText; 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). deviceIds.Add("75EF8D155528C04DACBBA6F36F433035"); // 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); }
/// <summary> /// Initializing Admob /// </summary> /// <param name="consent">user consent -> if true show personalized ads</param> /// <param name="platformSettings">contains all required settings for this publisher</param> public void InitializeAds(UserConsent consent, UserConsent ccpaConsent, List <PlatformSettings> platformSettings) { debug = Advertisements.Instance.debug; if (initialized == false) { if (debug) { Debug.Log("Admob Start Initialization"); ScreenWriter.Write("Admob Start Initialization"); } //get settings #if UNITY_ANDROID PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.Android); #endif #if UNITY_IOS PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.iOS); #endif //apply settings interstitialId = settings.idInterstitial.id; bannerId = settings.idBanner.id; rewardedVideoId = settings.idRewarded.id; TagForChildDirectedTreatment tagFororChildren; if (settings.directedForChildren == true) { designedForFamilies = "true"; tagFororChildren = TagForChildDirectedTreatment.True; } else { designedForFamilies = "false"; tagFororChildren = TagForChildDirectedTreatment.Unspecified; } directedForChildren = settings.directedForChildren; RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetTagForChildDirectedTreatment(tagFororChildren).build(); MobileAds.SetRequestConfiguration(requestConfiguration); MobileAds.SetiOSAppPauseOnBackground(true); //verify settings if (debug) { Debug.Log("Admob Banner ID: " + bannerId); ScreenWriter.Write("Admob Banner ID: " + bannerId); Debug.Log("Admob Interstitial ID: " + interstitialId); ScreenWriter.Write("Admob Interstitial ID: " + interstitialId); Debug.Log("Admob Rewarded Video ID: " + rewardedVideoId); ScreenWriter.Write("Admob Rewarded Video ID: " + rewardedVideoId); Debug.Log("Admob Directed for children: " + directedForChildren); ScreenWriter.Write("Admob Directed for children: " + directedForChildren); } //preparing Admob SDK for initialization if (consent == UserConsent.Unset || consent == UserConsent.Accept) { this.consent = "0"; } else { this.consent = "1"; } if (ccpaConsent == UserConsent.Unset || ccpaConsent == UserConsent.Accept) { this.ccpaConsent = "0"; } else { this.ccpaConsent = "1"; } MobileAds.Initialize(InitComplete); initialized = true; } }
//public static AdManager instance; // Start is called before the first frame update void Start() { //if (instance == null) // instance = this; //DontDestroyOnLoad(this); #if UNITY_ANDROID rewardedAdUnitId = "ca-app-pub-3940256099942544/5224354917"; interstitialAdUnitId = "ca-app-pub-3940256099942544/8691691433"; bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111"; #elif UNITY_IOS //rewardedAdUnitId = "ca-app-pub-9179752697212712/7094033959"; //interstitialAdUnitId = "ca-app-pub-9179752697212712/7828686655"; rewardedAdUnitId = "ca-app-pub-3940256099942544/5224354917"; interstitialAdUnitId = "ca-app-pub-3940256099942544/8691691433"; bannerAdUnitId = "ca-app-pub-3940256099942544/6300978111"; #else rewardedAdUnitId = "unexpected_platform"; interstitialAdUnitId = "unexpected_platform"; #endif MobileAds.Initialize(initStatus => { }); List <String> deviceIds = new List <String>() { AdRequest.TestDeviceSimulator }; #if UNITY_ANDROID deviceIds.Add("75EF8D155528C04DACBBA6F36F433035"); deviceIds.Add("864816020118760"); deviceIds.Add("864816020118778"); deviceIds.Add("495ECB59AE9A355C"); #endif RequestConfiguration requestConfiguration = new RequestConfiguration.Builder() .SetTagForChildDirectedTreatment(TagForChildDirectedTreatment.Unspecified) .SetTestDeviceIds(deviceIds).build(); MobileAds.SetRequestConfiguration(requestConfiguration); loadRewardedAd(); loadBannerAds(); loadInterstitialAd(); //// Called when an ad request has successfully loaded. //this.rewardedAd.OnAdLoaded += HandleRewardedAdLoaded; //// Called when an ad request failed to load. //this.rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad; //// Called when an ad is shown. //this.rewardedAd.OnAdOpening += HandleRewardedAdOpening; //// Called when an ad request failed to show. //this.rewardedAd.OnAdFailedToShow += HandleRewardedAdFailedToShow; //// Called when the user should be rewarded for interacting with the ad. //this.rewardedAd.OnUserEarnedReward += HandleUserEarnedReward; //// Called when the ad is closed. //this.rewardedAd.OnAdClosed += HandleRewardedAdClosed; interstitialAdEventSubscribe(); //// Called when an ad request has successfully loaded. //this.interstitialAd.OnAdLoaded += HandleOnAdLoaded; //// Called when an ad request failed to load. //this.interstitialAd.OnAdFailedToLoad += HandleOnAdFailedToLoad; //// Called when an ad is shown. //this.interstitialAd.OnAdOpening += HandleOnAdOpened; //// Called when the ad is closed. //this.interstitialAd.OnAdClosed += HandleOnAdClosed; //// Called when the ad click caused the user to leave the application. //this.interstitialAd.OnAdLeavingApplication += HandleOnAdLeavingApplication; }
/// <summary> /// Initialize. /// </summary> public void Initialize(Action onCompleteCallback = null) { #if DEBUG_MY_ADMOB Debug.Log("[" + typeof(MyAdMobManager).Name + "] Initialize()"); #endif if (mTestEnable && mTestDeviceId.Length > 0) { if (mTestUseGoogleAdsId) { mAndroidDefaultBannerId = "ca-app-pub-3940256099942544/6300978111"; mAndroidDefaultInterstitialAdId = "ca-app-pub-3940256099942544/1033173712"; mAndroidDefaultRewardedAdId = "ca-app-pub-3940256099942544/5224354917"; mIosDefaultBannerId = "ca-app-pub-3940256099942544/2934735716"; mIosDefaultInterstitialAdId = "ca-app-pub-3940256099942544/4411468910"; mIosDefaultRewardedAdId = "ca-app-pub-3940256099942544/1712485313"; #if UNITY_ANDROID PlayerPrefs.SetString("MyAdMobManager_BannerId", mAndroidDefaultBannerId); PlayerPrefs.SetString("MyAdMobManager_InterstitialAdId", mAndroidDefaultInterstitialAdId); PlayerPrefs.SetString("MyAdMobManager_RewardedAdId", mAndroidDefaultRewardedAdId); #elif UNITY_IOS PlayerPrefs.SetString("MyAdMobManager_BannerId", mIosDefaultBannerId); PlayerPrefs.SetString("MyAdMobManager_InterstitialAdId", mIosDefaultInterstitialAdId); PlayerPrefs.SetString("MyAdMobManager_RewardedAdId", mIosDefaultRewardedAdId); #endif } List <string> deviceIds = new List <string>(); deviceIds.AddRange(mTestDeviceId.Split(';')); RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetTestDeviceIds(deviceIds).build(); MobileAds.SetRequestConfiguration(requestConfiguration); } MobileAds.Initialize(initStatus => { #if DEBUG_MY_ADMOB Debug.Log("[" + typeof(MyAdMobManager).Name + "] Initialize(): completed"); #endif mIsInitialized = true; if (onCompleteCallback != null) { onCompleteCallback(); } }); #if USE_MY_ADMOB_APPLOVIN AppLovin.Initialize(); AppLovin.SetHasUserConsent(true); #endif #if USE_MY_ADMOB_MOPUB MoPub.InitializeSdk("8c09b6f2cb324838acf2fdad6899f5a8"); #endif #if USE_MY_ADMOB_UNITY_ADS UnityAds.SetGDPRConsentMetaData(true); #endif #if USE_MY_ADMOB_VUNGLE Vungle.UpdateConsentStatus(VungleConsent.ACCEPTED); #endif }