Skip to main content

3. API Description

3.1 TAdRequestBody

Method NameDescription
TAdRequestBody.AdRequestBodyBuild().build()Creates a TAdRequestBody object through this method

3.2 TAdRequestBody.AdRequestBodyBuild

Method NameDescription
setAdListener(TAdListener adListener)Callbacks involved during the ad request process

3.3 TAdListener

Method NameDescription
onLoad()Callback when ad data is loaded but not yet displayed. This callback applies to all ad slots.
onError(TAdErrorCode errorCode)Callback for errors during the request process. This callback applies to all ad slots.
onShow(int source)Callback for successful ad display for Splash, Interstitial, Banner, Reward, etc.
onShowError(TAdErrorCode errorCode)Callback for failed ad display. This callback applies to all ad slots.
onClicked(int source)Callback for ad click for Splash, Interstitial, Banner, Reward, etc.
onClosed(int source)Callback for ad closure. Note: Not all ads will trigger this method.
onRewarded()Callback when rewarded video ad playback is completed.
onNativeFeedShow(int source, @Nullable TAdNativeInfo nativeInfo)Display callback for Native and Icon type ads.
onNativeFeedClicked(int source, @Nullable TAdNativeInfo nativeInfo)Click callback for Native and Icon type ads.

3.4 TBannerView

Method NameDescription
TBannerView(Context context)Constructor
loadAd()Starts requesting ads, returns the optimal ad within the set wait time.
setAdSize()Sets the banner ad size.
setCustomSizeForYandexAndLiftoff(int widthDp, int heightDp)Ad sources Liftoff (Vungle), Yandex support setting the width and height of the banner ad, unit: dp. Please refer to the Example for details.
setAdUnitId()Sets the ad unit ID.
destroy()Releases ad resources.
setRequestBody(TAdRequestBody requestBody)Sets the listener for ad request steps. Refer to the TAdRequestBody class for methods.
enterScene(String sceneId)Can be called preferentially upon reaching the ad scene, returns a String type sceneToken to be passed in during display. We use this method to better display ads.
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the host's current scene for displaying ads contains sensitive content. Ads unsuitable for this scene will be filtered out during the request.
setCloseDirectlyWithoutJumping(boolean isCloseDirectly)Ad source Hisavana Banner ad closes directly without redirection when the close button is clicked.

3.5 TInterstitialAd

Method NameDescription
TInterstitialAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody tAdRequestBody)Sets the ad request body. Refer to the TAdRequestBody class for methods.
loadAd()Starts requesting ads, returns the optimal ad within the set wait time.
show(Activity activity, String sceneToken)Displays the ad.
destroy()Releases ad resources.
hasAd()Checks if there is currently an available ad.
enterScene(String sceneId)Can be called preferentially upon reaching the ad scene, returns a String type sceneToken to be passed in during display. We use this method to better display ads.
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the host's current scene for displaying ads contains sensitive content. Ads unsuitable for this scene will be filtered out during the request.

3.6 TSplashAd

Method NameDescription
TSplashAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody tAdRequestBody)Sets the ad request body. Refer to the TAdRequestBody class for methods.
loadAd()Starts requesting ads, returns the optimal ad within the set wait time.
show(TSplashView tSplashView, String sceneToken)Displays the ad.
destroy()Releases ad resources.
hasAd()Checks if there is currently an available ad.
enterScene(String sceneId)Can be called preferentially upon reaching the ad scene, returns a String type sceneToken to be passed in during display. We use this method to better display ads.
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the host's current scene for displaying ads contains sensitive content. Ads unsuitable for this scene will be filtered out during the request.
setOnlySourceAdx(String appId, boolean athenaDebug)Ad source Hisavana enables rapid ad filling for displaying splash ads. It must be used in conjunction with the ad placement configuration fillTimeoutDuration=0ms.

3.7 TNativeAd

Method NameDescription
TNativeAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody tAdRequestBody)Sets the ad request body. Refer to the TAdRequestBody class for methods.
loadAd()Starts requesting ads, returns the optimal ad within the set wait time.
bindNativeView(TAdNativeView nativeView, TAdNativeInfo nativeInfo, ViewBinder b, String sceneToken)Registers view interaction events. Using ViewBinder is recommended over this direct method.
destroy()Releases ad resources.
hasAd()Checks if there is currently an available ad.
enterScene(String sceneId)Can be called preferentially upon reaching the ad scene, returns a String type sceneToken to be passed in during display. We use this method to better display ads.
getNativeAdInfo()Gets Native ads, returns a List.
getNativeInfoSize()Gets the number of currently available ads.
setAdmobMediaAspectRatio(int admobMediaAspectRatio)Admob native ad media aspect ratio setting:
NATIVE_MEDIA_ASPECT_RATIO_UNKNOWN = 0; (Default)
NATIVE_MEDIA_ASPECT_RATIO_ANY = 1; (Any ratio)
NATIVE_MEDIA_ASPECT_RATIO_LANDSCAPE = 2; (Landscape ratio)
NATIVE_MEDIA_ASPECT_RATIO_PORTRAIT = 3; (Portrait ratio)
NATIVE_MEDIA_ASPECT_RATIO_SQUARE = 4; (Square ratio)
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the host's current scene for displaying ads contains sensitive content. Ads unsuitable for this scene will be filtered out during the request.

3.8 TAdNativeInfo

Method NameDescription
getTitle()Gets title
getDescription()Gets ad description
getAdCallToAction()Gets button text
getPackageName()Gets the package name for download-type ads.
getPullNewestLive()0: Not user acquisition/activation (normal ad), 1: User acquisition and activation, 2: User acquisition, 3: User activation, 4: H5 game
isMatchVulgarBrand()Checks if the current ad matches the filtering rules. true: Not recommended for display in scenes with sensitive content, false: Can be displayed.
getAdFormat()Return value: 2 indicates a native task-type ad, while values other than 2 indicate regular type ads.
destroyAdReleases memory (Must be called for each displayed TAdNativeInfo when exiting the page).

3.9 TAdNativeView

Method NameDescription
TAdNativeView(Context context)Constructor
release()Releases memory

3.10 ViewBinder

Method NameDescription
titleId(int titleId)Title
descriptionId(int bodyId)Description
iconId(int iconId)Icon
mediaId(int mediaId)Main Image
sponsoredId(int sponsoredId)Age restriction label
ratingId(int ratingId)Rating
priceId(int priceId)Price
sourceSizeId(int sourceSizeId)Download package size, formatted as x.xMB or x.xGB.
adChoicesView(int adChoicesView)Ad identifier (Ad Choices)
adCloseView(int adCloseView)Close button
storeMarkView(int storeMarkView)App store icon
domainView(int domainId)Domain name
feedbackView(int feedbackId)Menu icon
adBadgeView(int adBadgeView)Ad badge (AD), recommended for media complying with RU (Russia) ad regulations.
adDisclaimerView(int adDisclaimerView)Ad disclaimer, recommended for media complying with RU (Russia) ad regulations.
callToActionId(int callToActionId)Binds the Call to Action View
actionIds(Integer... ids)Sets click events for views
build()Builds the ViewBinder
contextMode(NativeContextMode mode)Use NativeContextMode.LIST in RecyclerView, otherwise use NativeContextMode.NORMAL by default.
ViewBinder(ViewBindler.Builder builder)Private constructor, constructs a ViewBinder object through ViewBindler.Builder.

3.11 TRewardedAd

Method NameDescription
TRewardedAd(Context mContext, String slotId)Constructor
setRequestBody(TAdRequestBody body)Sets the ad request body. Refer to the TAdRequestBody class for methods.
loadAd()Starts requesting ads, returns the optimal ad within the set wait time.
show(activity,sceneToken)Displays the ad.
hasAd()Checks if there is currently an available ad.
enterScene(String sceneId)Can be called preferentially upon reaching the ad scene, returns a String type sceneToken to be passed in during display. We use this method to better display ads.
destroy()Releases ad resources.
setContainVulgarContent(boolean isContainVulgarContent)Sets whether the host's current scene for displaying ads contains sensitive content. Ads unsuitable for this scene will be filtered out during the request.

3.12 TAdManager

Method NameDescription
setUserConsent(boolean userConsent)Configures GDPR (General Data Protection Regulation) for AppLovin, InMobi, IronSource, Liftoff (Vungle), Mintegral, Pangle, Yandex; "true" means the user consents to the storage and processing of personal information, "false" means they do not.
setAgeRestrictedUser(boolean ageRestrictedUser)Configures COPPA (Children's Online Privacy Protection Act) for InMobi, IronSource, Liftoff (Vungle), Mintegral, Pangle, Yandex, Bigo; "true" means the user is a child under 13, "false" means the user is not a child under 13. By default, the user is assumed not to be a child under 13.