ThirdPartyAdapters/fyber/fyber/src/main/java/com/google/ads/mediation/fyber/FyberMediationAdapter.java
/**
   * Creates Fyber's banner ad request listener.
   *
   * @return the created request listener.
   */
Creates Fyber's banner ad request listener.
@return the created request listener.
Creates Fyber ' s banner ad request listener . @return the created request listener .
@NonNull
  private InneractiveAdSpot.RequestListener createFyberBannerAdListener() {
    return new InneractiveAdSpot.RequestListener() {
      @Override
      public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot inneractiveAdSpot) {
        if (!(mBannerSpot.getSelectedUnitController() instanceof
            InneractiveAdViewUnitController)) {
          mMediationBannerListener
              .onAdFailedToLoad(FyberMediationAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR);
          mBannerSpot.destroy();
        }
        InneractiveAdViewUnitController controller =
            (InneractiveAdViewUnitController) mBannerSpot.getSelectedUnitController();
        InneractiveAdViewEventsListener listener = createFyberAdViewListener();
        controller.setEventsListener(listener);
        mMediationBannerListener.onAdLoaded(FyberMediationAdapter.this);
      }
      @Override
      public void onInneractiveFailedAdRequest(InneractiveAdSpot inneractiveAdSpot,
          InneractiveErrorCode inneractiveErrorCode) {
        int adMobErrorCode = AdRequest.ERROR_CODE_INTERNAL_ERROR;
        if (inneractiveErrorCode == InneractiveErrorCode.CONNECTION_ERROR
            || inneractiveErrorCode == InneractiveErrorCode.CONNECTION_TIMEOUT) {
          adMobErrorCode = AdRequest.ERROR_CODE_NETWORK_ERROR;
        } else if (inneractiveErrorCode == InneractiveErrorCode.NO_FILL) {
          adMobErrorCode = AdRequest.ERROR_CODE_NO_FILL;
        }
        mMediationBannerListener.onAdFailedToLoad(FyberMediationAdapter.this, adMobErrorCode);
      }
    };
  }
@ NonNull private InneractiveAdSpot . RequestListener createFyberBannerAdListener ( ) { return new InneractiveAdSpot . RequestListener ( ) { @ Override public void onInneractiveSuccessfulAdRequest ( InneractiveAdSpot inneractiveAdSpot ) { if ( ! ( mBannerSpot . getSelectedUnitController ( ) instanceof InneractiveAdViewUnitController ) ) { mMediationBannerListener . onAdFailedToLoad ( FyberMediationAdapter . this , AdRequest . ERROR_CODE_INTERNAL_ERROR ) ; mBannerSpot . destroy ( ) ; } InneractiveAdViewUnitController controller = ( InneractiveAdViewUnitController ) mBannerSpot . getSelectedUnitController ( ) ; InneractiveAdViewEventsListener listener = createFyberAdViewListener ( ) ; controller . setEventsListener ( listener ) ; mMediationBannerListener . onAdLoaded ( FyberMediationAdapter . this ) ; } @ Override public void onInneractiveFailedAdRequest ( InneractiveAdSpot inneractiveAdSpot , InneractiveErrorCode inneractiveErrorCode ) { int adMobErrorCode = AdRequest . ERROR_CODE_INTERNAL_ERROR ; if ( inneractiveErrorCode == InneractiveErrorCode . CONNECTION_ERROR || inneractiveErrorCode == InneractiveErrorCode . CONNECTION_TIMEOUT ) { adMobErrorCode = AdRequest . ERROR_CODE_NETWORK_ERROR ; } else if ( inneractiveErrorCode == InneractiveErrorCode . NO_FILL ) { adMobErrorCode = AdRequest . ERROR_CODE_NO_FILL ; } mMediationBannerListener . onAdFailedToLoad ( FyberMediationAdapter . this , adMobErrorCode ) ; } } ; }
Creates Fyber's banner ad request listener.
Creates Fyber ' s banner ad request listener .
// Just a double check that we have the right type of selected controller. // Convert Fyber's Marketplace error code into AdMob's AdRequest error code.