Class MyTargetNativeBannerAdAdapter
-
- All Implemented Interfaces:
-
com.my.target.mediation.AdChoicesClickHandler,com.my.target.mediation.ClickHandler,com.my.target.mediation.MediationAdapter,com.my.target.mediation.MediationNativeBannerAdAdapter
public final class MyTargetNativeBannerAdAdapter implements AdChoicesClickHandler, ClickHandler, MediationNativeBannerAdAdapter
An adapter for internal mediation
-
-
Constructor Summary
Constructors Constructor Description MyTargetNativeBannerAdAdapter()
-
Method Summary
Modifier and Type Method Description voiddestroy()Destroys adapter and cleans resources. ViewgetIconView(@NonNull() Context context)Must return view for displaying icon view for correct implementation of Native Ads and tracking. voidhandleAdChoicesClick(@NonNull() Context context)Method for processing click on adChoices voidhandleClick(boolean isCta, @NonNull() View view)Method for processing click on native ad views voidload(@NonNull() MediationNativeBannerAdConfig mediationAdConfig, @NonNull() MediationNativeBannerAdAdapter.MediationNativeBannerAdListener listener, @NonNull() Context context)Will be called when mediation choose this adapter for loading mediation. voidregisterView(@NonNull() View view, @Nullable() List<View> clickableViews, int adChoicesPlacement)Will be called when view becomes ready to be shown. voidregisterView(@NonNull() NativeBannerAdViewBinder nativeBannerAdViewBinder, @Nullable() List<View> clickableViews, int adChoicesPlacement)Will be called when view becomes ready to be shown. voidunregisterView()Will be called when view appears invisible and unused. -
-
Method Detail
-
destroy
void destroy()
Destroys adapter and cleans resources. Adapter will not work after calling this method
-
getIconView
@Nullable() View getIconView(@NonNull() Context context)
Must return view for displaying icon view for correct implementation of Native Ads and tracking. It is optional, but preferred.
- Parameters:
context- app context- Returns:
View for Icon
-
handleAdChoicesClick
void handleAdChoicesClick(@NonNull() Context context)
Method for processing click on adChoices
-
handleClick
void handleClick(boolean isCta, @NonNull() View view)
Method for processing click on native ad views
-
load
void load(@NonNull() MediationNativeBannerAdConfig mediationAdConfig, @NonNull() MediationNativeBannerAdAdapter.MediationNativeBannerAdListener listener, @NonNull() Context context)
Will be called when mediation choose this adapter for loading mediation. All of initialization and loading logic should be implemented here. After successful loading should be created com.my.target.core.models.banners.NativeAdBanner from received assets and then should be called MediationNativeBannerAdAdapter.MediationNativeBannerAdListener.onLoad(NativeBanner, MediationNativeBannerAdAdapter) in case of failed loading should be called MediationNativeBannerAdAdapter.MediationNativeBannerAdListener.onNoAd(IAdLoadingError, MediationNativeBannerAdAdapter) with the reason of fail. If no callbacks will be called, adapter will be removed from loading queue, and next adapter or no ad will be called.
- Parameters:
mediationAdConfig- contains main configuration for mediationlistener- main mediation listenercontext- app context
-
registerView
@Deprecated() void registerView(@NonNull() View view, @Nullable() List<View> clickableViews, int adChoicesPlacement)
Will be called when view becomes ready to be shown. There must be called apis to start tracking views, adding listeners on views and load resources, which was not loaded previously, such as not pre-loaded media content. Clickable views is optional, if set - click listeners must be placed only on views in this list, otherwise must be used default logic of ad network
- Parameters:
adChoicesPlacement- Value is TOP_RIGHT, TOP_LEFT, BOTTOM_RIGHT, BOTTOM_LEFT, MANUAL, or DRAWING_MANUAL
-
registerView
void registerView(@NonNull() NativeBannerAdViewBinder nativeBannerAdViewBinder, @Nullable() List<View> clickableViews, int adChoicesPlacement)
Will be called when view becomes ready to be shown. There must be called apis to start tracking views, adding listeners on views and load resources, which was not loaded previously, such as not pre-loaded media content. Clickable views is optional, if set - click listeners must be placed only on views in this list, otherwise must be used default logic of ad network
- Parameters:
nativeBannerAdViewBinder- is binder for views to be registeredclickableViews- optional views want to be clickableadChoicesPlacement- placement of AdChoices icon.
-
unregisterView
void unregisterView()
Will be called when view appears invisible and unused. There must be called apis to stop tracking views and free resources.
-
-
-
-