Package com.my.target.nativeads
Class NativeBannerAd
java.lang.Object
com.my.target.common.BaseAd
com.my.target.nativeads.NativeBannerAd
- All Implemented Interfaces:
IAd,INativeBannerAd
The native banner does not support MediaAdView and therefore cannot display media content
(video, cards, large image).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfacestatic interface -
Constructor Summary
ConstructorsConstructorDescriptionNativeBannerAd(int slotId, android.content.Context context) Public constructorNativeBannerAd(int slotId, MenuFactory menuFactory, android.content.Context context) Public constructor -
Method Summary
Modifier and TypeMethodDescriptionReturns listener for ad choice menu.intRetrieve current position for AdChoices iconGet the name of source network.floatAd Source Priority is the value representing current ad network place in the queue of received advertisements.Banner model for current ad.intRetrieve current cachePolicy set previouslyGet events listener of an advertisementGets listener for media objects events, such as icon loadingvoidhandleAdChoicesClick(android.content.Context context) Call to display adChoices options whose implementation has been passed using MenuFactory.voidhandleData(String data) Loads data for s2s partnersbooleanGet enable/disable mediation flagvoidload()Start loading ads.voidloadFromBid(String bidId) Start loading ad with the bidding IDvoidregisterView(android.view.View view) Deprecated.voidregisterView(android.view.View view, List<android.view.View> clickableViews) Deprecated.voidregisterView(NativeBannerAdViewBinder nativeBannerAdViewBinder) Registration of the Advertising view.voidregisterView(NativeBannerAdViewBinder nativeBannerAdViewBinder, List<android.view.View> clickableViews) Registration of the Advertising view.voidregisterView(NativeBannerAdView nativeBannerAdView) Registration of the Advertising view.voidregisterView(NativeBannerAdView nativeBannerAdView, List<android.view.View> clickableViews) Registration of the Advertising view.voidsetAdChoicesListener(NativeBannerAd.NativeBannerAdChoicesListener adChoicesListener) Set events listener of adChoices icon load Must be called beforeNativeBannerAd#load()voidsetAdChoicesOptionListener(NativeBannerAd.NativeBannerAdChoicesOptionListener adChoicesOptionListener) Sets listener for ad choice menu.voidsetAdChoicesPlacement(int adChoicesPlacement) Sets the place for AdChoices icon, by default used top-right positionvoidsetCachePolicy(int cachePolicy) By default, images and videos are preloaded.voidSet events listener of an advertisement Must be called beforeNativeBannerAd#load()voidsetMediaListener(NativeBannerAd.NativeBannerAdMediaListener mediaListener) Sets listener for media objects events, such as icon loadingvoidsetMediationEnabled(boolean mediationEnabled) Enables/disables mediation for current ad.voidView de-registration.Methods inherited from class com.my.target.common.BaseAd
getCustomParams, isLoadCalled, setAdNetworkConfig
-
Constructor Details
-
NativeBannerAd
public NativeBannerAd(int slotId, android.content.Context context) Public constructor- Parameters:
slotId- your slot idcontext- app context
-
-
Method Details
-
getListener
Get events listener of an advertisement- Returns:
- an instance of listener
- See Also:
-
setListener
Set events listener of an advertisement Must be called beforeNativeBannerAd#load()- See Also:
-
getBanner
Banner model for current ad. Null if not loaded- Returns:
NativeBanner
-
isMediationEnabled
public boolean isMediationEnabled()Get enable/disable mediation flag- Returns:
- flag
-
setMediationEnabled
public void setMediationEnabled(boolean mediationEnabled) Enables/disables mediation for current ad. Default is true. Disabling this option may cause lower fill-rate- Parameters:
mediationEnabled- if true - enable mediation, otherwise not
-
getCachePolicy
public int getCachePolicy()Retrieve current cachePolicy set previously- Specified by:
getCachePolicyin interfaceIAd- Returns:
- Value is
CachePolicy.ALL,CachePolicy.IMAGE,CachePolicy.VIDEO, orCachePolicy.NONE - See Also:
-
setCachePolicy
public void setCachePolicy(int cachePolicy) By default, images and videos are preloaded. You can turn off the automatic loading of images and videos, but keep in mind that downloading them will take extra time, which will create an additional delay in displaying ads in your application.- Specified by:
setCachePolicyin interfaceIAd- Parameters:
cachePolicy- Value isCachePolicy.ALL,CachePolicy.IMAGE,CachePolicy.VIDEO, orCachePolicy.NONE
-
getAdChoicesPlacement
public int getAdChoicesPlacement()Retrieve current position for AdChoices icon- Specified by:
getAdChoicesPlacementin interfaceIAd- Returns:
- Value is
AdChoicesPlacement.TOP_RIGHT,AdChoicesPlacement.TOP_LEFT,AdChoicesPlacement.BOTTOM_RIGHT,AdChoicesPlacement.BOTTOM_LEFT,AdChoicesPlacement.MANUAL, orAdChoicesPlacement.DRAWING_MANUAL - See Also:
-
setAdChoicesPlacement
public void setAdChoicesPlacement(int adChoicesPlacement) Sets the place for AdChoices icon, by default used top-right position- Specified by:
setAdChoicesPlacementin interfaceIAd- Parameters:
adChoicesPlacement- Value isAdChoicesPlacement.TOP_RIGHT,AdChoicesPlacement.TOP_LEFT,AdChoicesPlacement.BOTTOM_RIGHT,AdChoicesPlacement.BOTTOM_LEFT,AdChoicesPlacement.MANUAL, orAdChoicesPlacement.DRAWING_MANUAL- See Also:
-
load
public void load()Start loading ads. In case of successful loading, the onLoad method will be called on the object passed as a listener, in case of loading error or if there is no advertisement to be shown - the onNoAdAd listener should be added before this call
-
loadFromBid
Start loading ad with the bidding ID- Specified by:
loadFromBidin interfaceIAd- Parameters:
bidId- bidding ID
-
registerView
public void registerView(NativeBannerAdViewBinder nativeBannerAdViewBinder, List<android.view.View> clickableViews) Description copied from interface:INativeBannerAdRegistration of the Advertising view. Must be called before showing the ad- Specified by:
registerViewin interfaceINativeBannerAd- Parameters:
nativeBannerAdViewBinder- Advertising view binderclickableViews- specific clickable views inside Advertising view. If set, the only views in this list will be clickable. Otherwise, whole view will be clickable
-
registerView
Description copied from interface:INativeBannerAdRegistration of the Advertising view. Must be called before showing the ad- Specified by:
registerViewin interfaceINativeBannerAd- Parameters:
nativeBannerAdView- Default advertising view for native banner ad
-
registerView
public void registerView(NativeBannerAdView nativeBannerAdView, List<android.view.View> clickableViews) Description copied from interface:INativeBannerAdRegistration of the Advertising view. Must be called before showing the ad- Specified by:
registerViewin interfaceINativeBannerAd- Parameters:
nativeBannerAdView- Default advertising view for native banner adclickableViews- specific clickable views inside Advertising view. If set, the only views in this list will be clickable. Otherwise, whole view will be clickable
-
registerView
Description copied from interface:INativeBannerAdRegistration of the Advertising view. Must be called before showing the ad- Specified by:
registerViewin interfaceINativeBannerAd- Parameters:
nativeBannerAdViewBinder- Advertising view binder
-
registerView
@Deprecated public void registerView(android.view.View view, List<android.view.View> clickableViews) Deprecated.Registration of the Advertising view. Must be called before showing the ad- Specified by:
registerViewin interfaceIAd- Parameters:
view- Advertising viewclickableViews- specific clickable views inside Advertising view. If set, the only views in this list will be clickable. Otherwise, whole view will be clickable
-
registerView
Deprecated.Registration of the Advertising view. Must be called before showing the ad- Specified by:
registerViewin interfaceIAd- Parameters:
view- Advertising view
-
unregisterView
public void unregisterView()View de-registration. Stops timers, frees resources. Must be called after view is no longer needed- Specified by:
unregisterViewin interfaceIAd
-
handleData
Loads data for s2s partners- Specified by:
handleDatain interfaceIAd- Parameters:
data- s2s data
-
getAdSource
Get the name of source network. It always will be "myTarget" if no mediation enabled. returns null if ad is not loaded- Returns:
- ad source
-
getAdSourcePriority
public float getAdSourcePriority()Ad Source Priority is the value representing current ad network place in the queue of received advertisements. Works only with mediation. 0f if not loaded yet.- Returns:
- priority of ad source network
-
getAdChoicesOptionListener
Returns listener for ad choice menu.- Returns:
- Object which implements
NativeBannerAd.NativeBannerAdChoicesOptionListenerinterface.
-
setAdChoicesOptionListener
public void setAdChoicesOptionListener(NativeBannerAd.NativeBannerAdChoicesOptionListener adChoicesOptionListener) Sets listener for ad choice menu.- Parameters:
adChoicesOptionListener- Object which implementsNativeBannerAdChoicesOptionListenerinterface.
-
getMediaListener
Gets listener for media objects events, such as icon loading- Returns:
- listener object
- See Also:
-
setMediaListener
Sets listener for media objects events, such as icon loading- Parameters:
mediaListener- listener object- See Also:
-
getAdChoicesListener
- Returns:
- events listener of adChoices icon load
Must be called before
NativeBannerAd#load() - See Also:
-
setAdChoicesListener
Set events listener of adChoices icon load Must be called beforeNativeBannerAd#load() -
handleAdChoicesClick
public void handleAdChoicesClick(android.content.Context context) Call to display adChoices options whose implementation has been passed using MenuFactory.
-
NativeBannerAd#registerView(NativeBannerAdViewBinder)