Class MyTargetNativeAdAdapter

java.lang.Object
com.my.target.mediation.MyTargetNativeAdAdapter
All Implemented Interfaces:
AdChoicesClickHandler, MediationAdapter, MediationNativeAdAdapter

public final class MyTargetNativeAdAdapter extends Object implements MediationNativeAdAdapter, AdChoicesClickHandler
An adapter for internal mediation
  • Constructor Details

    • MyTargetNativeAdAdapter

      public MyTargetNativeAdAdapter()
  • Method Details

    • 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: MediationNativeAdAdapter
      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 NativePromoBanner from received assets and then should be called MediationNativeAdAdapter.MediationNativeAdListener.onLoad(NativePromoBanner, MediationNativeAdAdapter) in case of failed loading should be called MediationNativeAdAdapter.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:
      load in interface MediationNativeAdAdapter
      Parameters:
      mediationAdConfig - contains main configuration for mediation
      listener - main mediation listener
      context - app context
      See Also:
    • registerView

      public void registerView(@NonNull android.view.View view, @Nullable List<android.view.View> clickableViews, int adChoicesPlacement)
      Description copied from interface: MediationNativeAdAdapter
      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
      Specified by:
      registerView in interface MediationNativeAdAdapter
      Parameters:
      view - view to be registered
      clickableViews - optional views want to be clickable
      adChoicesPlacement - placement of AdChoices icon. Possible values in AdChoicesPlacement
    • unregisterView

      public void unregisterView()
      Description copied from interface: MediationNativeAdAdapter
      Will be called when view appears invisible and unused. There must be called apis to stop tracking views and free resources.
      Specified by:
      unregisterView in interface MediationNativeAdAdapter
    • getMediaView

      @Nullable public android.view.View getMediaView(@NonNull android.content.Context context)
      Description copied from interface: MediationNativeAdAdapter
      Must 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:
      getMediaView in interface MediationNativeAdAdapter
      Parameters:
      context - app context
      Returns:
      View for Media
    • destroy

      public void destroy()
      Description copied from interface: MediationAdapter
      Destroys adapter and cleans resources. Adapter will not work after calling this method
      Specified by:
      destroy in interface MediationAdapter
    • handleAdChoicesClick

      public void handleAdChoicesClick(@NonNull android.content.Context context)
      Description copied from interface: AdChoicesClickHandler
      Method for processing click on adChoices
      Specified by:
      handleAdChoicesClick in interface AdChoicesClickHandler