Class NativeBannerAd
-
- All Implemented Interfaces:
-
com.my.target.nativeads.IAd,com.my.target.nativeads.INativeBannerAd
public final class NativeBannerAd extends BaseAd implements INativeBannerAd
The native banner does not support MediaAdView and therefore cannot display media content (video, cards, large image).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceNativeBannerAd.NativeBannerAdChoicesListenerpublic interfaceNativeBannerAd.NativeBannerAdChoicesOptionListenerpublic interfaceNativeBannerAd.NativeBannerAdListenerpublic interfaceNativeBannerAd.NativeBannerAdMediaListener
-
Constructor Summary
Constructors Constructor Description NativeBannerAd(int slotId, Context context)Public constructor NativeBannerAd(int slotId, MenuFactory menuFactory, Context context)Public constructor
-
Method Summary
Modifier and Type Method Description NativeBannerAd.NativeBannerAdChoicesListenergetAdChoicesListener()NativeBannerAd.NativeBannerAdChoicesOptionListenergetAdChoicesOptionListener()Returns listener for ad choice menu. intgetAdChoicesPlacement()Retrieve current position for AdChoices icon StringgetAdSource()Get the name of source network. floatgetAdSourcePriority()Ad Source Priority is the value representing current ad network place in the queue of received advertisements. NativeBannergetBanner()Banner model for current ad. intgetCachePolicy()Retrieve current cachePolicy set previously NativeBannerAd.NativeBannerAdListenergetListener()Get events listener of an advertisement NativeBannerAd.NativeBannerAdMediaListenergetMediaListener()Gets listener for media objects events, such as icon loading voidhandleAdChoicesClick(@NonNull() Context context)Call to display adChoices options whose implementation has been passed using MenuFactory. voidhandleClick(boolean isCta, @NonNull() View view)Call to trigger click on a view manually. voidhandleData(@NonNull() String data)Loads data for s2s partners booleanisMediationEnabled()Get enable/disable mediation flag voidload()Start loading ads. voidloadFromBid(@NonNull() String bidId)Start loading ad with the bidding ID voidregisterView(@NonNull() View view)Registration of the Advertising view. voidregisterView(@NonNull() View view, @Nullable() List<View> clickableViews)Registration of the Advertising view. voidregisterView(@NonNull() NativeBannerAdViewBinder nativeBannerAdViewBinder)Registration of the Advertising view. voidregisterView(@NonNull() NativeBannerAdViewBinder nativeBannerAdViewBinder, @Nullable() List<View> clickableViews)Registration of the Advertising view. voidregisterView(@NonNull() NativeBannerAdView nativeBannerAdView)Registration of the Advertising view. voidregisterView(@NonNull() NativeBannerAdView nativeBannerAdView, @Nullable() List<View> clickableViews)Registration of the Advertising view. voidsetAdChoicesListener(@Nullable() NativeBannerAd.NativeBannerAdChoicesListener adChoicesListener)Set events listener of adChoices icon load Must be called before NativeBannerAd.load() voidsetAdChoicesOptionListener(@Nullable() NativeBannerAd.NativeBannerAdChoicesOptionListener adChoicesOptionListener)Sets listener for ad choice menu. voidsetAdChoicesPlacement(int adChoicesPlacement)Sets the place for AdChoices icon, by default used top-right position voidsetCachePolicy(int cachePolicy)By default, images and videos are preloaded. voidsetListener(@Nullable() NativeBannerAd.NativeBannerAdListener listener)Set events listener of an advertisement Must be called before NativeBannerAd.load() voidsetMediaListener(@Nullable() NativeBannerAd.NativeBannerAdMediaListener mediaListener)Sets listener for media objects events, such as icon loading voidsetMediationEnabled(boolean mediationEnabled)Enables/disables mediation for current ad. voidunregisterView()View de-registration. -
-
Constructor Detail
-
NativeBannerAd
NativeBannerAd(int slotId, Context context)
Public constructor- Parameters:
slotId- your slot idcontext- app context
-
NativeBannerAd
NativeBannerAd(int slotId, MenuFactory menuFactory, Context context)
Public constructor- Parameters:
slotId- your slot idmenuFactory- menuFactory for drawing adChoices optionscontext- app context
-
-
Method Detail
-
getAdChoicesListener
@Nullable() NativeBannerAd.NativeBannerAdChoicesListener getAdChoicesListener()
- Returns:
events listener of adChoices icon load Must be called before NativeBannerAd.load()
-
getAdChoicesOptionListener
@Nullable() NativeBannerAd.NativeBannerAdChoicesOptionListener getAdChoicesOptionListener()
Returns listener for ad choice menu.
- Returns:
Object which implements NativeBannerAd.NativeBannerAdChoicesOptionListener interface.
-
getAdChoicesPlacement
int getAdChoicesPlacement()
Retrieve current position for AdChoices icon
- Returns:
Value is TOP_RIGHT, TOP_LEFT, BOTTOM_RIGHT, BOTTOM_LEFT, MANUAL, or DRAWING_MANUAL
-
getAdSource
@Nullable() String 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
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
-
getBanner
@Nullable() NativeBanner getBanner()
Banner model for current ad. Null if not loaded
- Returns:
-
getCachePolicy
int getCachePolicy()
Retrieve current cachePolicy set previously
-
getListener
@Nullable() NativeBannerAd.NativeBannerAdListener getListener()
Get events listener of an advertisement
- Returns:
an instance of listener
-
getMediaListener
@Nullable() NativeBannerAd.NativeBannerAdMediaListener getMediaListener()
Gets listener for media objects events, such as icon loading
- Returns:
listener object
-
handleAdChoicesClick
void handleAdChoicesClick(@NonNull() Context context)
Call to display adChoices options whose implementation has been passed using MenuFactory.
-
handleClick
void handleClick(boolean isCta, @NonNull() View view)
Call to trigger click on a view manually.
-
handleData
void handleData(@NonNull() String data)
Loads data for s2s partners
-
isMediationEnabled
boolean isMediationEnabled()
Get enable/disable mediation flag
- Returns:
flag
-
load
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 onNoAd
Ad listener should be added before this call
-
loadFromBid
void loadFromBid(@NonNull() String bidId)
Start loading ad with the bidding ID
-
registerView
@Deprecated() void registerView(@NonNull() View view)
Registration of the Advertising view. Must be called before showing the ad
-
registerView
@Deprecated() void registerView(@NonNull() View view, @Nullable() List<View> clickableViews)
Registration of the Advertising view. Must be called before showing the ad
-
registerView
void registerView(@NonNull() NativeBannerAdViewBinder nativeBannerAdViewBinder)
Registration of the Advertising view. Must be called before showing the ad
- Parameters:
nativeBannerAdViewBinder- Advertising view binder
-
registerView
void registerView(@NonNull() NativeBannerAdViewBinder nativeBannerAdViewBinder, @Nullable() List<View> clickableViews)
Registration of the Advertising view. Must be called before showing the ad
- Parameters:
nativeBannerAdViewBinder- Advertising view binderclickableViews- specific clickable views inside Advertising view.
-
registerView
void registerView(@NonNull() NativeBannerAdView nativeBannerAdView)
Registration of the Advertising view. Must be called before showing the ad
- Parameters:
nativeBannerAdView- Default advertising view for native banner ad
-
registerView
void registerView(@NonNull() NativeBannerAdView nativeBannerAdView, @Nullable() List<View> clickableViews)
Registration of the Advertising view. Must be called before showing the ad
- Parameters:
nativeBannerAdView- Default advertising view for native banner adclickableViews- specific clickable views inside Advertising view.
-
setAdChoicesListener
void setAdChoicesListener(@Nullable() NativeBannerAd.NativeBannerAdChoicesListener adChoicesListener)
Set events listener of adChoices icon load Must be called before NativeBannerAd.load()
-
setAdChoicesOptionListener
void setAdChoicesOptionListener(@Nullable() NativeBannerAd.NativeBannerAdChoicesOptionListener adChoicesOptionListener)
Sets listener for ad choice menu.
- Parameters:
adChoicesOptionListener- Object which implements NativeBannerAdChoicesOptionListener interface.
-
setAdChoicesPlacement
void setAdChoicesPlacement(int adChoicesPlacement)
Sets the place for AdChoices icon, by default used top-right position
- Parameters:
adChoicesPlacement- Value is TOP_RIGHT, TOP_LEFT, BOTTOM_RIGHT, BOTTOM_LEFT, MANUAL, or DRAWING_MANUAL
-
setCachePolicy
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.
-
setListener
void setListener(@Nullable() NativeBannerAd.NativeBannerAdListener listener)
Set events listener of an advertisement Must be called before NativeBannerAd.load()
-
setMediaListener
void setMediaListener(@Nullable() NativeBannerAd.NativeBannerAdMediaListener mediaListener)
Sets listener for media objects events, such as icon loading
- Parameters:
mediaListener- listener object
-
setMediationEnabled
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
-
unregisterView
void unregisterView()
View de-registration. Stops timers, frees resources. Must be called after view is no longer needed
-
-
-
-