@Override protected void request(Context context, Map<String, String> networkData) { if (context == null || networkData == null) { invokeLoadFail(PNException.ADAPTER_MISSING_DATA); } else { mContext = context; String placementId = networkData.get(Facebook.KEY_PLACEMENT_ID); if (TextUtils.isEmpty(placementId)) { invokeLoadFail(PNException.ADAPTER_ILLEGAL_ARGUMENTS); } else { Facebook.init(context); mInterstitialAd = new InterstitialAd(mContext, placementId); mInterstitialAd.setAdListener(this); mInterstitialAd.loadAd(); } } }
@Override public void requestInterstitialAd(Context context, MediationInterstitialListener listener, Bundle serverParameters, MediationAdRequest adRequest, Bundle mediationExtras) { mInterstitialListener = listener; if (!isValidRequestParameters(context, serverParameters)) { mInterstitialListener.onAdFailedToLoad(this, AdRequest.ERROR_CODE_INVALID_REQUEST); return; } String placementId = serverParameters.getString(PLACEMENT_PARAMETER); mInterstitialAd = new InterstitialAd(context, placementId); mInterstitialAd.setAdListener(new InterstitialListener()); buildAdRequest(adRequest); mInterstitialAd.loadAd(); }
@ReactMethod public void showAd(String placementId, Promise p) { if (mPromise != null) { p.reject("E_FAILED_TO_SHOW", "Only one `showAd` can be called at once"); return; } ReactApplicationContext reactContext = this.getReactApplicationContext(); mPromise = p; mInterstitial = new InterstitialAd(reactContext, placementId); mInterstitial.setAdListener(this); mInterstitial.loadAd(); }
@Override public void requestAd(MediatedInterstitialAdViewController mIC, Activity activity, String parameter, String uid, TargetingParameters tp) { FacebookListener fbListener = new FacebookListener(mIC, this.getClass().getSimpleName()); interstitialAd = new InterstitialAd(activity, uid); interstitialAd.setAdListener(fbListener); interstitialAd.loadAd(); }