Skip to main content

Native/Icon

Custom ads with a look and feel that blend naturally with your app.

Introduction

TypeDescription
NativeThe content area includes custom styles such as ad labels, logos, main images, titles, descriptions, buttons, etc. The default number of requested ads is 1 (it is recommended to use the default). When the onAdLoaded callback is successful, the first ad in the array will be displayed.
IconNormally, the content area only contains the Icon image. The default number of requested ads is 1. The maximum number of requests needs to be consulted by the advertising Operating Personnel for the parameters configured in the current ad slot. When the onAdLoaded callback is successful, the ads in the array will be displayed. Applicable ad source: Hisavana

Please refer to the advertisement source Hisavana as shown in Figure 1 and Figure 2:

Figure 1:Native

Figure 2:Icon

Load Ads

Please set the corresponding parameters and listening callbacks.

// Initialize the Ntaive/Icon advertising object, where "native_id"/"icon_id" is the Native/Icon advertising slot ID
TNativeAd tNativeAd = new TNativeAd(this, "native_id"/ "icon_id");
// Construct ad request body
TAdRequestBody tAdRequest = new TAdRequestBody.AdRequestBodyBuild()
.setAdListener(new TAdAlliance())
.build();
// Set ad request body
tNativeAd.setRequestBody(tAdRequest);
// After loading the advertisement, the optimal advertisement callback will be returned within the set waiting time
tNativeAd.loadAd();

// Ad listener, listens for callbacks of ad loading completion (filling), display, click, exception, and closing actions
private static class TAdAlliance extends TAdListener {

// Loading completion callback (applicable ad slots: all ad slots)
@Override
public void onLoad() {
// Ad loaded callback
}

// Abnormal callback (applicable ad slots: all ad slots)
@Override
public void onError(TAdErrorCode errorCode) {
// Ad failed callback
}

// Display callback (applicable ad slots: Native/Icon)
@Override
public void onNativeFeedShow(int source, TAdNativeInfo adNativeInfo){
// Ad show callback
}

// Click callback (applicable ad slots: Native/Icon)
@Override
public void onNativeFeedClicked(int source, TAdNativeInfo adNativeInfo) {
// Ad click callback
}

// Close callback (applicable ad slots: Native/Icon of Hisavana ad source)
@Override
public void onClosed(@Nullable TAdNativeInfo tAdNativeInfo) {
// Ad close callback
}

// Display failure callback (applicable ad slots: all ad slots)
@Override
public void onShowError(TAdErrorCode errorCode) {
// Ad show failed callback
}
}

Reminder: source represents the advertising source, please refer to Advertising Source Association Table; For example: this time the advertisement is filled with pangle ads, then source=6.

Display Ads

Emphasis Mark:

Applicable to the ad source Hisavanna

Native: For ads that jump to the PalmStore landing page, storeMarkView (app store logo) must be added, otherwise it will affect the jump link for downloading ads.

Icon: Usually, there is no need to set the main image, only the icon.

Reminder: If you want to display Native ads compliant with Russian regulations, refer to the section on Displaying Russian Compliant Ads.

Step One: Create a TAdNativeView object.

// Please add TAdNativeView in the xml of the parent layout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.hisavana.mediation.ad.TAdNativeView
android:id="@+id/native_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
// Bind views in xml layout
TAdNativeView nativeView = findViewById(R.id.native_view);

or

// Manually create a TAdNativeView object and add it to the parent layout
TAdNativeView nativeView = new TAdNativeView(this);

Step Two: Add a Sub-layout File

Native: Applicable to ad sources that support Native/Icon. For details, please refer to Mediation Support. A new sub-layout file native_install.xml for Native ad elements is added. The icon in the ad element is rendered with TIconView, and the large image is rendered with TMediaView.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ad_unit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="MissingDefaultResource">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">

<!-- Applicable to ad sources that support Native/Icon. For details, please refer to "Mediation Support" -->
<com.hisavana.mediation.ad.TIconView
android:id="@+id/native_ad_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="16dp">
<TextView
android:id="@+id/native_ad_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:lines="1"
android:text="Title"
android:textColor="@android:color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/native_ad_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="des1"
android:textColor="@android:color/black"
android:textSize="15sp" />
<TextView
android:id="@+id/des2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text=""
android:textColor="@android:color/black"
android:textSize="15sp" />
<RatingBar
android:id="@+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="false"
android:numStars="5"
android:stepSize="0.5"/>
</LinearLayout>
</LinearLayout>

<!-- Applicable to ad sources that support Native/Icon. For details, please refer to "Mediation Support" -->
<com.hisavana.mediation.ad.TMediaView
android:id="@+id/coverview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/call_to_action"
android:paddingVertical="10dp"
android:layout_marginHorizontal="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="DOWNLOAD NOW!"
android:gravity="center"
android:textAllCaps="false" />
</LinearLayout>

<!-- Advertisement corner, applicable to ad sources Hisavana, Facebook, Pangle, Mintegral, Bigo -->
<com.hisavana.mediation.ad.TAdChoicesView
android:id="@+id/adChoicesView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="150dp"
android:layout_marginTop="100dp" />

<!-- Close button for ad source Hisavana -->
<com.hisavana.mediation.ad.TAdCloseView
android:id="@+id/adCloseView"
android:layout_toLeftOf="@+id/adChoicesView"
android:layout_width="12dp"
android:layout_height="12dp"/>

<!-- Ad source: Hisavanna For ads that jump to the PalmStore landing page, storeMarkView (app store logo) must be added, otherwise it will affect the jump link for downloading ads. -->
<com.hisavana.mediation.ad.TStoreMarkView
android:id="@+id/store_mark_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</RelativeLayout>

Icon: Applicable to the ad source Hisavana, add the sub-layout file item_icon.xml of the Icon ad element

<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ad_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/item_background">

<com.hisavana.mediation.ad.TIconView
android:id="@+id/ad_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="fitCenter"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

Step Three: Data and view binding

Native: Applicable to ad sources that support Native/Icon. For details, please refer to Mediation Support. The binding is as follows

Use the TNativeAd object to bind the three objects TAdNativeView, TAdNativeInfo and ViewBinder.

if (tNativeAd != null && tNativeAd.hasAd()) {

// Get all TAdNativeInfo through tNativeAd. Usually the array has only one piece of data.
List<TAdNativeInfo> nativeInfos = tNativeAd.getNativeAdInfo();
if (nativeInfos != null && !nativeInfos.isEmpty()) {

// Single page single advertisement scenario, the previous mNativeInfo resource needs to be released before display
if (mNativeInfo != null) {
mNativeInfo.release();
}

// The global variable mNativeInfo defined by a single page is used to release the previous mNativeInfo resource before displaying a single ad scene, and to release the resource uniformly at "onDestroy()"
mNativeInfo = nativeInfos.get(0);
if (mNativeInfo == null) return;

// Sub-layout information storage
ViewBinder viewBinder = new ViewBinder.Builder(R.layout.native_install)
// Set the id of the title control
.titleId(R.id.native_ad_title)
// Set the id of the icon control
.iconId(R.id.native_ad_icon)
// Set the id of the response action control
.callToActionId(R.id.call_to_action)
// Set the id of the description control
.descriptionId(R.id.native_ad_body)
// Set the id of the advertiser image control
.mediaId(R.id.coverview)
// Set the ID of the advertising target control
.adChoicesView(R.id.adChoicesView)
// Set the id of the ad closing control
.adCloseView(R.id.adCloseView)
// Required, set the id of the app store identification control
.storeMarkView(R.id.store_mark_view)
// If you need to customize the ad click event, call the `actionIds(Integer... actionIds)` method and add the relevant view id
.actionIds(R.id.call_to_action)
.sponsoredId(R.id.sponsored)
.ratingId(R.id.rating)
.priceId(R.id.price)
.likesId(R.id.likes)
.downloadsId(R.id.downloads)
/**
* Native advertising rendering methods are divided into:
* NativeContextMode.NORMAL: Normal mode
* NativeContextMode.LIST: List mode
*/
.contextMode(NativeContextMode.NORMAL)
.build();

// Determine whether an ad has expired
if (mNativeInfo.isExpired()) {
AdLogUtil.Log().d("NativeAdActivity", "expired");
} else {
// Binding data to view
tNativeAd.bindNativeView(nativeView, mNativeInfo, viewBinder);
} }
}
}

Icon: Applicable to the advertising source Hisavana, the binding is as follows

if (tNativeAd != null && tNativeAd.hasAd()) {

// Get all TAdNativeInfo through tNativeAd
List<TAdNativeInfo> nativeInfos = tNativeAd.getNativeAdInfo();
if (nativeInfos != null && !nativeInfos.isEmpty()) {

// When a single page needs to display multiple ads, there is no need to release resources here. Please release resources in "onDestroy()"
if (mNativeInfo != null) {
mNativeInfo.release();
}

// The example only displays a single icon ad on a single page. If you need to display multiple ads, you can add bindings through RecyclerView.
mNativeInfo = nativeInfos.get(0);
if (mNativeInfo == null) return;

// Sub-layout information storage
ViewBinder viewBinder = new ViewBinder.Builder(R.layout.item_icon)
// Set the id of the icon control
.iconId(R.id.ad_icon)
/**
* Native advertising rendering methods are divided into:
* NativeContextMode.NORMAL: Normal mode
* NativeContextMode.LIST: List mode
*/
.contextMode(NativeContextMode.NORMAL)
.build();

// Determine whether an ad has expired
if (mNativeInfo.isExpired()) {
AdLogUtil.Log().d("NativeAdActivity", "expired");
} else {
// Binding data to view
tNativeAd.bindNativeView(nativeView, mNativeInfo, viewBinder);
}
}
}
 /**
* Optional
* For applications that need to count the arrival of advertising scenes, you can set the scene value yourself
* The main purpose is to count the utilization rate of the current advertising scene. The first parameter is the customized scene name, and the second parameter is the number of advertisements.
*/
String sceneToken = tNativeAd.enterScene("native_scene_name", 1);
tNativeAd.bindNativeView(nativeView, mNativeInfo, viewBinder, sceneToken);

List Scene

The following scenarios apply to Native ads

Define data classes to save nativeInfo and sceneToken

public calss ItemBean{
private TAdNativeInfo nativeInfo;
private TNativeAd nativeAd;
public String sceneToken;
}

Binding Layout in List

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vhHolder, int position) {
ItemBean itemBean = data.get(position);
// The main purpose is to count the utilization rate of the current advertising scene. The first parameter is the custom scene name, and the second parameter is the number of advertisements.
if(TextUtils.isEmpty(itembean.sceneToken)){
itembean.sceneToken = tNativeAd.enterScene("native_scene_name", 1);
}
List<TAdNativeInfo> nativeInfos = tNativeAd.getNativeInfo();
itemBean.nativeInfo = nativeInfos.isEmpty ? null : nativeInfos.get(0)
if(itemBean.nativeInfo == null || itemBean.nativeInfo.isExpired()){
// Reload current Ad
...
return;
}
// User build ViewBinder
...
// Display Ads
itemBean.tNativeAd.bindNativeView(nativeView, itemBean.nativeInfo, viewBinder, itemBean.sceneToken);
}

Destroy Ads

Please recycle ads in time, otherwise the App will cause memory leaks.

// This callback is applicable to the ad source Hisavana. It is recommended to release resources in "onDestroy()". This callback will be removed in subsequent versions.
@Override
public void onClosed(TAdNativeInfo tAdNativeInfo) {
/**
* Please release advertising resources when clicking the close button of the ad
* If you are in a list scenario, you can determine the position of the current advertisement in the list based on taNativeInfo and delete it dynamically
*/
if(tAdNativeInfo == mNativeInfo){
if(mNativeInfo != null) {
mNativeInfo.release();
}
if (nativeView != null) {
nativeView.release();
}
mNativeInfo = null;
nativeView = null;
}
}

The following example only releases a single Native/Icon ad resource on a single page. For multiple Native/Icon scenarios, the access party needs to manage and release resources uniformly at onDestroy(). The released objects are TNativeAd, TAdNativeInfo, and TAdNativeView. For details, please refer to Mediation Demo

// After exiting the advertising scene, please destroy the advertising object.
@Override
protected void onDestroy() {
if (tNativeAd != null) {
tNativeAd.destroy();
tNativeAd = null;
}
if(mNativeInfo != null) {
mNativeInfo.release();
}
if (nativeView != null) {
nativeView.release();
}
mNativeInfo = null;
nativeView = null;
super.onDestroy();
}

Other APIs

API callIntroduce
tNativeAd.hasAd()Are there any ads currently available
mNativeInfo.isExpired()Used to determine whether the advertisement is in the delivery period and used before displaying the advertisement

Advanced Settings

Hisavana
Other

Required ad elements

HisavanaAdmobFacebookPangleMintegralYandexBigo
Media(mediaId)RequiredRequiredRequiredRequiredRequiredRequiredOptional
AdChoices(adChoicesView)RequiredAdmob renders itselfRequiredRequiredRequiredNoneOptional
Title(titleId)OptionalRequiredRequiredRequiredRequiredRequiredOptional
Icon(iconId)OptionalRequiredRequiredRequiredRequiredRequiredOptional
Close Button(adCloseView)OptionalAdd it yourself
(Google recommends that it is required)
RequiredRequiredRequiredNoneNone
Store Mark Icon(adStoreMarkView)RequiredNoneNoneNoneNoneNoneNone
Description(descriptionId)OptionalOptionalOptionalRequiredRequiredOptionalOptional
Button(callToActionId)OptionalRequiredRequiredRequiredRequiredRequiredOptional
Rating(ratingId)OptionalOptionalNoneNoneNoneOptionalNone
Price(priceId)NoneOptionalNoneNoneNoneRequiredNone
Sponsored(sponsoredId)NoneNoneNoneNoneNoneRequiredNone
Disclaimer(adDisclaimerView)RU RequiredNoneNoneNoneNoneRequiredNone
RU Compliance Badge(adBadgeView)RU RequiredNoneNoneNoneNoneNoneNone
Domain(domainId)NoneNoneNoneNoneNoneRequiredNone
Feedback(feedbackId)NoneNoneNoneNoneNoneRequiredNone

Displaying Russian Compliant Ads

Developers who launch products in Russia and monetize through mediation-lib (integrating mediation-lib SDK) must strictly comply with Russian advertising laws.

mediation-lib sdk 3.0.8 and above support displaying ads that comply with Russian advertising regulations. You need to do some additional integration-related operations when Self Rendering Native ads. This is applicable to Ad Source Hisavana.

The main integration differences are in the Display Ads section, particularly in Step Two and Step Three. We need to replace the display method of the AD badge view and add a Disclaimer view.

Reminder: The term universal version refers to the non-Russian compliant version.

Step One: Create a TAdNativeView object

As above.

Step Two: Add a Sub-layout File

The new sub-layout file for the Native ad elements, native_install.xml, features an icon rendered by TIconView within the ad elements, and the large image rendered by TMediaView.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ad_unit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/item_background"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="MissingDefaultResource">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">

<com.hisavana.mediation.ad.TIconView
android:id="@+id/native_ad_icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="16dp">

<TextView
android:id="@+id/native_ad_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:lines="1"
android:text="Title"
android:textColor="@android:color/black"
android:textSize="18sp" />

<TextView
android:id="@+id/native_ad_body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="des1"
android:textColor="@android:color/black"
android:textSize="15sp" />

<!-- des2 -->
<TextView
android:id="@+id/des2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text=""
android:textColor="@android:color/black"
android:textSize="15sp" />
<RatingBar
android:id="@+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="0.5"
android:isIndicator="false"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:id="@+id/price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="price" />

<TextView
android:id="@+id/likes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Likes" />

<TextView
android:id="@+id/downloads"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Downloads" />

</LinearLayout>
</LinearLayout>
</LinearLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.hisavana.mediation.ad.TMediaView
android:id="@+id/coverview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<!-- Required: Disclaimer View for the Russian Compliance Version -->
<com.hisavana.mediation.ad.TAdDisclaimerView
android:id="@+id/ad_disclaimer_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>

</FrameLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">

<TextView
android:id="@+id/sponsored"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:paddingLeft="16dp"
android:text="Sponsored"
android:textSize="15sp" />

<Button
android:id="@+id/call_to_action"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="DOWNLOAD NOW!"
android:textAllCaps="false" />
</LinearLayout>

</LinearLayout>

<!-- Advertisement source identification -->
<com.hisavana.mediation.ad.TAdChoicesView
android:id="@+id/adChoicesView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"/>

<com.hisavana.mediation.ad.TAdCloseView
android:id="@+id/adCloseView"
android:layout_toStartOf="@+id/adChoicesView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<com.hisavana.mediation.ad.TStoreMarkView
android:id="@+id/store_mark_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />

<!-- Required: Russian compliance version AD corner tag -->
<com.hisavana.mediation.ad.TAdBadgeView
android:id="@+id/ad_badge_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</RelativeLayout>

Step Three: Bind Data with View

Use the TNativeAd object to bind the TAdNativeView, TAdNativeInfo, and ViewBinder objects together.

if (tNativeAd != null && tNativeAd.hasAd()) {
// Get all TAdNativeInfo through tNativeAd. Usually, the array has only one data
List<TAdNativeInfo> nativeInfos = tNativeAd.getNativeAdInfo();
if (nativeInfos != null && !nativeInfos.isEmpty()) {

// Single page single ad scene, the previous mNativeInfo resource needs to be released before display
if (mNativeInfo != null) {
mNativeInfo.release();
}

// The global variable mNativeInfo defined by the single page is to release the previous mNativeInfo resource before displaying a single ad scene, and to release the resource uniformly at "onDestroy()"
mNativeInfo = nativeInfos.get(0);
if (mNativeInfo == null) return;

// Sub-layout information storage
ViewBinder viewBinder = new ViewBinder.Builder(R.layout.native_install)
// Set the id of the title control
.titleId(R.id.native_ad_title)
// Set the id of the icon control
.iconId(R.id.native_ad_icon)
// Set the id of the response action control
.callToActionId(R.id.call_to_action)
// Set the id of the description control
.descriptionId(R.id.native_ad_body)
// Set the id of the advertiser image control
.mediaId(R.id.coverview)
// Set the id for the advertisement source control
.adChoicesView(R.id.adChoicesView)
// Required: Set Russian compliance version AD corner badge
.adBadgeView(R.id.ad_badge_view)
// Set the id of the ad closing control
.adCloseView(R.id.adCloseView)
// Required: set the id of the app store identification control
.storeMarkView(R.id.store_mark_view)
// If you need to customize the ad click event, call the `actionIds(Integer... actionIds)` method and add the relevant view id
.actionIds(R.id.call_to_action)
.sponsoredId(R.id.sponsored)
.ratingId(R.id.rating)
.priceId(R.id.price)
.likesId(R.id.likes)
.downloadsId(R.id.downloads)
// Required: Set the Russian compliance version disclaimer
.adDisclaimerView(R.id.ad_disclaimer_view)
/**
* Native advertising rendering methods are divided into:
* NativeContextMode.NORMAL: Normal mode
* NativeContextMode.LIST: List mode
*/
.contextMode(NativeContextMode.NORMAL)
.build();
// Determine whether an ad has expired
if (mNativeInfo.isExpired()) {
AdLogUtil.Log().d("NativeAdActivity", "expired");
} else {
// Binding data to view
tNativeAd.bindNativeView(nativeView, mNativeInfo, viewBinder);
} }
}
}

Reminder: Regarding Icon advertising, the general processing method is to set iconId and callToActionId. Please set it according to your needs.

 /**
* Optional
* For applications that need to count the arrival of advertising scenes, you can set the scene value yourself
* The main purpose is to count the utilization rate of the current advertising scene. The first parameter is the customized scene name, and the second parameter is the number of advertisements.
*/
String sceneToken = tNativeAd.enterScene("native_scene_name", 1);
tNativeAd.bindNativeView(nativeView, mNativeInfo, viewBinder, sceneToken);