3. API Description
3.1 TAdRequestBody
| Method Name | Description |
|---|---|
| TAdRequestBody.AdRequestBodyBuild().build() | Creates a TAdRequestBody object. |
3.2 TAdRequestBody.AdRequestBodyBuild
| Method Name | Description |
|---|---|
| setAdListener(TAdListener adListener) | Registers callbacks for the ad request lifecycle. |
3.3 TAdListener
| Method Name | Description |
|---|---|
| onLoad() | Fired when ad data is loaded and ready to display. Applies to all ad types. |
| onError(TAdErrorCode errorCode) | Fired when an error occurs during the request. Applies to all ad types. |
| onShow(int source) | Fired when a Splash, Interstitial, Banner, or Rewarded ad is displayed successfully. |
| onShowError(TAdErrorCode errorCode) | Fired when an ad fails to display. Applies to all ad types. |
| onClicked(int source) | Fired when a Splash, Interstitial, Banner, or Rewarded ad is clicked. |
| onClosed(int source) | Fired when an ad is closed. Not all ad types trigger this callback. |
| onRewarded() | Fired when a rewarded video ad finishes playback. |
| onNativeFeedShow(int source, @Nullable TAdNativeInfo nativeInfo) | Display callback for Native and Icon ads. |
| onNativeFeedClicked(int source, @Nullable TAdNativeInfo nativeInfo) | Click callback for Native and Icon ads. |
3.4 TBannerView
| Method Name | Description |
|---|---|
| TBannerView(Context context) | Constructor. |
| loadAd() | Starts the ad request and returns the best available ad within the configured timeout. |
| setAdSize() | Sets the banner ad size. |
| setCustomSizeForYandexAndLiftoff(int widthDp, int heightDp) | Ad sources Liftoff (Vungle), Yandex — sets a custom banner width and height in dp. See example. |
| setAdUnitId() | Sets the ad unit ID. |
| setBannerType(int bannerType) | Sets the banner ad type. |
| destroy() | Releases ad resources. |
| resume() | Resumes the banner ad (pair with pause()). |
| pause() | Pauses the banner ad (pair with resume()). |
| setRequestBody(TAdRequestBody requestBody) | Sets the ad request listener. Refer to the TAdRequestBody class. |
| enterScene(String sceneId, int adCount) | Call when entering the ad scene. Returns a sceneToken to pass into the display call for better ad selection. |
| setContainVulgarContent(boolean isContainVulgarContent) | Indicates whether the host scene contains sensitive content. Incompatible ads are filtered during the request. |
| setCloseDirectlyWithoutJumping(boolean isCloseDirectly) | Ad source Hisavana SSP — closes the banner directly on close button tap without navigating. |
| setHideAdCloseView(boolean hide) | Hides the ad close button. |
3.5 TInterstitialAd
| Method Name | Description |
|---|---|
| TInterstitialAd(Context mContext, String slotId) | Constructor. |
| setRequestBody(TAdRequestBody tAdRequestBody) | Sets the ad request body. Refer to the TAdRequestBody class. |
| loadAd() | Starts the ad request and returns the best available ad within the configured timeout. |
| show(Activity activity, String sceneToken) | Displays the interstitial ad. |
| destroy() | Releases ad resources. |
| hasAd() | Returns true if a ready ad is available. |
| enterScene(String sceneId, int adCount) | Call when entering the ad scene. Returns a sceneToken to pass into show(). |
| setContainVulgarContent(boolean isContainVulgarContent) | Indicates whether the host scene contains sensitive content. Incompatible ads are filtered during the request. |
3.6 TSplashAd
| Method Name | Description |
|---|---|
| TSplashAd(Context mContext, String slotId) | Constructor. |
| setRequestBody(TAdRequestBody tAdRequestBody) | Sets the ad request body. Refer to the TAdRequestBody class. |
| loadAd() | Starts the ad request and returns the best available ad within the configured timeout. |
| showAd(TSplashView tSplashView) | Displays the splash ad. |
| showAd(TSplashView tSplashView, String sceneToken) | Displays the splash ad with a scene token. |
| showAd(TSplashView tSplashView, View logoLayout) | Displays the splash ad with a custom logo layout. |
| showAd(TSplashView tSplashView, View logoLayout, String sceneToken) | Displays the splash ad with a custom logo layout and scene token. |
| destroy() | Releases ad resources. |
| hasAd() | Returns true if a ready ad is available. |
| enterScene(String sceneId, int adCount) | Call when entering the ad scene. Returns a sceneToken to pass into showAd(). |
| setContainVulgarContent(boolean isContainVulgarContent) | Indicates whether the host scene contains sensitive content. Incompatible ads are filtered during the request. |
| setOnlySourceAdx(String appId, boolean athenaDebug) | Ad source Hisavana SSP — enables rapid-fill splash display. Must be used with ad unit config fillTimeoutDuration=0ms. |
| setLogoLayoutHeightRatio(Float logoLayoutHeightRatio) | Ad sources Hisavana SSP, Mintegral — sets the logo area height ratio. Range: 0.1–0.2, default: 0.2. |
3.7 TNativeAd
| Method Name | Description |
|---|---|
| TNativeAd(Context mContext, String slotId) | Constructor. |
| setRequestBody(TAdRequestBody tAdRequestBody) | Sets the ad request body. Refer to the TAdRequestBody class. |
| loadAd() | Starts the ad request and returns the best available ad within the configured timeout. |
| bindNativeView(TAdNativeView nativeView, TAdNativeInfo nativeInfo, ViewBinder b, String sceneToken) | Registers view interaction events. Using ViewBinder is the recommended approach. sceneToken is the value returned by enterScene(); omit it by using the overload without sceneToken. |
| bindNativeView(TAdNativeView nativeView, TAdNativeInfo nativeInfo, ViewBinder b) | Registers view interaction events without a scene token. Otherwise identical to the overload above. |
| destroy() | Releases ad resources. |
| hasAd() | Returns true if a ready ad is available. |
| enterScene(String sceneId, int adCount) | Call when entering the ad scene. Returns a sceneToken to pass into the display call. |
| getNativeAdInfo() | Returns a List of available native ads. |
| getNativeInfoSize() | Returns the number of currently available ads. |
| setAdmobMediaAspectRatio(int admobMediaAspectRatio) | Sets the media aspect ratio for Admob native ads: 0 = UNKNOWN (default), 1 = ANY, 2 = LANDSCAPE, 3 = PORTRAIT, 4 = SQUARE. |
| setContainVulgarContent(boolean isContainVulgarContent) | Indicates whether the host scene contains sensitive content. Incompatible ads are filtered during the request. |
3.8 TAdNativeInfo
| Method Name | Description |
|---|---|
| getTitle() | Returns the ad title. |
| getDescription() | Returns the ad description. |
| getAdCallToAction() | Returns the call-to-action button text. |
| getPackageName() | Returns the package name for download-type ads. |
| getPullNewestLive() | 0 = normal ad; 1 = acquisition + re-engagement; 2 = acquisition only; 3 = re-engagement only; 4 = H5 game. |
| isMatchVulgarBrand() | true = ad matches sensitive-content filter (not recommended in sensitive scenes); false = safe to display. |
| getAdFormat() | Returns 2 for task-type native ads; any other value indicates a standard ad. |
| destroyAd | Releases memory. Call this for every displayed TAdNativeInfo when leaving the page. |
3.9 TAdNativeView
| Method Name | Description |
|---|---|
| TAdNativeView(Context context) | Constructor. |
| release() | Releases memory. |
3.10 ViewBinder
| Method Name | Description |
|---|---|
| titleId(int titleId) | Title view. |
| descriptionId(int bodyId) | Description view. |
| iconId(int iconId) | Icon view. |
| mediaId(int mediaId) | Main image / media view. |
| sponsoredId(int sponsoredId) | Age-restriction label view. |
| ratingId(int ratingId) | Rating view. |
| priceId(int priceId) | Price view. |
| sourceSizeId(int sourceSizeId) | Download package size view. Format: x.xMB or x.xGB. |
| adChoicesView(int adChoicesView) | Ad identifier (AdChoices) view. |
| adCloseView(int adCloseView) | Close button view. |
| storeMarkView(int storeMarkView) | App store icon view. |
| domainView(int domainId) | Domain name view. |
| feedbackView(int feedbackId) | Feedback / menu icon view. |
| adBadgeView(int adBadgeView) | "AD" badge view. Recommended for RU (Russia) ad compliance. |
| adDisclaimerView(int adDisclaimerView) | Ad disclaimer view. Recommended for RU (Russia) ad compliance. |
| callToActionId(int callToActionId) | Binds the Call-to-Action view. |
| actionIds(Integer... ids) | Registers click event listeners on the given views. |
| build() | Builds and returns the ViewBinder instance. |
| contextMode(NativeContextMode mode) | Sets the native ad usage context: NativeContextMode.LIST for list scenes such as RecyclerView; NativeContextMode.NORMAL for all other scenes (default). |
| ViewBinder(ViewBinder.Builder builder) | Private constructor. Use ViewBinder.Builder to construct the instance. |
3.11 TRewardedAd
| Method Name | Description |
|---|---|
| TRewardedAd(Context mContext, String slotId) | Constructor. |
| setRequestBody(TAdRequestBody body) | Sets the ad request body. Refer to the TAdRequestBody class. |
| loadAd() | Starts the ad request and returns the best available ad within the configured timeout. |
| show(Activity activity, String sceneToken) | Displays the rewarded ad. |
| hasAd() | Returns true if a ready ad is available. |
| enterScene(String sceneId, int adCount) | Call when entering the ad scene. Returns a sceneToken to pass into show(). |
| destroy() | Releases ad resources. |
| setContainVulgarContent(boolean isContainVulgarContent) | Indicates whether the host scene contains sensitive content. Incompatible ads are filtered during the request. |
3.12 TAdManager
| Method Name | Description |
|---|---|
| setUserConsent(boolean userConsent) | Configures GDPR for AppLovin, InMobi, IronSource, Liftoff (Vungle), Mintegral, Pangle, Yandex. true = user consents to personal data processing; false = user does not consent. |
| setAgeRestrictedUser(boolean ageRestrictedUser) | Configures COPPA for InMobi, IronSource, Liftoff (Vungle), Mintegral, Pangle, Yandex, Bigo. true = user is under 13; false = user is not under 13. Default: false. |
3.13 MediationJsBridge
Feature: Enables JavaScript to invoke native-level ad mediation capabilities from a WebView.
webView.getSettings().setCacheMode(LOAD_NORMAL);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptEnabled(true); // Enable JS interaction
webView.addJavascriptInterface(new MediationJsBridge(webView), MediationJsBridge.INTERFACE_NAME);
Description: Sets up Android–JavaScript interaction.
webView.setWebViewClient(new WebViewClient() {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString();
// Resource interception
WebResourceResponse resourceResponse = mediationJsBridge.shouldInterceptRequest(url);
if (resourceResponse != null) {
return resourceResponse;
}
return super.shouldInterceptRequest(view, request);
}
});
Description: Override WebViewClient.shouldInterceptRequest() to intercept and handle ad resources.