Java Code Examples for com.applovin.adview.AppLovinInterstitialAdDialog#setAdClickListener()

The following examples show how to use com.applovin.adview.AppLovinInterstitialAdDialog#setAdClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppLovinCustomEventInterstitial.java    From SDK-Network-Adapters with MIT License 6 votes vote down vote up
@Override
public void showInterstitial()
{
    final AppLovinAd preloadedAd = dequeueAd( zoneId );
    if ( preloadedAd != null )
    {
        final AppLovinInterstitialAdDialog interstitialAd = AppLovinInterstitialAd.create( sdk, context );
        interstitialAd.setAdDisplayListener( this );
        interstitialAd.setAdClickListener( this );
        interstitialAd.setAdVideoPlaybackListener( this );
        interstitialAd.showAndRender( preloadedAd );
    }
    else
    {
        log( ERROR, "Failed to show an AppLovin interstitial before one was loaded" );
        listener.onInterstitialFailed( MoPubErrorCode.NETWORK_INVALID_STATE );
    }
}
 
Example 2
Source File: AppLovinCustomEventInterstitial.java    From SDK-Network-Adapters with MIT License 6 votes vote down vote up
@Override
public void showInterstitial()
{
    final AppLovinAd preloadedAd = dequeueAd( zoneId );
    if ( preloadedAd != null )
    {
        final AppLovinSdk sdk = AppLovinSdk.getInstance( context );

        final AppLovinInterstitialAdDialog interstitialAd = AppLovinInterstitialAd.create( sdk, context );
        interstitialAd.setAdDisplayListener( this );
        interstitialAd.setAdClickListener( this );
        interstitialAd.setAdVideoPlaybackListener( this );
        interstitialAd.showAndRender( preloadedAd );
    }
    else
    {
        log( ERROR, "Failed to show an AppLovin interstitial before one was loaded" );
        listener.onAdFailedToLoad( AdRequest.ERROR_CODE_INTERNAL_ERROR );
    }
}
 
Example 3
Source File: ApplovinAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void showInterstitial() {
  synchronized (INTERSTITIAL_AD_QUEUES_LOCK) {
    // Update mute state.
    mSdk.getSettings().setMuted(AppLovinUtils.shouldMuteAudio(mNetworkExtras));

    final Queue<AppLovinAd> queue = INTERSTITIAL_AD_QUEUES.get(mZoneId);
    final AppLovinAd dequeuedAd = (queue != null) ? queue.poll() : null;

    final AppLovinInterstitialAdDialog interstitialAd =
        AppLovinInterstitialAd.create(mSdk, mContext);

    final AppLovinInterstitialAdListener listener =
        new AppLovinInterstitialAdListener(this, mMediationInterstitialListener);
    interstitialAd.setAdDisplayListener(listener);
    interstitialAd.setAdClickListener(listener);
    interstitialAd.setAdVideoPlaybackListener(listener);

    if (dequeuedAd != null) {
      log(DEBUG, "Showing interstitial for zone: " + mZoneId);
      interstitialAd.showAndRender(dequeuedAd);
    } else {
      log(DEBUG, "Attempting to show interstitial before one was loaded.");

      // Check if we have a default zone interstitial available.
      if (TextUtils.isEmpty(mZoneId) && interstitialAd.isAdReadyToDisplay()) {
        log(DEBUG, "Showing interstitial preloaded by SDK.");
        interstitialAd.show();
      }
      // TODO: Show ad for zone identifier if exists
      else {
        mMediationInterstitialListener.onAdOpened(this);
        mMediationInterstitialListener.onAdClosed(this);
      }
    }
  }
}