Bidapp Ads
  • 🎁Ab_dout
  • Integration
    • iOS
      • Getting started
      • Additional Settings
      • App Policy Settings
      • Serverless Settings
      • Interstitial Ads
      • Rewarded Ads
      • Banner Ads
      • SKAdNetwork
      • SwiftUI
    • Android
      • Getting started
      • Additional Settings
      • App Policy Settings
      • Serverless Settings
      • Interstitial Ads
      • Rewarded Ads
      • Banner Ads
      • Jetpack Compose
  • PLUGINS
    • Kotlin Multiplatform
      • Getting started
      • Android Platform Setup
      • iOS Platfrom Setup
      • App Policy Settings
      • Interstitial Ads
      • Rewarded Ads
      • Banner Ads
    • Unreal Engine
      • Getting started
      • App Policy Settings
      • Interstitial Ads
      • Rewarded Ads
      • Banner Ads
      • MREC
    • Unity
      • Getting started
      • Android
      • iOS
      • App Policy Settings
      • Interstitial Ads
      • Rewarded Ads
      • Banner Ads
Powered by GitBook
On this page
  • Load and Show
  • Refresh
  • Destroy with resource release
  • Callbacks / Delegates / Events
  • Register
  • Observe
  • Release

Was this helpful?

  1. PLUGINS
  2. Unity

Banner Ads

Load and Show

Banner Ads start loading automatically right after creation an instance.

Use the following code to create and show banners 320x50 banner:

string bannerIdentifier = BidappBinding.Instance.ShowBannerAtPosition(
    BidappBannerPosition.BottomCenter,
    BidappBannerSize.Size_320x50
);

or, alternatively -

string bannerIdentifier = BidappBinding.Instance.ShowBanner(
    BidappBannerSize.Size_320x50,
    0f, 100f, 320f, 50f
);

To show the 300x250 banner you should use the following code:

string bannerIdentifier = BidappBinding.Instance.ShowBannerAtPosition(
    BidappBannerPosition.BottomCenter,
    BidappBannerSize.Size_300x250
);

or, alternatively -

string bannerIdentifier = BidappBinding.Instance.ShowBanner(
    BidappBannerSize.Size_300x250,
    0f, 100f, 320f, 50f
);

Refresh

To manually refresh an ad on banner you should call the refreshBanner function:

BidappBinding.Instance.RefreshBanner(bannerIdentifier);

Alternatively, a banner can refresh itself automatically by timer. To start banner autorefresh you should use the following code:

float newRefreshInterval = 30f // 30 seconds
BidappBinding.Instance.SetBannerRefreshInterval(bannerIdentifier, newRefreshInterval);

You can also stop autorefresh when it is no longer needed:

BidappBinding.Instance.StopAutorefresh()

Destroy with resource release

If you need to destroy the banner and free resources, you should use the following method:

BidappBinding.Instance.RemoveBanner(bannerIdentifier);

RemoveBanner functions will also unregister all callback receiver instances, registered for the specified bannerIdentifier

Callbacks / Delegates / Events

Register

To be able to register banner callbacks receiver you will need to inherit it from IBidappBannerDelegate

public class BidappBannerDelegate : IBidappBannerDelegate

Then you need to register receiver of the callbacks for banner instance identifier:

BidappSDKDelegate.Instance.SetBannerDelegate(
    new BidappBannerDelegate(),
    bannerIdentifier
);

Observe

You can observe banner events by specifying the delegate:

public void OnBannerDidDisplayAd(string identifier, string networkId)
{
    Debug.Log($"BIDUnity OnBannerDidDisplayAd: bannerId {identifier}, providerId: {networkId}");
}

public void OnBannerFailedToDisplayAd(string identifier, string networkId, string errorDescription)
{
    Debug.Log($"BIDUnity OnBannerFailedToDisplayAd: bannerId {identifier}, providerId: {networkId}, errorDescription: {errorDescription}");
}

public void OnBannerAllNetworksFailedToDisplayAd(string identifier)
{
    Debug.Log($"BIDUnity OnBannerAllNetworksFailedToDisplayAd: bannerId {identifier}");
}

public void OnBannerClicked(string identifier, string networkId)
{
    Debug.Log($"BIDUnity OnBannerClicked: bannerId {identifier}, providerId: {networkId}");
}

Release

If you don't want to receive callbacks anymore you can unregister callback receiver instance:

BidappSDKDelegate.Instance.SetBannerDelegate(
    null,
    bannerIdentifier
);
PreviousRewarded Ads

Last updated 3 months ago

Was this helpful?