Check if the platform supports displaying banner ads. Use this to determine if you can include banner advertisements in your game.
// Possible values: true, false
Bridge.advertisement.isBannerSupported
Display a banner ad within your game to generate revenue through advertising.
private void Start()
{
var options = new Dictionary<string, object>();
switch (Bridge.platform.id)
{
case "vk":
options.Add("position", "bottom");
options.Add("layoutType", "resize");
options.Add("canClose", false);
break;
case "crazy_games":
options.Add("position", "top"); // optional, default = "bottom"
break;
case "game_distribution":
options.Add("position", "top"); // optional, default = "bottom"
break;
case "msn":
options.Add("position", "top:728x90"); // optional, default = "top:728x90"
}
Bridge.advertisement.ShowBanner(options);
}
Hide the currently displayed banner ad when it is no longer needed.
Bridge.advertisement.HideBanner()
Monitor the state of the banner ad (loading, shown, hidden, failed) to manage its display and troubleshoot issues.
Bridge.advertisement.bannerState
// To track banner state changes, subscribe to the event
private void Start()
{
Bridge.advertisement.bannerStateChanged += OnBannerStateChanged;
}
private void OnBannerStateChanged(BannerState state)
{
Debug.Log(state);
}