Package com.my.target.mediation
Class MyTargetNativeAdAdapter
- java.lang.Object
-
- com.my.target.mediation.MyTargetNativeAdAdapter
-
- All Implemented Interfaces:
AdChoicesClickHandler,MediationAdapter,MediationNativeAdAdapter
public final class MyTargetNativeAdAdapter extends java.lang.Object implements MediationNativeAdAdapter, AdChoicesClickHandler
An adapter for internal mediation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.my.target.mediation.MediationNativeAdAdapter
MediationNativeAdAdapter.MediationNativeAdListener
-
-
Constructor Summary
Constructors Constructor Description MyTargetNativeAdAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroys adapter and cleans resources.android.view.ViewgetMediaView(android.content.Context context)Must return view for displaying media view (large picture or video) for correct implementation of Native Ads and tracking.voidhandleAdChoicesClick(android.content.Context context)Method for processing click on adChoicesvoidload(MediationNativeAdConfig mediationAdConfig, MediationNativeAdAdapter.MediationNativeAdListener listener, android.content.Context context)Will be called when mediation choose this adapter for loading mediation.voidregisterView(android.view.View view, java.util.List<android.view.View> clickableViews, int adChoicesPlacement)Will be called when view becomes ready to be shown.voidsetSection(NativeAdSection section)voidunregisterView()Will be called when view appears invisible and unused.
-
-
-
Method Detail
-
setSection
public void setSection(@Nullable NativeAdSection section)
-
load
public void load(@NonNull MediationNativeAdConfig mediationAdConfig, @NonNull MediationNativeAdAdapter.MediationNativeAdListener listener, @NonNull android.content.Context context)Description copied from interface:MediationNativeAdAdapterWill 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 createdNativePromoBannerfrom received assets and then should be calledMediationNativeAdAdapter.MediationNativeAdListener.onLoad(NativePromoBanner, MediationNativeAdAdapter)in case of failed loading should be calledMediationNativeAdAdapter.MediationNativeAdListener.onNoAd(String, MediationNativeAdAdapter)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.- Specified by:
loadin interfaceMediationNativeAdAdapter- Parameters:
mediationAdConfig- contains main configuration for mediationlistener- main mediation listenercontext- app context- See Also:
MediationNativeAdConfig
-
registerView
public void registerView(@NonNull android.view.View view, @Nullable java.util.List<android.view.View> clickableViews, int adChoicesPlacement)Description copied from interface:MediationNativeAdAdapterWill 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- Specified by:
registerViewin interfaceMediationNativeAdAdapter- Parameters:
view- view to be registeredclickableViews- optional views want to be clickableadChoicesPlacement- placement of AdChoices icon. Possible values inAdChoicesPlacement
-
unregisterView
public void unregisterView()
Description copied from interface:MediationNativeAdAdapterWill be called when view appears invisible and unused. There must be called apis to stop tracking views and free resources.- Specified by:
unregisterViewin interfaceMediationNativeAdAdapter
-
getMediaView
@Nullable public android.view.View getMediaView(@NonNull android.content.Context context)Description copied from interface:MediationNativeAdAdapterMust return view for displaying media view (large picture or video) for correct implementation of Native Ads and tracking. It is optional, but preferred.- Specified by:
getMediaViewin interfaceMediationNativeAdAdapter- Parameters:
context- app context- Returns:
- View for Media
-
destroy
public void destroy()
Description copied from interface:MediationAdapterDestroys adapter and cleans resources. Adapter will not work after calling this method- Specified by:
destroyin interfaceMediationAdapter
-
handleAdChoicesClick
public void handleAdChoicesClick(@NonNull android.content.Context context)Description copied from interface:AdChoicesClickHandlerMethod for processing click on adChoices- Specified by:
handleAdChoicesClickin interfaceAdChoicesClickHandler
-
-