private void CreateInterstitialsSection() { GUILayout.Space((float)this._sectionMarginSize); GUILayout.Label("Interstitials", Array.Empty <GUILayoutOption>()); if (!IsAdUnitArrayNullOrEmpty(this._interstitialAdUnits)) { foreach (string str in this._interstitialAdUnits) { GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUI.set_enabled(!this._adUnitToLoadedMapping[str]); if (GUILayout.Button(CreateRequestButtonLabel(str), Array.Empty <GUILayoutOption>())) { Debug.Log("requesting interstitial with AdUnit: " + str); this.UpdateStatusLabel("Requesting " + str); MoPubAndroid.RequestInterstitialAd(str, string.Empty, string.Empty); } GUI.set_enabled(this._adUnitToLoadedMapping[str]); if (GUILayout.Button("Show", Array.Empty <GUILayoutOption>())) { this.ClearStatusLabel(); MoPubAndroid.ShowInterstitialAd(str); } GUI.set_enabled(true); GUILayout.EndHorizontal(); } } else { GUILayout.Label("No interstitial AdUnits available", this._smallerFont, null); } }
private void OnRewardedVideoLoadedEvent(string adUnitId) { List <MoPubBase.Reward> availableRewards = MoPubAndroid.GetAvailableRewards(adUnitId); this._demoGUI.AdLoaded(adUnitId); this._demoGUI.LoadAvailableRewards(adUnitId, availableRewards); }
public override void doRequest() { base.LogFunc("doRequest()"); AdsRequestHelper.DebugLog("MoPub.RequestInterstitialAd(" + base.adUnitId + ")"); MoPubAndroid.RequestInterstitialAd(base.adUnitId, string.Empty, string.Empty); base.callback.onRequest(this, "Mopub"); }
private void InternalRewardedRequest() { this.rewardLoadReqTime = DateTime.Now; MoPubAndroid.RequestRewardedVideo(this.rewardUnit, null, null, null, 99999.0, 99999.0, null); AdsManager.Instance.rewardInfo.IterateRequest(); AnalyticsManager.RewardRequest(AdsManager.Instance.rewardInfo); }
private void Start() { MoPubBase.SdkConfiguration sdkConfiguration = default(MoPubBase.SdkConfiguration); sdkConfiguration.AdUnitId = _interstitialAdUnits[0]; sdkConfiguration.NetworksToInit = new MoPubBase.RewardedNetwork[9] { MoPubBase.RewardedNetwork.AdColony, MoPubBase.RewardedNetwork.Facebook, MoPubBase.RewardedNetwork.Unity, MoPubBase.RewardedNetwork.AdMob, MoPubBase.RewardedNetwork.AppLovin, MoPubBase.RewardedNetwork.Chartboost, MoPubBase.RewardedNetwork.IronSource, MoPubBase.RewardedNetwork.Tapjoy, MoPubBase.RewardedNetwork.Vungle }; sdkConfiguration.AdvancedBidders = new MoPubBase.AdvancedBidder[1] { MoPubBase.AdvancedBidder.Facebook }; MoPubBase.SdkConfiguration sdkConfiguration2 = sdkConfiguration; MoPubAndroid.InitializeSdk(sdkConfiguration2); MoPubAndroid.LoadBannerPluginsForAdUnits(_bannerAdUnits); MoPubAndroid.LoadInterstitialPluginsForAdUnits(_interstitialAdUnits); MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(_rewardedVideoAdUnits); }
public void InitializeBanner(string bAdUnit, BannerPosition bannerPos) { if (this.bannerEnabled) { return; } if (!string.IsNullOrEmpty(bAdUnit)) { try { this.bannerAdUnit = bAdUnit; this.bannerEnabled = true; this.bannerPosition = ((bannerPos != BannerPosition.Bottom) ? MoPubBase.AdPosition.TopCenter : MoPubBase.AdPosition.BottomCenter); this.InternalInit(this.bannerAdUnit); MoPubAndroid.LoadBannerPluginsForAdUnits(new string[] { this.bannerAdUnit }); } catch (Exception ex) { this.bannerEnabled = false; FMLogger.vAds("failed to init mopab banner. error: " + ex.Message); } this.RequestBanner(); } }
public static void Init(AdsConfiguration config, Action <string> onComplete = null) { if (inst == null) { DebugLog("AdsRequestHelper.Init()"); try { DebugLog("MoPub.InitializeSdk()"); if (onComplete != null) { MoPubManager.OnSdkInitializedEvent += onComplete; } MoPubBase.SdkConfiguration sdkConfiguration = new MoPubBase.SdkConfiguration { AdUnitId = config.mopubRewarded, LogLevel = MoPubBase.LogLevel.MPLogLevelDebug }; sdkConfiguration.MediatedNetworks = new MoPubBase.MediatedNetwork[] { new MoPubBase.SupportedNetwork.AdMob(), new MoPubBase.SupportedNetwork.AppLovin(), new MoPubBase.SupportedNetwork.Facebook(), new MoPubBase.SupportedNetwork.IronSource(), new MoPubBase.SupportedNetwork.Unity() }; MoPubAndroid.InitializeSdk(sdkConfiguration); DebugLog("MoPub.LoadRewardedVideoPluginsForAdUnits()"); string[] rewardedVideoAdUnitIds = new string[] { config.mopubRewarded }; MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(rewardedVideoAdUnitIds); Type[] components = new Type[] { typeof(AdsRequestHelper) }; GameObject target = new GameObject("AdsHelperObject", components); Object.DontDestroyOnLoad(target); inst = target.GetComponent <AdsRequestHelper>(); inst.config = config; } catch (Exception exception) { Debug.LogException(exception); } } }
private void CreateInterstitialsSection() { GUILayout.Space((float)this._sectionMarginSize); GUILayout.Label("Interstitials", new GUILayoutOption[0]); if (!MoPubDemoGUI.IsAdUnitArrayNullOrEmpty(this._interstitialAdUnits)) { foreach (string text in this._interstitialAdUnits) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUI.enabled = !this._adUnitToLoadedMapping[text]; if (GUILayout.Button(MoPubDemoGUI.CreateRequestButtonLabel(text), new GUILayoutOption[0])) { UnityEngine.Debug.Log("requesting interstitial with AdUnit: " + text); this._status = "Requesting " + text; MoPubAndroid.RequestInterstitialAd(text, string.Empty, string.Empty); } GUI.enabled = this._adUnitToLoadedMapping[text]; if (GUILayout.Button("Show", new GUILayoutOption[0])) { this._status = string.Empty; MoPubAndroid.ShowInterstitialAd(text); } GUI.enabled = true; GUILayout.EndHorizontal(); } } else { GUILayout.Label("No interstitial AdUnits available", this._smallerFont, null); } }
public static void InitializeSdk(string anyAdUnitId) { MoPubBase.ValidateAdUnitForSdkInit(anyAdUnitId); MoPubAndroid.InitializeSdk(new MoPubBase.SdkConfiguration { AdUnitId = anyAdUnitId }); }
// Enables/disables location support for banners and interstitials public static void enableLocationSupport(bool shouldUseLocation) { #if UNITY_IPHONE MoPubBinding.enableLocationSupport(true); #elif UNITY_ANDROID MoPubAndroid.setLocationAwareness(MoPubLocationAwareness.NORMAL); #endif }
// Reports an app download to MoPub. iTunesAppId is iOS only. public static void reportApplicationOpen(string iTunesAppId = null) { #if UNITY_IPHONE MoPubBinding.reportApplicationOpen(iTunesAppId); #elif UNITY_ANDROID MoPubAndroid.reportApplicationOpen(); #endif }
public void Check() { string anyAdUnitId = (!SafeLayout.IsTablet) ? "6bc3898062484e71a114d0ab59cb1c78" : "0543e571406140dd96252ac1351b99f5"; this.time = DateTime.UtcNow; MoPubAndroid.InitializeSdk(anyAdUnitId); FMLogger.vCore("mopub pre int consent status " + MoPubAndroid.CurrentConsentStatus); }
private IEnumerator BannerHideWorkaround() { yield return(0); FMLogger.vAds("hide banner after req on next frame. workaround"); MoPubAndroid.ShowBanner(this.bannerAdUnit, false); yield break; }
private void InternalInit(string anyAdUnit) { if (this.inited || string.IsNullOrEmpty(anyAdUnit)) { return; } MoPubAndroid.InitializeSdk(anyAdUnit); this.inited = true; }
public void HideBanner() { if (!this.bannerEnabled) { return; } FMLogger.vAds("hide banner inv"); MoPubAndroid.ShowBanner(this.bannerAdUnit, false); this.bannerVisable = false; }
public void UtilizeBanner() { if (!this.bannerEnabled) { return; } this.bannerEnabled = false; FMLogger.vAds("utilize banner inv"); MoPubAndroid.DestroyBanner(this.bannerAdUnit); }
public void RequestInterstitial() { if (!this.fsEnabled) { return; } this.fsLoadReqTime = DateTime.Now; MoPubAndroid.RequestInterstitialAd(this.interstitialAdUnit, string.Empty, string.Empty); FMLogger.vAds("start fs request"); }
public void RequestRewarded() { if (Application.internetReachability == NetworkReachability.NotReachable) { Invoke("RequestRewarded", 1f); } else if (!isRewardedReady()) { MoPubAndroid.RequestRewardedVideo(_rewardedVideoAdUnits[0]); } }
private void RequestBanner() { if (PlayerPrefsManager.GetNoAd() == 1) { HideBanner(); } else { MoPubAndroid.CreateBanner(_bannerAdUnits[0], MoPubBase.AdPosition.BottomCenter); } }
public void ShowRewardedVideo() { if (!this.rewardedEnabled) { return; } FMLogger.vAds("show rewarded"); this.rewardReceived = false; MoPubAndroid.ShowRewardedVideo(this.rewardUnit, null); AdsManager.Instance.rewardInfo.IterateImpression(); AnalyticsManager.RewardImpression(this.rewardUnit, AdsManager.Instance.rewardInfo); }
public void ShowInterstitial(AdPlacement fsPlacement) { if (!this.fsEnabled) { return; } this.fsAdPlacement = AdConfig.AdPlacementToString(fsPlacement); FMLogger.vAds("fs show inv"); MoPubAndroid.ShowInterstitialAd(this.interstitialAdUnit); this.hasLoadedInterstitial = false; AnalyticsManager.FsImpression(this.interstitialAdUnit, this.fsAdPlacement); }
public void RequestBanner() { if (!this.bannerEnabled) { return; } MoPubAndroid.CreateBanner(this.bannerAdUnit, this.bannerPosition); if (!this.bannerVisable) { this.coroutineProxy(this.BannerHideWorkaround()); } FMLogger.vAds("start banner request"); }
public void RequestInterstitial() { if (PlayerPrefsManager.GetNoAd() != 1) { if (Application.internetReachability == NetworkReachability.NotReachable) { Invoke("RequestInterstitial", 1f); } else if (!interstitialAvailable) { MoPubAndroid.RequestInterstitialAd(_interstitialAdUnits[0], string.Empty, string.Empty); } } }
private void CreateActionsSection() { GUILayout.Space((float)this._sectionMarginSize); GUILayout.Label("Actions", Array.Empty <GUILayoutOption>()); if (GUILayout.Button("Report App Open", Array.Empty <GUILayoutOption>())) { this.ClearStatusLabel(); MoPubAndroid.ReportApplicationOpen(null); } if (GUILayout.Button("Enable Location Support", Array.Empty <GUILayoutOption>())) { this.ClearStatusLabel(); MoPubAndroid.EnableLocationSupport(true); } }
public void ShowBanner() { if (PlayerPrefsManager.GetNoAd() == 0) { if (isBannerAtTop) { MoPubAndroid.CreateBanner(_bannerAdUnits[0], MoPubBase.AdPosition.TopCenter); MoPubAndroid.ShowBanner(_bannerAdUnits[0], shouldShow: true); } else { MoPubAndroid.ShowBanner(_bannerAdUnits[0], shouldShow: true); } } }
public void ShowBanner() { if (!this.bannerEnabled) { return; } FMLogger.vAds("show banner inv"); MoPubAndroid.ShowBanner(this.bannerAdUnit, true); this.bannerVisable = true; if (this.userBannerImpression) { this.userBannerImpression = false; AnalyticsManager.BannerImpression(this.bannerAdUnit, this.currentBannerGUID, AdsManager.Instance.IsTabletAdUnit, this.bannerPosition == MoPubBase.AdPosition.BottomCenter); } }
private void Start() { string anyAdUnitId = this._bannerAdUnits[0]; MoPubAndroid.InitializeSdk(anyAdUnitId); MoPubAndroid.LoadBannerPluginsForAdUnits(this._bannerAdUnits); MoPubAndroid.LoadInterstitialPluginsForAdUnits(this._interstitialAdUnits); MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(this._rewardedVideoAdUnits); MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(this._rewardedRichMediaAdUnits); GameObject gameObject = GameObject.Find("MoPubNativeAds"); if (gameObject != null) { gameObject.SetActive(false); } }
public void ShowRewarded(string type) { if (isRewardedReady()) { UnityEngine.Debug.Log("************ SHOWING REWARDED*************"); rewardedOpened = true; rewardedType = type; MoPubAndroid.ShowRewardedVideo(_rewardedVideoAdUnits[0]); } else { RequestRewarded(); rewardedOpened = false; UnityEngine.Debug.Log("************ REWARDED NOT LOADED*************"); } }
private void onAdLoadedEvent(string adUnit, float height) { this.currentBannerGUID = AnalyticsUtils.GenerateGUID(); this.userBannerImpression = true; FMLogger.vAds("onAdLoadedEvent. height: " + height); if (this.bannerVisable) { this.userBannerImpression = false; AnalyticsManager.BannerImpression(this.bannerAdUnit, this.currentBannerGUID, AdsManager.Instance.IsTabletAdUnit, this.bannerPosition == MoPubBase.AdPosition.BottomCenter); } else { FMLogger.vAds("hide banner loaded event. workaround"); MoPubAndroid.ShowBanner(this.bannerAdUnit, false); } }
private void CreateActionsSection() { GUILayout.Space((float)this._sectionMarginSize); GUILayout.Label("Actions", new GUILayoutOption[0]); if (GUILayout.Button("Report App Open", new GUILayoutOption[0])) { this._status = string.Empty; MoPubAndroid.ReportApplicationOpen(null); } if (!GUILayout.Button("Enable Location Support", new GUILayoutOption[0])) { return; } this._status = string.Empty; MoPubAndroid.EnableLocationSupport(true); }