public class POBNativeAdLoader extends java.lang.Object implements com.pubmatic.sdk.openwrap.core.POBBaseAd, POBNativeAdManager.POBNativeAdManagerListener
This class also interacts with primary ad server for header bidding via event handler if specified.
Constructor and Description |
---|
POBNativeAdLoader(Context context,
java.lang.String publisherId,
int profileId,
java.lang.String adUnitId,
POBNativeTemplateType templateType)
Initializes & returns a newly allocated ad loader object for supporting 'No Ad Server Configuration'.
|
POBNativeAdLoader(Context context,
java.lang.String publisherId,
int profileId,
java.lang.String adUnitId,
POBNativeTemplateType templateType,
com.pubmatic.sdk.nativead.POBNativeAdEvent eventHandler)
Initializes & returns a newly allocated ad loader object for supporting 'Header Bidding Configuration'.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Invoke this method when your activity/fragment is about to destroy.
|
POBRequest |
getAdRequest()
Returns an instance of POBRequest, required for setting targeting parameters.
|
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.
|
POBImpression |
getImpression()
Returns an instance of POBImpression which gets created internally.
|
void |
loadAd()
Initiate the loading for the Native ad
|
void |
onAdReceived(POBNativeAdManager adManager,
POBNativeAd nativeAd)
Notifies the callback that an Native Ad has been successfully loaded.
|
void |
onBidFailure(POBNativeAdManager nativeAdManager)
Notifies the callback that
POBBidEvent.proceedOnError(BidEventError, String)
has been called for NoAdServer integration. |
void |
onFailedToLoad(POBNativeAdManager adManager,
POBError error)
Notifies the callback of an error encountered while loading an adManager.
|
void |
setAdLoaderListener(POBNativeAdLoaderListener adLoaderListener)
Sets the POBNativeAdLoaderListener receiver for the ad loader events.
|
void |
setBidEventListener(POBBidEventListener bidEventListener)
Sets Bid event listener to notify bid events
|
void |
setNativeCustomAssets(java.util.List<com.pubmatic.sdk.nativead.request.POBBaseNativeRequestAsset> customAssetList)
Setter for native custom asset request list
|
public POBNativeAdLoader(@NonNull Context context, @NonNull java.lang.String publisherId, int profileId, @NonNull java.lang.String adUnitId, @NonNull POBNativeTemplateType templateType, @NonNull com.pubmatic.sdk.nativead.POBNativeAdEvent eventHandler)
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 subclasspublic POBNativeAdLoader(@NonNull Context context, @NonNull java.lang.String publisherId, int profileId, @NonNull java.lang.String adUnitId, @NonNull POBNativeTemplateType templateType)
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 POBNativeTemplateTypepublic void setAdLoaderListener(@Nullable POBNativeAdLoaderListener adLoaderListener)
adLoaderListener
- Instance of POBNativeAdLoaderListenerpublic void setBidEventListener(@Nullable POBBidEventListener bidEventListener)
bidEventListener
- reference of POBBidEventListener
@NonNull public POBNativeAdLoaderConfig getConfig()
POBNativeAdLoaderConfig
public void setNativeCustomAssets(@NonNull java.util.List<com.pubmatic.sdk.nativead.request.POBBaseNativeRequestAsset> customAssetList)
customAssetList
- List of custom assets created with the help POBBaseNativeRequestAsset
and
its derived classes.@RequiresPermission(value="android.permission.INTERNET") public void loadAd()
loadAd
in interface com.pubmatic.sdk.openwrap.core.POBBaseAd
@Nullable public POBImpression getImpression()
getImpression
in interface com.pubmatic.sdk.openwrap.core.POBBaseAd
@Nullable public POBRequest getAdRequest()
getAdRequest
in interface com.pubmatic.sdk.openwrap.core.POBBaseAd
public void destroy()
com.pubmatic.sdk.openwrap.core.POBBaseAd
destroy
in interface com.pubmatic.sdk.openwrap.core.POBBaseAd
public void onAdReceived(@NonNull POBNativeAdManager adManager, @NonNull POBNativeAd nativeAd)
POBNativeAdManager.POBNativeAdManagerListener
onAdReceived
in interface POBNativeAdManager.POBNativeAdManagerListener
adManager
- Instance of POBNativeAdManager over which native ad is loadednativeAd
- the newly loaded instance of POBNativeAdpublic void onFailedToLoad(@NonNull POBNativeAdManager adManager, @NonNull POBError error)
POBNativeAdManager.POBNativeAdManagerListener
onFailedToLoad
in interface POBNativeAdManager.POBNativeAdManagerListener
adManager
- Instance of POBNativeAdManager over which native adManager is loadederror
- The error encountered while attempting to load the native ad.public void onBidFailure(@NonNull POBNativeAdManager nativeAdManager)
POBBidEvent.proceedOnError(BidEventError, String)
has been called for NoAdServer integration.
Helps to manage the POBNativeAdManager
count in POBNativeAdLoader
's hashset.nativeAdManager
- Instance to be removed from POBNativeAdLoader
's hashset.