Banners - uc-union/union-ads-sdk-demo GitHub Wiki
Note: Be sure that SDK is initialzed correctly, see Initialize SDK.
Banner ad is provided to dvelopers in the form of Android View
. Developers can set its placement and size with great flexibility.
Example codes are listed below, for a complete example please refer to BannerFragment.java
final BannerAdView adView = new BannerAdView(MainActivity.this);
adView.setAdListener(new AdListener() {
@Override
public void onAdLoaded(Ad ad) {
}
@Override
public void onAdClosed(Ad ad) {
}
@Override
public void onAdShowed(Ad ad) {
}
@Override
public void onAdClicked(Ad ad) {
}
@Override
public void onAdError(Ad ad, AdError adError) {
}
});
AdRequest adRequest = AdRequest.newBuilder()
.pub(<Pub>)
.build();
adView.loadAd(adRequest);
NOTE:
- Banner ads only support using API via source-code. Banner ads do not support using API through direct configuration in xml file
<Pub>
is a unique id for the ad placement, please get it from uc union manager console or your BD
Once you run the demo project and show the banner ad, you should see something like this:
-
Follow our guide on Interstitial to add interstitial ads in your app.
-
See FAQ to know about the frequently asked questions.
-
See API reference to explore all APIs in Union Ad SDK.