/// <summary> /// Requests a banner ad and immediately shows it once loaded. /// <para> /// For platform-specific implementations, see /// MoPubAndroid.<see cref="MoPubAndroid.RequestBanner(string,MoPub.AdPosition,MoPub.MaxAdSize)"/> /// and MoPubiOS.<see cref="MoPubiOS.RequestBanner(string,MoPub.AdPosition,MoPub.MaxAdSize)"/>. /// </para> /// </summary> /// <param name="adUnitId">A string with the ad unit id.</param> /// <param name="position">Where in the screen to position the loaded ad. See <see cref="MoPub.AdPosition"/>. /// </param> /// <param name="maxAdSize">The maximum size of the banner to load. See <see cref="MoPub.MaxAdSize"/>.</param> public static void RequestBanner(string adUnitId, AdPosition position, MaxAdSize maxAdSize = MaxAdSize.Width320Height50) { MoPubLog.Log("RequestBanner", MoPubLog.AdLogEvent.LoadAttempted); MoPubLog.Log("RequestBanner", "Size requested: " + maxAdSize.Width() + "x" + maxAdSize.Height()); RequestAdUnit(adUnitId); ForceRefresh(adUnitId); }
/// <summary> /// Requests a banner ad and immediately shows it once loaded. /// </summary> /// <param name="adUnitId">A string with the ad unit id.</param> /// <param name="position">Where in the screen to position the loaded ad. See <see cref="MoPub.AdPosition"/>. /// </param> /// <param name="maxAdSize">The maximum size of the banner to load. See <see cref="MoPub.MaxAdSize"/>.</param> /// <param name="keywords">An optional comma-separated string with the desired non-PII keywords for this ad.</param> /// <param name="userDataKeywords">An optional comma-separated string with the desired PII keywords for this ad. /// </param> public static void RequestBanner(string adUnitId, AdPosition position, MaxAdSize maxAdSize = MaxAdSize.Width320Height50, string keywords = "", string userDataKeywords = "") { var width = maxAdSize.Width(); var height = maxAdSize.Height(); MoPubLog.Log("RequestBanner", MoPubLog.AdLogEvent.LoadAttempted); MoPubLog.Log("RequestBanner", "Size requested: " + width + "x" + height); AdUnitManager.GetAdUnit(adUnitId).RequestBanner(width, height, position, keywords, userDataKeywords); }
/// See MoPubUnityEditor.<see cref="MoPubUnityEditor.RequestBanner(string,MoPub.AdPosition,MoPub.MaxAdSize)"/> public static void RequestBanner(string adUnitId, AdPosition position, MaxAdSize maxAdSize = MaxAdSize.Width320Height50) { MoPubLog.Log("RequestBanner", MoPubLog.AdLogEvent.LoadAttempted); MoPubLog.Log("RequestBanner", "Size requested: " + maxAdSize.Width() + "x" + maxAdSize.Height()); MPBanner plugin; if (BannerPluginsDict.TryGetValue(adUnitId, out plugin)) { plugin.RequestBanner(maxAdSize.Width(), maxAdSize.Height(), position); } else { ReportAdUnitNotFound(adUnitId); } }
/// <summary> /// Requests a banner ad and immediately shows it once loaded. /// </summary> /// <param name="adUnitId">A string with the ad unit id.</param> /// <param name="position">Where in the screen to position the loaded ad. See <see cref="MoPub.AdPosition"/>. /// </param> /// <param name="maxAdSize">The maximum size of the banner to load. See <see cref="MoPub.MaxAdSize"/>.</param> public static void RequestBanner(string adUnitId, AdPosition position, MaxAdSize maxAdSize = MaxAdSize.Width320Height50) { ValidateInit(); var width = maxAdSize.Width(); var height = maxAdSize.Height(); MoPubLog.Log("RequestBanner", MoPubLog.AdLogEvent.LoadAttempted); MoPubLog.Log("RequestBanner", "Size requested: " + width + "x" + height); MoPubAdUnit plugin; if (AdUnits.TryGetValue(adUnitId, out plugin)) { plugin.RequestBanner(width, height, position); } else { ReportAdUnitNotFound(adUnitId); } }