use of com.my.target.ads.InterstitialAd.InterstitialAdListener in project mytarget-android by myTargetSDK.
the class MainActivity method loadAndShowCustomInterstitial.
private void loadAndShowCustomInterstitial(final AdvertisingType advertisingType) {
if (loadingView != null) {
loadingView.setVisibility(View.VISIBLE);
}
final InterstitialAd interstitialAd = new InterstitialAd(advertisingType.getSlotId(), this);
Tools.fillCustomParamsUserData(interstitialAd.getCustomParams());
interstitialAd.setListener(new InterstitialAdListener() {
@Override
public void onLoad(final InterstitialAd ad) {
if (loadingView != null) {
loadingView.setVisibility(View.GONE);
}
interstitialAd.show();
}
@Override
public void onNoAd(final String s, final InterstitialAd ad) {
if (loadingView != null) {
loadingView.setVisibility(View.GONE);
}
Snackbar.make(recyclerView, getString(R.string.no_ad), Snackbar.LENGTH_LONG).show();
}
@Override
public void onClick(final InterstitialAd ad) {
}
@Override
public void onDismiss(final InterstitialAd ad) {
}
@Override
public void onVideoCompleted(final InterstitialAd ad) {
}
@Override
public void onDisplay(final InterstitialAd ad) {
}
});
interstitialAd.load();
}
Aggregations