Skip to main content

3. API description

3.1 TAdRequestBody

Method NameMethod Introduction
TAdRequestBody.AdRequestBodyBuild().build()Create a TAdRequestBody object through this method

3.2 TAdRequestBody.AdRequestBodyBuild

Method NameMethod Introduction
setAdListener(TAdListener adListener)Callbacks involved in the ad request process

3.3 TAdListener

Method nameMethod introduction
onLoad()The ad data has been loaded but not yet displayed. This callback method applies to all ad positions
onError(TAdErrorCode errorCode)Callback for errors during the request process. This callback method applies to all ad positions
onShow(int source)Callback for successful display of ads such as Splash, Interstitial, Banner, and Reward
onShowError(TAdErrorCode errorCode)Callback for failed display of ads. This callback method applies to all ad positions
onClicked(int source)Callback for clicks on ads such as Splash, Interstitial, Banner, and Reward
onClosed(int source)Ad closing callback, not all ads will call this method
onRewarded()Rewarded Ads finished
onNativeFeedShow(int source, @Nullable TAdNativeInfo nativeInfo)Native or Icon ad display callbacks
onNativeFeedClicked(int source, @Nullable TAdNativeInfo nativeInfo)Native or Icon advertising click callbacks

3.4 TBannerView

Method NameMethod Introduction
TBannerView(Context context)Constructor
loadAd()Start requesting advertisements and return the best advertisements within the set waiting time
setAdSize()Set banner ad size
setAdWidth()Ad source Yandex Set banner ad width
setAdUnitId()Set ad slot id
destroy()Release inventory
setRequestBody(TAdRequestBody requestBody)Set the ad request step monitoring, please refer to the TAdRequestBody class for the method
hasAd()Determine whether there are currently available ads
enterScene(String sceneId)It can be called first when reaching the advertising scene and returns a String type sceneToken, which is passed in during display. We will use this method to better display ads
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the current scene for displaying ads contains sensitive content. When requesting ads, it will filter out ads that cannot be displayed in that scene
setCloseDirectlyWithoutJumping(boolean isCloseDirectly)Ad source Hisavana Banner ads can be closed directly without jumping by clicking the close button.

3.5 TInterstitialAd

Method NameMethod Introduction
TInterstitialAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody tAdRequestBody)Set the ad request body, please refer to the TAdRequestBody class for the method
loadAd()Start to request ads and return the best ads within the set waiting time
show(Activity activity, String sceneToken)Display Ads
destroy()Release inventory
hasAd()Determine whether there are currently available ads
enterScene(String sceneId)It can be called first when reaching the advertising scene and returns a String type sceneToken, which is passed in during display. We will use this method to better display ads
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the current scene for displaying ads contains sensitive content. When requesting ads, it will filter out ads that cannot be displayed in that scene

3.6 TSplashAd

Method NameMethod Introduction
TSplashAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody tAdRequestBody)Set the ad request body, please refer to the TAdRequestBody class for the method
loadAd()Start to request ads and return the best ads within the set waiting time
show(TSplashView tSplashView, String sceneToken)Display Ads
destroy()Release inventory
hasAd()Determine whether there are currently available ads
enterScene(String sceneId)It can be called first when reaching the advertising scene and returns a String type sceneToken, which is passed in during display. We will use this method to better display ads
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the current scene for displaying ads contains sensitive content. When requesting ads, it will filter out ads that cannot be displayed in that scene

3.7 TNativeAd

Method NameMethod Introduction
TNativeAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody tAdRequestBody)Set the ad request body, please refer to the TAdRequestBody class for the method
loadAd()Start requesting an ad and return the best ad within the set waiting time
bindNativeView(TAdNativeView nativeView, TAdNativeInfo nativeInfo, ViewBinder b)Register view interaction events, it is recommended to use ViewBinder instead, it is not recommended to use this method directly
destroy()Release inventory
hasAd()Determine whether there are currently available ads
enterScene(String sceneId)It can be called first when reaching the advertising scene and returns a String type sceneToken, which is passed in during display. We will use this method to better display ads
getNativeAdInfo()Get Native ads and return a List
getNativeInfoSize()Get the number of ads currently available
setAdmobMediaAspectRatio(int admobMediaAspectRatio)Admob native creative ratio settings:
NATIVE_MEDIA_ASPECT_RATIO_UNKNOWN = 0; (Default)
NATIVE_MEDIA_ASPECT_RATIO_ANY = 1; (Any Proportion)
NATIVE_MEDIA_ASPECT_RATIO_LANDSCAPE = 2;(Horizontal Proportion)
NATIVE_MEDIA_ASPECT_RATIO_PORTRAIT = 3;(Vertical Proportion)
NATIVE_MEDIA_ASPECT_RATIO_SQUARE = 4;(Square Proportion)
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the current scene for displaying ads contains sensitive content. When requesting ads, it will filter out ads that cannot be displayed in that scene

3.8 TAdNativeInfo

Method NameMethod Introduction
getPackageName()The name of the package that pulls in new and revitalizes tired advertisements
getPullNewestLive()0 non pull new pull live (regular advertising), 1 represents pull new and pull live, 2 pull new, 3 pull live, 4: H5 game
destroyAdRelease memory (each TadNativeInfo that has been displayed needs to call this method when exiting the page)
isMatchVulgarBrand()Determines whether the current ad matches the filtering rules. Returns true if it is not recommended to display in scenes with sensitive content; returns false if it can be displayed

3.9 TAdNativeView

Method NameMethod Introduction
TAdNativeView(Context context)Constructor
release()Release memory

3.10 ViewBinder

Method NameMethod Introduction
titleId(int titleId)Bind title view
descriptionId(int bodyId)Bind description view
iconId(int iconId)Bind icon view
mediaId(int mediaId)Bind media view
sponsoredId(int sponsoredId)Bind sponsored view
ratingId(int ratingId)Bind rating view
priceId(int priceId)Bind price view
adChoicesView(int adChoicesView)Bind ad logo view
adCloseView(int adCloseView)Bind close button view
storeMarkView(int storeMarkView)Bind app store icon view
domainView(int domainId)Bind domain view
feedbackView(int feedbackId)Bind feedback view
adBadgeView(int adBadgeView)Advertising AD corner mark, recommended media that adapts to RU (Russia) advertising compliance
adDisclaimerView(int adDisclaimerView)Advertising disclaimer, recommended media that adapts to RU (Russia) advertising compliance
callToActionId(int callToActionId)Bind CalltoAction View
actionIds(Integer... ids)Register click events for views
build()build viewBinder
contextMode(NativeContextMode mode)Use NativeContextMode.LIST in RecyclerView, and use NativeContextMode.NORMAL by default for others.
ViewBinder(ViewBindler.Builder builder)Private construction method, constructing ViewBinder objects through ViewBinder. Builder

3.11 TRewardedAd

Method NameMethod Introduction
TRewardedAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody body)Set the ad request body, please refer to the TAdRequestBody class for the method
loadAd()Start to request ads and return the best ads within the set waiting time
show(Activity activity,String sceneToken)Display Ads
hasAd()Determine whether there are currently available ads
enterScene(String sceneId)It can be called first when reaching the advertising scene and returns a String type sceneToken, which is passed in during display. We will use this method to better display ads
destroy()Release inventory
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the current scene for displaying ads contains sensitive content. When requesting ads, it will filter out ads that cannot be displayed in that scene

3.12 TAdManager

Method NameMethod Introduction
setUserConsent(boolean userConsent)Yandex is configurable for GDPR (General Data Protection Regulation); a "true" value indicates that the user agrees to the storage and processing of personal information, a "false" value indicates no consent.
setAgeRestrictedUser(boolean ageRestrictedUser)Yandex and Bigo can configure COPPA (Children's Online Privacy Protection Act); a "true" value indicates that the user is a child under 13, and a "false" value indicates that the user is not a child under 13. By default, it is assumed that the user is not a child under 13.