use of com.google.android.gms.ads.admanager.AdManagerInterstitialAd in project prebid-mobile-android by prebid.
the class PublisherInterstitialAdWrapperTest method onGamAdLoadedAppEventExpected_NotifyLoadedListener.
@Test
public void onGamAdLoadedAppEventExpected_NotifyLoadedListener() {
final AdManagerInterstitialAdLoadCallback listener = getAdLoadCallback();
final AdManagerInterstitialAd mock = mock(AdManagerInterstitialAd.class);
listener.onAdLoaded(mock);
verify(mMockListener, times(1)).onEvent(AdEvent.LOADED);
}
use of com.google.android.gms.ads.admanager.AdManagerInterstitialAd in project prebid-mobile-android by prebid.
the class XandrInterstitialGamDemoActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
PrebidMobile.setPrebidServerHost(Host.APPNEXUS);
PrebidMobile.setPrebidServerAccountId(Constants.PBS_ACCOUNT_ID_APPNEXUS);
adUnit = new InterstitialAdUnit(Constants.PBS_CONFIG_ID_INTERSTITIAL_APPNEXUS);
int millis = getIntent().getIntExtra(Constants.AUTO_REFRESH_NAME, 0);
adUnit.setAutoRefreshPeriodMillis(millis);
final AdManagerAdRequest.Builder builder = new AdManagerAdRequest.Builder();
adUnit.fetchDemand(builder, new OnCompleteListener() {
@Override
public void onComplete(ResultCode resultCode) {
AdManagerAdRequest request = builder.build();
AdManagerInterstitialAd.load(XandrInterstitialGamDemoActivity.this, Constants.DFP_INTERSTITIAL_ADUNIT_ID_APPNEXUS, request, new AdManagerInterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull AdManagerInterstitialAd adManagerInterstitialAd) {
super.onAdLoaded(adManagerInterstitialAd);
adManagerInterstitialAd.show(XandrInterstitialGamDemoActivity.this);
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(XandrInterstitialGamDemoActivity.this, android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(XandrInterstitialGamDemoActivity.this);
}
builder.setTitle("Failed to load AdManager interstitial ad").setMessage("Error: " + loadAdError.toString()).setIcon(android.R.drawable.ic_dialog_alert).show();
}
});
}
});
}
use of com.google.android.gms.ads.admanager.AdManagerInterstitialAd in project prebid-mobile-android by prebid.
the class RubiconInterstitialGamDemoActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
PrebidMobile.setPrebidServerHost(Host.RUBICON);
PrebidMobile.setPrebidServerAccountId(Constants.PBS_ACCOUNT_ID_RUBICON);
PrebidMobile.setStoredAuctionResponse(Constants.PBS_STORED_RESPONSE_300x250_RUBICON);
adUnit = new InterstitialAdUnit(Constants.PBS_CONFIG_ID_INTERSTITIAL_RUBICON);
int millis = getIntent().getIntExtra(Constants.AUTO_REFRESH_NAME, 0);
adUnit.setAutoRefreshPeriodMillis(millis);
final AdManagerAdRequest.Builder builder = new AdManagerAdRequest.Builder();
adUnit.fetchDemand(builder, new OnCompleteListener() {
@Override
public void onComplete(ResultCode resultCode) {
AdManagerAdRequest request = builder.build();
AdManagerInterstitialAd.load(RubiconInterstitialGamDemoActivity.this, Constants.DFP_INTERSTITIAL_ADUNIT_ID_RUBICON, request, new AdManagerInterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull AdManagerInterstitialAd adManagerInterstitialAd) {
super.onAdLoaded(adManagerInterstitialAd);
adManagerInterstitialAd.show(RubiconInterstitialGamDemoActivity.this);
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(RubiconInterstitialGamDemoActivity.this, android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(RubiconInterstitialGamDemoActivity.this);
}
builder.setTitle("Failed to load AdManager interstitial ad").setMessage("Error: " + loadAdError.toString()).setIcon(android.R.drawable.ic_dialog_alert).show();
}
});
refreshCount++;
RubiconInterstitialGamDemoActivity.this.resultCode = resultCode;
}
});
}
use of com.google.android.gms.ads.admanager.AdManagerInterstitialAd in project prebid-mobile-android by prebid.
the class RubiconInterstitialVideoGamDemoActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
PrebidMobile.setPrebidServerHost(Host.RUBICON);
PrebidMobile.setPrebidServerAccountId(Constants.PBS_ACCOUNT_ID_RUBICON);
PrebidMobile.setStoredAuctionResponse(Constants.PBS_STORED_RESPONSE_VAST_RUBICON);
VideoBaseAdUnit.Parameters parameters = new VideoBaseAdUnit.Parameters();
parameters.setMimes(Arrays.asList("video/mp4"));
parameters.setProtocols(Arrays.asList(Signals.Protocols.VAST_2_0));
// parameters.setProtocols(Arrays.asList(new Signals.Protocols(2)));
parameters.setPlaybackMethod(Arrays.asList(Signals.PlaybackMethod.AutoPlaySoundOff));
// parameters.setPlaybackMethod(Arrays.asList(new Signals.PlaybackMethod(2)));
VideoInterstitialAdUnit adUnit = new VideoInterstitialAdUnit("1001-1");
adUnit.setParameters(parameters);
this.adUnit = adUnit;
int millis = getIntent().getIntExtra(Constants.AUTO_REFRESH_NAME, 0);
adUnit.setAutoRefreshPeriodMillis(millis);
final AdManagerAdRequest.Builder builder = new AdManagerAdRequest.Builder();
adUnit.fetchDemand(builder, new OnCompleteListener() {
@Override
public void onComplete(ResultCode resultCode) {
AdManagerAdRequest request = builder.build();
AdManagerInterstitialAd.load(RubiconInterstitialVideoGamDemoActivity.this, Constants.DFP_VAST_ADUNIT_ID_RUBICON, request, new AdManagerInterstitialAdLoadCallback() {
@Override
public void onAdLoaded(@NonNull AdManagerInterstitialAd adManagerInterstitialAd) {
super.onAdLoaded(adManagerInterstitialAd);
adManagerInterstitialAd.show(RubiconInterstitialVideoGamDemoActivity.this);
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
super.onAdFailedToLoad(loadAdError);
AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(RubiconInterstitialVideoGamDemoActivity.this, android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(RubiconInterstitialVideoGamDemoActivity.this);
}
builder.setTitle("Failed to load AdManager interstitial ad").setMessage("Error: " + loadAdError.toString()).setIcon(android.R.drawable.ic_dialog_alert).show();
}
});
}
});
}
Aggregations