Class POBNativeAdProvider
-
- All Implemented Interfaces:
-
com.pubmatic.sdk.nativead.POBNativeAd,com.pubmatic.sdk.nativead.POBNativeAdEventListener,com.pubmatic.sdk.nativead.renderer.POBNativeRendererListener
public class POBNativeAdProvider implements POBNativeAd, POBNativeRendererListener, POBNativeAdEventListener
Class implementing the core logic of Native Ad provider which identifies the type and returns either POBNativeAd or POBCustomNativeAd instance.
-
-
Constructor Summary
Constructors Constructor Description POBNativeAdProvider(Context context, POBNativeTemplateType nativeTemplateType, POBNativeAdEventBridge adEventHandler)Constructor
-
Method Summary
Modifier and Type Method Description voidrenderAd(@NonNull() POBNativeAdListener listener)Render the native template in POBNativeAdView object voidrenderAd(@NonNull() POBNativeTemplateView templateView, @NonNull() POBNativeAdListener listener)Another flavor of renderAd method use by publisher to pass there own custom view template voiddestroy()Method to destroy the native ad voidregisterViewForInteraction(@NonNull() View adView, @NonNull() List<View> clickableViews, @NonNull() POBNativeAdListener listener)Register's native ad view and its asset views for impression and click tracking purpose. POBNativeAdViewgetAdView()Returns the rendered Native Ad View in both OpenWrapPartnerWin and OnAdServerWin condition Instance of POBNativeAdView works as a wrapper around AdServerView and OpenWrap POBNativeTemplateView POBNativeAdTitleResponseAssetgetTitleAssetForId(int assetId)Return the title asset for the respective Id POBNativeAdDataResponseAssetgetDataAssetForId(int assetId)Return the data asset for the respective Id POBNativeAdImageResponseAssetgetImageAssetForId(int assetId)Return the image asset for the respective Id voidonAdRendered(@NonNull() View adView)Notify about the Native Ad rendering completion voidonAdRenderingFailed(@NonNull() POBError error)Notify about the Native Ad rendering failure voidonAdImpression()Notify about the Native Ad recorded impression voidonAdClicked()Notify about the Native Ad recorded click voidonAdClicked(int assetId)Notify about the Native Ad recorded click for specific asset voidonAdLeavingApplication()Notify about the Native Ad leaving application voidonAdOpened()Notify about the Native Ad opened voidonAdClosed()Notify about the Native Ad closed voidonDsaInfoIconClicked()Notifies to show the DSA info detail screen voidonNativeAdClosed()Get called this when the ad server SDK closed the ad voidonNativeAdOpened()Get called this when the ad server SDK has opened an ad voidonNativeAdClicked()Get called when the ad server SDK informs about click event as a result of user interaction. voidonNativeAdImpression()Get called when the ad server SDK informs about impression event voidsetBid(@Nullable() POBBid bid)Sets the instance of POBBid voidsetNativeAdResponse(@Nullable() POBNativeAdResponse nativeAdResponse)Setter for the native ad response -
-
Constructor Detail
-
POBNativeAdProvider
POBNativeAdProvider(Context context, POBNativeTemplateType nativeTemplateType, POBNativeAdEventBridge adEventHandler)
Constructor- Parameters:
context- Activity contextnativeTemplateType- Template type for Native AdadEventHandler- Instance of POBNativeAdEvent
-
-
Method Detail
-
renderAd
@MainThread() void renderAd(@NonNull() POBNativeAdListener listener)
Render the native template in POBNativeAdView object
- Parameters:
listener- POBNativeAdListener to get rendering callbacks
-
renderAd
@MainThread() void renderAd(@NonNull() POBNativeTemplateView templateView, @NonNull() POBNativeAdListener listener)
Another flavor of renderAd method use by publisher to pass there own custom view template
- Parameters:
templateView- custom template to get populatelistener- POBNativeAdListener of rendering callbacks
-
destroy
void destroy()
Method to destroy the native ad
-
registerViewForInteraction
void registerViewForInteraction(@NonNull() View adView, @NonNull() List<View> clickableViews, @NonNull() POBNativeAdListener listener)
Register's native ad view and its asset views for impression and click tracking purpose.
- Parameters:
adView- native ad view containerclickableViews- clickable asset viewslistener- POBNativeAdListener of rendering callbacks
-
getAdView
@Nullable() POBNativeAdView getAdView()
Returns the rendered Native Ad View in both OpenWrapPartnerWin and OnAdServerWin condition Instance of POBNativeAdView works as a wrapper around AdServerView and OpenWrap POBNativeTemplateView
- Returns:
Instance of POBNativeAdView
-
getTitleAssetForId
@Nullable() POBNativeAdTitleResponseAsset getTitleAssetForId(int assetId)
Return the title asset for the respective Id
- Parameters:
assetId- Id of the asset.- Returns:
Instance of POBNativeAdTitleResponseAsset
-
getDataAssetForId
@Nullable() POBNativeAdDataResponseAsset getDataAssetForId(int assetId)
Return the data asset for the respective Id
- Parameters:
assetId- Id of the asset.- Returns:
Instance of POBNativeAdDataResponseAsset
-
getImageAssetForId
@Nullable() POBNativeAdImageResponseAsset getImageAssetForId(int assetId)
Return the image asset for the respective Id
- Parameters:
assetId- Id of the asset.- Returns:
Instance of POBNativeAdImageResponseAsset
-
onAdRendered
void onAdRendered(@NonNull() View adView)
Notify about the Native Ad rendering completion
-
onAdRenderingFailed
void onAdRenderingFailed(@NonNull() POBError error)
Notify about the Native Ad rendering failure
- Parameters:
error- POBError for show failures
-
onAdImpression
void onAdImpression()
Notify about the Native Ad recorded impression
-
onAdClicked
void onAdClicked()
Notify about the Native Ad recorded click
-
onAdClicked
void onAdClicked(int assetId)
Notify about the Native Ad recorded click for specific asset
-
onAdLeavingApplication
void onAdLeavingApplication()
Notify about the Native Ad leaving application
-
onAdOpened
void onAdOpened()
Notify about the Native Ad opened
-
onAdClosed
void onAdClosed()
Notify about the Native Ad closed
-
onDsaInfoIconClicked
void onDsaInfoIconClicked()
Notifies to show the DSA info detail screen
-
onNativeAdClosed
void onNativeAdClosed()
Get called this when the ad server SDK closed the ad
-
onNativeAdOpened
void onNativeAdOpened()
Get called this when the ad server SDK has opened an ad
-
onNativeAdClicked
void onNativeAdClicked()
Get called when the ad server SDK informs about click event as a result of user interaction.
-
onNativeAdImpression
void onNativeAdImpression()
Get called when the ad server SDK informs about impression event
-
setBid
void setBid(@Nullable() POBBid bid)
Sets the instance of POBBid
- Parameters:
bid- Instance of POBBid
-
setNativeAdResponse
void setNativeAdResponse(@Nullable() POBNativeAdResponse nativeAdResponse)
Setter for the native ad response
- Parameters:
nativeAdResponse- Instance of POBNativeAdResponse
-
-
-
-