com.mopub.nativeads.MoPubStaticNativeAdRenderer Java Examples

The following examples show how to use com.mopub.nativeads.MoPubStaticNativeAdRenderer. 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: MoPubNativeAd.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 MoPub.
 *
 * @param context The context from which this class is instantiated.
 * @param uid     MoPub ad unit id.
 * @param mBC     The controller that passes callbacks back to AppNexus SDK.
 * @param tp      Targeting parameters that were passed through AppNexus public API.
 * @return AppNexus NativeAdResponse that wraps a MoPub native ad.
 */
@Override
public void requestNativeAd(Context context, String parameterString, String uid, MediatedNativeAdController mBC, TargetingParameters tp) {

    RequestParameters requestParameters = null;
    if (tp != null) {
        final EnumSet<RequestParameters.NativeAdAsset> desired
                = EnumSet.allOf(RequestParameters.NativeAdAsset.class);
        requestParameters = new RequestParameters.Builder()
                .location(tp.getLocation())
                .keywords(MoPubListener.keywordsFromTargetingParameters(tp))
                .desiredAssets(desired)
                .build();
    }
    MoPubNativeAdListener listener = new MoPubNativeAdListener(mBC);
    MoPubNative moPubNative = new MoPubNative((Activity) context, uid, listener);

    // A Renderer should be registered if not Native AdRequest will fail.
    moPubNative.registerAdRenderer(new MoPubStaticNativeAdRenderer(null));
    moPubNative.makeRequest(requestParameters);
}
 
Example #2
Source File: SearchResultFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
public void configureAdRenderers() {
  ViewBinder viewBinder = getMoPubViewBinder();
  moPubRecyclerAdapter.registerAdRenderer(new MoPubStaticNativeAdRenderer(viewBinder));
  moPubRecyclerAdapter.registerAdRenderer(new InMobiNativeAdRenderer(viewBinder));
}
 
Example #3
Source File: SimilarAppsViewHolder.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
private void configureAdRenderers() {
  ViewBinder viewBinder = getMoPubAdViewBinder();
  moPubSimilarAppsRecyclerAdapter.registerAdRenderer(new MoPubStaticNativeAdRenderer(viewBinder));
  moPubSimilarAppsRecyclerAdapter.registerAdRenderer(new InMobiNativeAdRenderer(viewBinder));
}