com.facebook.ads.InterstitialAd Java Examples

The following examples show how to use com.facebook.ads.InterstitialAd. 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: FacebookRtbInterstitialAd.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
public void render() {
  Bundle serverParameters = adConfiguration.getServerParameters();
  String placementID = FacebookMediationAdapter.getPlacementID(serverParameters);
  if (TextUtils.isEmpty(placementID)) {
    String ErrorMessage = createAdapterError(ERROR_INVALID_SERVER_PARAMETERS,
        "Failed to request ad, placementID is null or empty.");
    Log.e(TAG, ErrorMessage);
    callback.onFailure(ErrorMessage);
    return;
  }

  setMixedAudience(adConfiguration);
  interstitialAd = new InterstitialAd(adConfiguration.getContext(), placementID);
  if (!TextUtils.isEmpty(adConfiguration.getWatermark())) {
    interstitialAd.setExtraHints(new ExtraHints.Builder()
        .mediationData(adConfiguration.getWatermark()).build());
  }

  interstitialAd.loadAd(
      interstitialAd.buildLoadAdConfig()
          .withBid(adConfiguration.getBidResponse())
          .withAdListener(this)
          .build());
}
 
Example #2
Source File: InterstitialAdManager.java    From react-native-fbads with MIT License 5 votes vote down vote up
@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();
}
 
Example #3
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
private void createAndLoadInterstitial(Context context,
    String placementID,
    MediationAdRequest adRequest) {
  mInterstitialAd = new InterstitialAd(context, placementID);
  buildAdRequest(adRequest);
  mInterstitialAd.loadAd(
      mInterstitialAd.buildLoadAdConfig()
          .withAdListener(new InterstitialListener())
          .build()
  );
}
 
Example #4
Source File: FacebookInterstitial.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@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();
}