com.google.android.gms.ads.formats.NativeAdOptions Java Examples

The following examples show how to use com.google.android.gms.ads.formats.NativeAdOptions. 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: AdMobNativeAd.java    From mobile-sdk-android with Apache License 2.0 6 votes vote down vote up
/**
 * AppNexus SDk calls this method to request a native ad from AdMob
 *
 * @param context The context from which this class is instantiated.
 * @param uid     AdMob ad unit id, app developer needs to set up account with AdMob.
 * @param mBC     The controller that passes callbacks to AppNexus SDK
 * @param tp      Targeting parameters that were set in AppNexus API.
 */
@Override
public void requestNativeAd(Context context, String parameterString, String uid, MediatedNativeAdController mBC, TargetingParameters tp) {
    if (mBC != null) {

        AdMobNativeListener adMobNativeListener = new AdMobNativeListener(mBC);

        NativeAdOptions.Builder adOptionsBuilder = new NativeAdOptions.Builder();

        if(!AdMobNativeSettings.enableMediaView){
            adOptionsBuilder.setReturnUrlsForImageAssets(true);
        }

        if(AdMobNativeSettings.videoOptions!=null) {
            adOptionsBuilder.setVideoOptions(AdMobNativeSettings.videoOptions);
        }


        AdLoader.Builder builder = new AdLoader.Builder(context, uid);
        builder.withNativeAdOptions(adOptionsBuilder.build());
        builder.forUnifiedNativeAd(adMobNativeListener);
        builder.build().loadAd(GooglePlayServicesBanner.buildRequest(tp));
    }


}
 
Example #2
Source File: AdmobFetcher.java    From admobadapter with Apache License 2.0 5 votes vote down vote up
/**
 * Subscribing to the native ads events
 */
protected synchronized void setupAds() {
    String unitId = getReleaseUnitId() != null ? getReleaseUnitId() : getDefaultUnitId();
    AdLoader.Builder adloaderBuilder = new AdLoader.Builder(mContext.get(), unitId)
            .withAdListener(new AdListener() {
                @Override
                public void onAdFailedToLoad(int errorCode) {
                    // Handle the failure by logging, altering the UI, etc.
                    Log.i(TAG, "onAdFailedToLoad " + errorCode);
                    lockFetch.set(false);
                    mFetchFailCount++;
                    mFetchingAdsCnt--;
                    ensurePrefetchAmount();
                    onAdFailed( mPrefetchedAdList.size(), errorCode, null);
                }
            })
            .withNativeAdOptions(new NativeAdOptions.Builder()
                    // Methods in the NativeAdOptions.Builder class can be
                    // used here to specify individual options settings.
                    .build());
    if(getAdTypeToFetch().contains(EAdType.ADVANCED_INSTALLAPP))
        adloaderBuilder.forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
                @Override
                public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {
                    onAdFetched(appInstallAd);
                }
            });
    if(getAdTypeToFetch().contains(EAdType.ADVANCED_CONTENT))
        adloaderBuilder.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
                @Override
                public void onContentAdLoaded(NativeContentAd contentAd) {
                    onAdFetched(contentAd);
                }
            });

    adLoader = adloaderBuilder.build();
}
 
Example #3
Source File: SampleAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void requestNativeAd(Context context,
    MediationNativeListener listener,
    Bundle serverParameters,
    NativeMediationAdRequest mediationAdRequest,
    Bundle mediationExtras) {
  /*
   * In this method, you should:
   *
   * 1. Create a SampleNativeAdLoader
   * 2. Set the native ad listener
   * 3. Set native ad options (optional assets)
   * 4. Make an ad request.
   */

  SampleNativeAdLoader loader = new SampleNativeAdLoader(context);
  if (serverParameters.containsKey(SAMPLE_AD_UNIT_KEY)) {
    loader.setAdUnit(serverParameters.getString(SAMPLE_AD_UNIT_KEY));
  } else {
    listener.onAdFailedToLoad(this, AdRequest.ERROR_CODE_INVALID_REQUEST);
    return;
  }

  NativeAdOptions nativeAdOptions = mediationAdRequest.getNativeAdOptions();

  /**
   * Set the native ad listener and forward callbacks to mediation. The callback forwarding
   * is handled by {@link SampleNativeMediationEventForwarder}.
   */
  loader.setNativeAdListener(
      new SampleNativeMediationEventForwarder(listener, this, nativeAdOptions));

  SampleNativeAdRequest request = new SampleNativeAdRequest();
  if (nativeAdOptions != null) {
    // If the NativeAdOptions' shouldReturnUrlsForImageAssets is true, the adapter should
    // send just the URLs for the images.
    request.setShouldDownloadImages(!nativeAdOptions.shouldReturnUrlsForImageAssets());

    // If your network does not support any of the following options, please make sure
    // that it is documented in your adapter's documentation.
    request.setShouldDownloadMultipleImages(nativeAdOptions.shouldRequestMultipleImages());
    switch (nativeAdOptions.getImageOrientation()) {
      case NativeAdOptions.ORIENTATION_LANDSCAPE:
        request.setPreferredImageOrientation(
            SampleNativeAdRequest.IMAGE_ORIENTATION_LANDSCAPE);
        break;
      case NativeAdOptions.ORIENTATION_PORTRAIT:
        request.setPreferredImageOrientation(
            SampleNativeAdRequest.IMAGE_ORIENTATION_PORTRAIT);
        break;
      case NativeAdOptions.ORIENTATION_ANY:
      default:
        request.setPreferredImageOrientation(
            SampleNativeAdRequest.IMAGE_ORIENTATION_ANY);
    }
  }

  if (!mediationAdRequest.isUnifiedNativeAdRequested()) {
    Log.e(TAG, "Failed to load ad. Request must be for unified native ads.");
    listener.onAdFailedToLoad(this, AdRequest.ERROR_CODE_INVALID_REQUEST);
    return;
  }

  /**
   * If your network supports additional request parameters, the publisher can send these
   * additional parameters to the adapter using the {@link mediationExtras} bundle.
   * Creating a bundle builder class makes it easier for the publisher to create this bundle.
   */
  if (mediationExtras != null) {
    if (mediationExtras.containsKey(MediationExtrasBundleBuilder.KEY_AWESOME_SAUCE)) {
      request.setShouldAddAwesomeSauce(
          mediationExtras.getBoolean(MediationExtrasBundleBuilder.KEY_AWESOME_SAUCE));
    }

    if (mediationExtras.containsKey(MediationExtrasBundleBuilder.KEY_INCOME)) {
      request.setIncome(mediationExtras.getInt(MediationExtrasBundleBuilder.KEY_INCOME));
    }
  }

  // Make an ad request.
  loader.fetchAd(request);
}
 
Example #4
Source File: AdMobCustomMuteThisAdFragment.java    From googleads-mobile-android-examples with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a request for a new unified native ad based on the boolean parameters and calls the
 * "populateUnifiedNativeAdView" method when one is successfully returned.
 */
private void refreshAd() {
    refresh.setEnabled(false);
    muteButton.setEnabled(false);

    Resources resources = getActivity().getResources();
    AdLoader.Builder builder = new AdLoader.Builder(getActivity(),
            resources.getString(R.string.custommute_fragment_ad_unit_id));

    builder.forUnifiedNativeAd(new UnifiedNativeAd.OnUnifiedNativeAdLoadedListener() {
        // OnUnifiedNativeAdLoadedListener implementation.
        @Override
        public void onUnifiedNativeAdLoaded(UnifiedNativeAd unifiedNativeAd) {
            AdMobCustomMuteThisAdFragment.this.nativeAd = unifiedNativeAd;
            muteButton.setEnabled(unifiedNativeAd.isCustomMuteThisAdEnabled());
            nativeAd.setMuteThisAdListener(new MuteThisAdListener() {
                @Override
                public void onAdMuted() {
                    muteAd();
                    Toast.makeText(getActivity(), "Ad muted", Toast.LENGTH_SHORT).show();
                }
            });

            UnifiedNativeAdView adView = (UnifiedNativeAdView) getLayoutInflater()
                .inflate(R.layout.ad_unified, null);
            populateUnifiedNativeAdView(unifiedNativeAd, adView);
            adContainer.removeAllViews();
            adContainer.addView(adView);
        }

    });

    NativeAdOptions adOptions = new NativeAdOptions.Builder()
        .setRequestCustomMuteThisAd(true)
        .build();

    builder.withNativeAdOptions(adOptions);

    AdLoader adLoader = builder.withAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int errorCode) {
            refresh.setEnabled(true);
            Toast.makeText(getActivity(), "Failed to load native ad: "
                    + errorCode, Toast.LENGTH_SHORT).show();
        }
    }).build();

    adLoader.loadAd(new AdRequest.Builder().build());
}
 
Example #5
Source File: MainActivity.java    From googleads-mobile-android-examples with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a request for a new native ad based on the boolean parameters and calls the
 * corresponding "populate" method when one is successfully returned.
 *
 */
private void refreshAd() {
    refresh.setEnabled(false);

    AdLoader.Builder builder = new AdLoader.Builder(this, ADMOB_AD_UNIT_ID);

    builder.forUnifiedNativeAd(new UnifiedNativeAd.OnUnifiedNativeAdLoadedListener() {
        // OnUnifiedNativeAdLoadedListener implementation.
        @Override
        public void onUnifiedNativeAdLoaded(UnifiedNativeAd unifiedNativeAd) {
            // If this callback occurs after the activity is destroyed, you must call
            // destroy and return or you may get a memory leak.
            if (isDestroyed()) {
                unifiedNativeAd.destroy();
                return;
            }
            // You must call destroy on old ads when you are done with them,
            // otherwise you will have a memory leak.
            if (nativeAd != null) {
                nativeAd.destroy();
            }
            nativeAd = unifiedNativeAd;
            FrameLayout frameLayout =
                    findViewById(R.id.fl_adplaceholder);
            UnifiedNativeAdView adView = (UnifiedNativeAdView) getLayoutInflater()
                    .inflate(R.layout.ad_unified, null);
            populateUnifiedNativeAdView(unifiedNativeAd, adView);
            frameLayout.removeAllViews();
            frameLayout.addView(adView);
        }

    });

    VideoOptions videoOptions = new VideoOptions.Builder()
            .setStartMuted(startVideoAdsMuted.isChecked())
            .build();

    NativeAdOptions adOptions = new NativeAdOptions.Builder()
            .setVideoOptions(videoOptions)
            .build();

    builder.withNativeAdOptions(adOptions);

    AdLoader adLoader = builder.withAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int errorCode) {
            refresh.setEnabled(true);
            Toast.makeText(MainActivity.this, "Failed to load native ad: "
                    + errorCode, Toast.LENGTH_SHORT).show();
        }
    }).build();

    adLoader.loadAd(new AdRequest.Builder().build());

    videoStatus.setText("");
}
 
Example #6
Source File: AdMobCustomMuteThisAdFragment.java    From android-ads with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a request for a new unified native ad based on the boolean parameters and calls the
 * "populateUnifiedNativeAdView" method when one is successfully returned.
 */
private void refreshAd() {
    refresh.setEnabled(false);
    muteButton.setEnabled(false);

    Resources resources = getActivity().getResources();
    AdLoader.Builder builder = new AdLoader.Builder(getActivity(),
            resources.getString(R.string.custommute_fragment_ad_unit_id));

    builder.forUnifiedNativeAd(new UnifiedNativeAd.OnUnifiedNativeAdLoadedListener() {
        // OnUnifiedNativeAdLoadedListener implementation.
        @Override
        public void onUnifiedNativeAdLoaded(UnifiedNativeAd unifiedNativeAd) {
            AdMobCustomMuteThisAdFragment.this.nativeAd = unifiedNativeAd;
            muteButton.setEnabled(unifiedNativeAd.isCustomMuteThisAdEnabled());
            nativeAd.setMuteThisAdListener(new MuteThisAdListener() {
                @Override
                public void onAdMuted() {
                    muteAd();
                    Toast.makeText(getActivity(), "Ad muted", Toast.LENGTH_SHORT).show();
                }
            });

            UnifiedNativeAdView adView = (UnifiedNativeAdView) getLayoutInflater()
                .inflate(R.layout.ad_unified, null);
            populateUnifiedNativeAdView(unifiedNativeAd, adView);
            adContainer.removeAllViews();
            adContainer.addView(adView);
        }

    });

    NativeAdOptions adOptions = new NativeAdOptions.Builder()
        .setRequestCustomMuteThisAd(true)
        .build();

    builder.withNativeAdOptions(adOptions);

    AdLoader adLoader = builder.withAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int errorCode) {
            refresh.setEnabled(true);
            Toast.makeText(getActivity(), "Failed to load native ad: "
                    + errorCode, Toast.LENGTH_SHORT).show();
        }
    }).build();

    adLoader.loadAd(new AdRequest.Builder().build());
}
 
Example #7
Source File: MainActivity.java    From android-ads with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a request for a new native ad based on the boolean parameters and calls the
 * corresponding "populate" method when one is successfully returned.
 *
 */
private void refreshAd() {
    refresh.setEnabled(false);

    AdLoader.Builder builder = new AdLoader.Builder(this, ADMOB_AD_UNIT_ID);

    builder.forUnifiedNativeAd(new UnifiedNativeAd.OnUnifiedNativeAdLoadedListener() {
        // OnUnifiedNativeAdLoadedListener implementation.
        @Override
        public void onUnifiedNativeAdLoaded(UnifiedNativeAd unifiedNativeAd) {
            // You must call destroy on old ads when you are done with them,
            // otherwise you will have a memory leak.
            if (nativeAd != null) {
                nativeAd.destroy();
            }
            nativeAd = unifiedNativeAd;
            FrameLayout frameLayout =
                    findViewById(R.id.fl_adplaceholder);
            UnifiedNativeAdView adView = (UnifiedNativeAdView) getLayoutInflater()
                    .inflate(R.layout.ad_unified, null);
            populateUnifiedNativeAdView(unifiedNativeAd, adView);
            frameLayout.removeAllViews();
            frameLayout.addView(adView);
        }

    });

    VideoOptions videoOptions = new VideoOptions.Builder()
            .setStartMuted(startVideoAdsMuted.isChecked())
            .build();

    NativeAdOptions adOptions = new NativeAdOptions.Builder()
            .setVideoOptions(videoOptions)
            .build();

    builder.withNativeAdOptions(adOptions);

    AdLoader adLoader = builder.withAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int errorCode) {
            refresh.setEnabled(true);
            Toast.makeText(MainActivity.this, "Failed to load native ad: "
                    + errorCode, Toast.LENGTH_SHORT).show();
        }
    }).build();

    adLoader.loadAd(new AdRequest.Builder().build());

    videoStatus.setText("");
}
 
Example #8
Source File: VerizonMediaNativeRenderer.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
public void render(@NonNull Context context, MediationNativeListener listener,
    Bundle serverParameters, NativeMediationAdRequest mediationAdRequest,
    Bundle mediationExtras) {
  nativeListener = listener;
  this.context = context;
  String siteId = VerizonMediaAdapterUtils.getSiteId(serverParameters, mediationExtras);
  MediationNativeAdapter adapter = nativeAdapterWeakRef.get();

  if (TextUtils.isEmpty(siteId)) {
    Log.e(TAG, "Failed to request ad: siteID is null.");
    if (nativeListener != null && adapter != null) {
      nativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST);
      return;
    }
  }

  if (!initializeSDK(context, siteId)) {
    Log.e(TAG, "Unable to initialize Verizon Ads SDK.");
    if (nativeListener != null && adapter != null) {
      nativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INTERNAL_ERROR);
    }
    return;
  }

  String placementId = VerizonMediaAdapterUtils.getPlacementId(serverParameters);
  if (TextUtils.isEmpty(placementId)) {
    Log.e(TAG, "Failed to request ad: placementID is null or empty.");
    if (nativeListener != null && adapter != null) {
      nativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST);
    }
    return;
  }

  VerizonMediaAdapterUtils.setCoppaValue(mediationAdRequest);
  VASAds.setLocationEnabled((mediationAdRequest.getLocation() != null));
  String[] adTypes = new String[] {"100", "simpleImage"};
  NativeAdFactory nativeAdFactory = new NativeAdFactory(context, placementId, adTypes, this);
  nativeAdFactory.setRequestMetaData(
      VerizonMediaAdapterUtils.getRequestMetadata(mediationAdRequest));
  NativeAdOptions options = mediationAdRequest.getNativeAdOptions();

  if ((options == null) || (!options.shouldReturnUrlsForImageAssets())) {
    nativeAdFactory.load(this);
  } else {
    nativeAdFactory.loadWithoutAssets(this);
  }
}
 
Example #9
Source File: MyTargetNativeAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void requestNativeAd(Context context,
    MediationNativeListener customEventNativeListener,
    Bundle serverParameter,
    NativeMediationAdRequest nativeMediationAdRequest,
    Bundle customEventExtras) {
  this.customEventNativeListener = customEventNativeListener;
  int slotId = MyTargetTools.checkAndGetSlotId(context, serverParameter);
  Log.d(TAG, "Requesting myTarget mediation, slotId: " + slotId);

  if (slotId < 0) {
    if (customEventNativeListener != null) {
      customEventNativeListener.onAdFailedToLoad(
          MyTargetNativeAdapter.this, AdRequest.ERROR_CODE_INVALID_REQUEST);
    }
    return;
  }
  NativeAdOptions options = null;
  int gender = 0;
  Date birthday = null;
  boolean contentRequested = false;
  boolean installRequested = false;
  boolean unifiedRequested = false;
  if (nativeMediationAdRequest != null) {
    options = nativeMediationAdRequest.getNativeAdOptions();
    gender = nativeMediationAdRequest.getGender();
    birthday = nativeMediationAdRequest.getBirthday();
    contentRequested = nativeMediationAdRequest.isContentAdRequested();
    installRequested = nativeMediationAdRequest.isAppInstallAdRequested();
    unifiedRequested = nativeMediationAdRequest.isUnifiedNativeAdRequested();
  }

  NativeAd nativeAd = new NativeAd(slotId, context);

  int cachePolicy = CachePolicy.IMAGE;
  if (options != null) {
    if (options.shouldReturnUrlsForImageAssets()) {
      cachePolicy = CachePolicy.NONE;
    }
    Log.d(TAG, "Set cache policy to " + cachePolicy);
  }
  nativeAd.setCachePolicy(cachePolicy);

  CustomParams params = nativeAd.getCustomParams();
  Log.d(TAG, "Set gender to " + gender);
  params.setGender(gender);

  if (birthday != null && birthday.getTime() != -1) {
    GregorianCalendar calendar = new GregorianCalendar();
    GregorianCalendar calendarNow = new GregorianCalendar();

    calendar.setTimeInMillis(birthday.getTime());
    int age = calendarNow.get(GregorianCalendar.YEAR)
        - calendar.get(GregorianCalendar.YEAR);
    if (age >= 0) {
      params.setAge(age);
    }
  }
  Log.d(TAG, "Content requested: " + contentRequested
      + ", install requested: " + installRequested
      + ", unified requested: " + unifiedRequested);
  if (!unifiedRequested && (!contentRequested || !installRequested)) {
    if (!contentRequested) {
      params.setCustomParam(PARAM_NATIVE_TYPE_REQUEST, PARAM_INSTALL_ONLY);
    } else {
      params.setCustomParam(PARAM_NATIVE_TYPE_REQUEST, PARAM_CONTENT_ONLY);
    }
  }

  MyTargetNativeAdListener nativeAdListener = new MyTargetNativeAdListener(
      nativeAd,
      nativeMediationAdRequest,
      context);

  params.setCustomParam(
      MyTargetTools.PARAM_MEDIATION_KEY, MyTargetTools.PARAM_MEDIATION_VALUE);
  nativeAd.setListener(nativeAdListener);
  nativeAd.load();
}
 
Example #10
Source File: NativeAdLoader.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
NativeAdLoader(
    NendNativeAdForwarder forwarder, NendAdNativeClient client, NativeAdOptions nativeAdOptions) {
  this.forwarder = forwarder;
  this.client = client;
  this.nativeAdOptions = nativeAdOptions;
}
 
Example #11
Source File: SampleCustomEvent.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void requestNativeAd(Context context,
    CustomEventNativeListener customEventNativeListener,
    String serverParameter,
    NativeMediationAdRequest nativeMediationAdRequest,
    Bundle extras) {
  // Create one of the Sample SDK's ad loaders from which to request ads.
  SampleNativeAdLoader loader = new SampleNativeAdLoader(context);
  loader.setAdUnit(serverParameter);

  // Create a native request to give to the SampleNativeAdLoader.
  SampleNativeAdRequest request = new SampleNativeAdRequest();
  NativeAdOptions options = nativeMediationAdRequest.getNativeAdOptions();
  if (options != null) {
    // If the NativeAdOptions' shouldReturnUrlsForImageAssets is true, the adapter should
    // send just the URLs for the images.
    request.setShouldDownloadImages(!options.shouldReturnUrlsForImageAssets());

    // If your network does not support any of the following options, please make sure
    // that it is documented in your adapter's documentation.
    request.setShouldDownloadMultipleImages(options.shouldRequestMultipleImages());
    switch (options.getImageOrientation()) {
      case NativeAdOptions.ORIENTATION_LANDSCAPE:
        request.setPreferredImageOrientation(
            SampleNativeAdRequest.IMAGE_ORIENTATION_LANDSCAPE);
        break;
      case NativeAdOptions.ORIENTATION_PORTRAIT:
        request.setPreferredImageOrientation(
            SampleNativeAdRequest.IMAGE_ORIENTATION_PORTRAIT);
        break;
      case NativeAdOptions.ORIENTATION_ANY:
      default:
        request.setPreferredImageOrientation(
            SampleNativeAdRequest.IMAGE_ORIENTATION_ANY);
    }
  }

  if (!nativeMediationAdRequest.isUnifiedNativeAdRequested()) {
    Log.e(TAG, "Failed to load ad. Request must be for unified native ads.");
    customEventNativeListener.onAdFailedToLoad(AdRequest.ERROR_CODE_INVALID_REQUEST);
    return;
  }

  loader.setNativeAdListener(
      new SampleCustomNativeEventForwarder(customEventNativeListener,
          nativeMediationAdRequest.getNativeAdOptions()));

  // Begin a request.
  loader.fetchAd(request);
}
 
Example #12
Source File: SampleNativeMediationEventForwarder.java    From googleads-mobile-android-mediation with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new {@code SampleNativeMediationEventForwarder}.
 *
 * @param listener An AdMob Mediation {@link MediationNativeListener} that should receive
 * forwarded events.
 * @param adapter A {@link SampleAdapter} mediation adapter.
 * @param options Native ad loading options.
 */
public SampleNativeMediationEventForwarder(
    MediationNativeListener listener, SampleAdapter adapter, NativeAdOptions options) {
  this.nativeListener = listener;
  this.adapter = adapter;
  this.nativeAdOptions = options;
}
 
Example #13
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 2 votes vote down vote up
/**
 * Default constructor for {@link UnifiedAdMapper}.
 *
 * @param nativeAd  The Facebook native ad to be mapped.
 * @param adOptions {@link NativeAdOptions} containing the preferences to be used when mapping
 *                  the native ad.
 */
public UnifiedAdMapper(NativeAd nativeAd, NativeAdOptions adOptions) {
  UnifiedAdMapper.this.mNativeAd = nativeAd;
  UnifiedAdMapper.this.mNativeAdOptions = adOptions;
}
 
Example #14
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor for {@link UnifiedAdMapper}.
 *
 * @param nativeBannerAd The Facebook native banner ad to be mapped.
 * @param adOptions      {@link NativeAdOptions} containing the preferences to be used when
 *                       mapping the native ad.
 */
public UnifiedAdMapper(NativeBannerAd nativeBannerAd, NativeAdOptions adOptions) {
  UnifiedAdMapper.this.mNativeBannerAd = nativeBannerAd;
  UnifiedAdMapper.this.mNativeAdOptions = adOptions;
}
 
Example #15
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor for {@link AppInstallMapper}.
 *
 * @param nativeBannerAd The Facebook native banner ad to be mapped.
 * @param adOptions      {@link NativeAdOptions} containing the preferences to be used when
 *                       mapping the native ad.
 */
public AppInstallMapper(NativeBannerAd nativeBannerAd, NativeAdOptions adOptions) {
  AppInstallMapper.this.mNativeBannerAd = nativeBannerAd;
  AppInstallMapper.this.mNativeAdOptions = adOptions;
}
 
Example #16
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 2 votes vote down vote up
/**
 * Default constructor for {@link AppInstallMapper}.
 *
 * @param nativeAd  The Facebook native ad to be mapped.
 * @param adOptions {@link NativeAdOptions} containing the preferences to be used when mapping
 *                  the native ad.
 */
public AppInstallMapper(NativeAd nativeAd, NativeAdOptions adOptions) {
  AppInstallMapper.this.mNativeAd = nativeAd;
  AppInstallMapper.this.mNativeAdOptions = adOptions;
}
 
Example #17
Source File: SampleCustomNativeEventForwarder.java    From googleads-mobile-android-mediation with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new {@code SampleNativeEventForwarder}.
 *
 * @param listener An AdMob Mediation {@link CustomEventNativeListener} that should receive
 * forwarded events.
 * @param options Native ad loading options.
 */
public SampleCustomNativeEventForwarder(CustomEventNativeListener listener,
    NativeAdOptions options) {
  this.nativeListener = listener;
  this.nativeAdOptions = options;
}