-
Notifications
You must be signed in to change notification settings - Fork 1
HyBid Interstitials
Interstitials will be rendered using the HyBid SDK.
Requirements:
- Ad Zone Id from the PubNative Publisher Dashboard
You can find a demo app with code samples for this type of integration here.
private HyBidInterstitialAd mInterstitial;
Create an instance of the interstitial object using the zone id and setting a listener. Use the load method to make an ad request.
private void loadInterstitial() {
mInterstitial = new HyBidInterstitialAd(this,"ZONE_ID", new HyBidInterstitialAd.Listener() {
@Override
public void onInterstitialLoaded() {
}
@Override
public void onInterstitialLoadFailed(Throwable error) {
}
@Override
public void onInterstitialImpression() {
}
@Override
public void onInterstitialDismissed() {
}
@Override
public void onInterstitialClick() {
}
});
mInterstitial.load();
}
After the ad is successfully retrieved from the server, the onInterstitialLoaded callback will notify that the ad is ready to be displayed.
You can display the interstitial as soon as it's loaded using after getting the callback. Use the show method to display the ad:
mInterstitial = new HyBidInterstitialAd(this,"", new HyBidInterstitialAd.Listener() {
@Override
public void onInterstitialLoaded() {
mInterstitial.show();
}
@Override
public void onInterstitialLoadFailed(Throwable error) {
}
@Override
public void onInterstitialImpression() {
}
@Override
public void onInterstitialDismissed() {
}
@Override
public void onInterstitialClick() {
}
});
if you don't want to show the ad right away after being loaded, you can use the isReady method that returns a boolean stating if the ad has been loaded and is ready to be displayed.
if (mInterstitial.isReady()) {
mInterstitial.show();
}
Finally destroy the interstitial when the activity or fragment are destroyed
@Override
public void onDestroy() {
if (mInterstitial != null) {
mInterstitial.destroy();
}
super.onDestroy();
}
Project setup
Displaying ads using HyBid
Displaying Ads with Header Bidding with GAM (DFP)
Mediation
Unity Mediation
Misc