Class POBNativeAdLoader

  • All Implemented Interfaces:
    com.pubmatic.sdk.nativead.POBNativeAdManager.POBNativeAdBidFailureEventListener , com.pubmatic.sdk.nativead.POBNativeAdManager.POBNativeAdManagerListener , com.pubmatic.sdk.openwrap.core.POBBaseAd

    
    public class POBNativeAdLoader
     implements POBBaseAd, POBNativeAdManager.POBNativeAdManagerListener, POBNativeAdManager.POBNativeAdBidFailureEventListener
                        

    Ad loader class to load native ad from PubMatic as per the template specified during initialization.

    This class also interacts with primary ad server for header bidding via event handler if specified.

    • Constructor Detail

      • POBNativeAdLoader

        POBNativeAdLoader(Context context, String publisherId, int profileId, String adUnitId, POBNativeTemplateType templateType, POBNativeAdEvent eventHandler)
        Initializes &returns a newly allocated ad loader object for supporting 'Header Bidding Configuration'.
        Parameters:
        publisherId - Unique identifier assigned at the time of publisher on-boarding.
        profileId - Profile id of the ad tag.
        adUnitId - Ad unit id used to identify unique placement on screen.
        templateType - Instance of POBNativeTemplateType any custom properties such as ContextType, ContextSubType, placementType etc.
        eventHandler - Instance of POBNativeAdEvent or its subclass
      • POBNativeAdLoader

        POBNativeAdLoader(Context context, String publisherId, int profileId, String adUnitId, POBNativeTemplateType templateType)
        Initializes &returns a newly allocated ad loader object for supporting 'No Ad Server Configuration'.
        Parameters:
        publisherId - Unique identifier assigned at the time of publisher on-boarding.
        profileId - Profile id of the ad tag.
        adUnitId - Ad unit id used to identify unique placement on screen.
        templateType - Instance of POBNativeTemplateType
    • Method Detail

      • loadAd

        @RequiresPermission(value = "android.permission.INTERNET") void loadAd()

        Initiate the loading for the Native ad

      • getImpression

        @Nullable() POBImpression getImpression()

        Returns an instance of POBImpression which gets created internally. POBImpression provides the APIs to set PubMatic zone id and other custom parameters.

        Returns:

        Returns an instance of POBImpression.

      • getAdRequest

        @Nullable() POBRequest getAdRequest()

        Returns an instance of POBRequest, required for setting targeting parameters.

        Returns:

        Instance of POBRequest

      • onAdReceived

         void onAdReceived(@NonNull() POBNativeAdManager adManager, @NonNull() POBNativeAd nativeAd)

        Notifies the callback that an Native Ad has been successfully loaded.

        Parameters:
        adManager - Instance of POBNativeAdManager over which native ad is loaded
        nativeAd - the newly loaded instance of POBNativeAd
      • onFailedToLoad

         void onFailedToLoad(@NonNull() POBNativeAdManager adManager, @NonNull() POBError error)

        Notifies the callback of an error encountered while loading an adManager.

        Parameters:
        adManager - Instance of POBNativeAdManager over which native adManager is loaded
        error - The error encountered while attempting to load the native ad.
      • setBidEventListener

         void setBidEventListener(@Nullable() POBBidEventListener bidEventListener)

        Sets Bid event listener to notify bid events

        Parameters:
        bidEventListener - reference of POBBidEventListener