Use the VideoInterstitialAdUnit
object to create and configure an interstitial ad unit in your app.
Currently Google Ad Manager is the only supported ad server. We plan to provide support for additional ad servers in subsequent releases.
Create a new Video Interstitial Ad Unit associated with a Prebid Server configuration ID.
VideoInterstitialAdUnit("configId");
Parameters
configId
: String; Prebid Server configuration ID.
VideoInterstitialAdUnit
inherits all methods from the AdUnit object.
Google Ad Manager
AdUnit adUnit;
private PublisherInterstitialAd amInterstitial;
private void setupAndLoadAMInterstitialVAST() {
setupPBInterstitialVAST();
setupAMInterstitialVAST();
loadInterstitial();
}
private void setupPBInterstitialVAST() {
PrebidMobile.setPrebidServerHost(Host.RUBICON);
PrebidMobile.setPrebidServerAccountId("AccountID");
adUnit = new VideoInterstitialAdUnit("configID");
}
private void setupAMInterstitialVAST() {
setupAMInterstitial("/networkId/adUnit");
}
private void setupAMInterstitial(String id) {
amInterstitial = new PublisherInterstitialAd(this);
amInterstitial.setAdUnitId(id);
}
private void loadInterstitial() {
PublisherAdRequest.Builder builder = new PublisherAdRequest.Builder();
final PublisherAdRequest request = builder.build();
adUnit.fetchDemand(request, new OnCompleteListener() {
@Override
public void onComplete(ResultCode resultCode) {
DemoActivity.this.resultCode = resultCode;
}
});
}