com.mopub.nativeads.RequestParameters Java Examples
The following examples show how to use
com.mopub.nativeads.RequestParameters.
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: TwitterMoPubAdAdapter.java From twitter-kit-android with Apache License 2.0 | 6 votes |
@Override public void loadAds(@NonNull final String adUnitId, @Nullable final RequestParameters requestParams) { final RequestParameters.Builder builder = new RequestParameters.Builder(); if (requestParams != null) { final String keywords = TextUtils.isEmpty(requestParams.getKeywords()) ? TWITTERKIT_KEYWORD : requestParams.getKeywords() + "," + TWITTERKIT_KEYWORD; builder.keywords(keywords); builder.location(requestParams.getLocation()); } else { builder.keywords(TWITTERKIT_KEYWORD); } super.loadAds(adUnitId, builder.build()); }
Example #2
Source File: MoPubNativeAd.java From mobile-sdk-android with Apache License 2.0 | 6 votes |
/** * 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 #3
Source File: SearchResultFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void showNativeAds(String query) { RequestParameters requestParameters = new RequestParameters.Builder().keywords(query) .build(); if (Build.VERSION.SDK_INT >= 21) { moPubRecyclerAdapter.loadAds(BuildConfig.MOPUB_NATIVE_SEARCH_V2_PLACEMENT_ID, requestParameters); } }