Class POBNativeAdRenderer

  • All Implemented Interfaces:
    com.pubmatic.sdk.common.utility.POBImageDownloadManager.POBImageDownloadListener , com.pubmatic.sdk.nativead.POBNativeAdViewListener , com.pubmatic.sdk.nativead.renderer.POBNativeAdRendering

    
    public class POBNativeAdRenderer
     implements POBNativeAdRendering, POBNativeAdViewListener, POBImageDownloadManager.POBImageDownloadListener
                        

    Class responsible for handling the native ad rendering

    • Constructor Detail

      • POBNativeAdRenderer

        POBNativeAdRenderer(Context context)
    • Method Detail

      • renderAd

         void renderAd(@NonNull() POBNativeAdResponse nativeAdResponse, @NonNull() POBNativeTemplateView templateView, @NonNull() POBBid bid)

        It starts the rendering of the native ad with the provided ad descriptor.

        Parameters:
        templateView - template view to render native ad
        bid - Helps to fetch rendering related details from bid response.
      • getMediaView

        @NonNull() FrameLayout getMediaView(@NonNull() POBNativeAdResponse nativeAdResponse, @NonNull() POBBid bid)

        Creates a media view for SDK bidding integrations (MAX, AdMob). Returns a FrameLayout container that will be populated with video or main image asynchronously.

        Parameters:
        nativeAdResponse - The native ad response containing assets
        bid - The bid object for rendering context
        Returns:

        A FrameLayout containing video or main image

      • setNativeMeasurementProvider

         void setNativeMeasurementProvider(@Nullable() POBNativeMeasurementProvider openMeasurementProvider)

        Sets the open measurement listener

        Parameters:
        openMeasurementProvider - ad renderer listener
      • destroy

         void destroy()

        Destroys the native ad renderer

      • getMediaAspectRatio

        @NonNull() Float getMediaAspectRatio()

        Returns the aspect ratio of the media content.

        Returns:

        aspect ratio as Float, or 0f if not available

      • onRecordImpression

         void onRecordImpression(@NonNull() View adView)

        Notify the POBNativeAdView is attached to view and the impression is occurred.

        Parameters:
        adView - instance of ad view
      • onRecordClick

         void onRecordClick(@NonNull() View adView)

        Notify the POBNativeAdView is clicked.

        Parameters:
        adView - instance of ad View
      • onAssetClicked

         void onAssetClicked(@NonNull() View adView, int assetId)

        Notify the assets with certain Id in is clicked.

        Parameters:
        adView - instance of ad View
        assetId - Id of the asset which is clicked.
      • onNonAssetClicked

         void onNonAssetClicked(@NonNull() View nonAssetView, @NonNull() String id)

        Notify the non-asset with certain id that got clicked.

        Parameters:
        nonAssetView - that recorded click event
        id - id of the view which is clicked
      • setWatermark

         void setWatermark(@Nullable() String watermark)

        Used to set the instance of watermark to be rendered on the native ad view.

        Parameters:
        watermark - Base-64 encoded watermark