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.
-
-
Field Summary
Fields Modifier and Type Field Description public final POBNativeAdLoaderConfigconfig
-
Constructor Summary
Constructors Constructor Description 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'. 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'.
-
Method Summary
Modifier and Type Method Description POBNativeAdLoaderConfiggetConfig()Returns the Instance of the Ad Loader config class which publisher can use to pass any custom properties such as ContextType, ContextSubType, PlacementType etc. voidsetNativeCustomAssets(@NonNull() List<POBBaseNativeRequestAsset> customAssetList)Setter for native custom asset request list voidloadAd()Initiate the loading for the Native ad POBImpressiongetImpression()Returns an instance of POBImpression which gets created internally. POBRequestgetAdRequest()Returns an instance of POBRequest, required for setting targeting parameters. voiddestroy()voidonAdReceived(@NonNull() POBNativeAdManager adManager, @NonNull() POBNativeAd nativeAd)Notifies the callback that an Native Ad has been successfully loaded. voidonFailedToLoad(@NonNull() POBNativeAdManager adManager, @NonNull() POBError error)Notifies the callback of an error encountered while loading an adManager. voidonBidFailure(@NonNull() POBNativeAdManager nativeAdManager)Notifies the callback that proceedOnError has been called for NoAdServer integration. voidsetAdLoaderListener(@Nullable() POBNativeAdLoaderListener adLoaderListener)Sets the POBNativeAdLoaderListener receiver for the ad loader events. voidsetBidEventListener(@Nullable() POBBidEventListener bidEventListener)Sets Bid event listener to notify bid events -
-
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
-
getConfig
@NonNull() POBNativeAdLoaderConfig getConfig()
Returns the Instance of the Ad Loader config class which publisher can use to pass any custom properties such as ContextType, ContextSubType, PlacementType etc.
- Returns:
Instance of POBNativeAdLoaderConfig
-
setNativeCustomAssets
void setNativeCustomAssets(@NonNull() List<POBBaseNativeRequestAsset> customAssetList)
Setter for native custom asset request list
- Parameters:
customAssetList- List of custom assets created with the help POBBaseNativeRequestAsset and its derived classes.
-
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
-
destroy
void destroy()
-
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 loadednativeAd- 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 loadederror- The error encountered while attempting to load the native ad.
-
onBidFailure
void onBidFailure(@NonNull() POBNativeAdManager nativeAdManager)
Notifies the callback that proceedOnError has been called for NoAdServer integration. Helps to manage the POBNativeAdManager count in POBNativeAdLoader's hashset.
- Parameters:
nativeAdManager- Instance to be removed from POBNativeAdLoader's hashset.
-
setAdLoaderListener
void setAdLoaderListener(@Nullable() POBNativeAdLoaderListener adLoaderListener)
Sets the POBNativeAdLoaderListener receiver for the ad loader events.
- Parameters:
adLoaderListener- Instance of POBNativeAdLoaderListener
-
setBidEventListener
void setBidEventListener(@Nullable() POBBidEventListener bidEventListener)
Sets Bid event listener to notify bid events
- Parameters:
bidEventListener- reference of POBBidEventListener
-
-
-
-