Native Ads Integration for Android

Native ads are a form of advertising that you can customize to blend in with the other content in your app . This makes ads appear more organic,  which leads to a better user experience and higher retention.

Before you start

Make sure that you have correctly integrated the ironSource SDK 7.3.1+ into your application. Integration is outlined here.

To integrate native ads, you need to follow three main steps: 

  1. Load a native ad
  2. Create a view and bind it
  3. Destroy the native ad

Step 1. Load a native ad

You’ll need to create a native ad object using LevelPlayNativeAd.Builder class, which allows for custom configuration of the native ad object. We recommend creating a separate class to manage your native ads loading mechanism in a single place. 

Make sure to load the native ads after receiving the SDK initialization complete callback. 

    LevelPlayNativeAd nativeAd = new LevelPlayNativeAd.Builder()
// The native ad object is then added to a list of native ads, which can be used to display the ad when needed

You can initialize the native ad with the placement name and set the listener for ad callbacks.

Important! You are required to destroy the ad object and create a new one for every new load, whether it’s after displaying an ad or encountering a load failure.

Step 2. Implement the Listener

Next, implement the native ad Listener in your code. The ironSource SDK fires several callbacks to inform you of native ad activity. The SDK will notify your Listener of all possible events listed below:

 // Invoked each time a native ad was loaded.
override fun onAdLoaded(nativeAd: LevelPlayNativeAd?, adInfo: AdInfo?) {
// Invoked when the native ad loading process has failed.
override fun onAdLoadFailed(nativeAd: LevelPlayNativeAd?, error: IronSourceError?) {
// Invoked each time the first pixel is visible on the screen
override fun onAdImpression(nativeAd: LevelPlayNativeAd?, adInfo: AdInfo?) {
// Invoked when end user clicked on the native ad
override fun onAdClicked(nativeAd: LevelPlayNativeAd?, adInfo: AdInfo?) {

Note: The native ad object created for loading and the native ad object returned in the callbacks refer to the same native ad object.

Step 3. Create a view and bind it

You are required to create a view, bind it, and set all relevant information manually before loading the native ad. This includes arranging the different assets such as

title, body text, advertising text, image, media view container, CTA button, and more. 

Each native ad is represented by a single NativeAdLayout, and this view is responsible for displaying all the elements of that ad.

Here’s a suggestion for an XML format that can be used as a baseline for displaying your ad:

             // Other assets such as  media view, button, cta, etc.

Enhancing ad transparency

Privacy icon – Ensure to keep in mind that this element should be incorporated into the bottom left corner of your native ad during the design process.

Ad indication – To make sure your users understand that this is an ad, you’re required to mark your native ads as “Ad”. This can be achieved by utilizing the provided “Ad” badge returned in the load information, or by adding your own indication.

Create a NativeAdLayout and populate it

Inflate the layout

Inflate a layout XML file into a NativeAdLayout object that can be used to display native ad elements within the layout.

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    NativeAdLayout nativeAdLayout = (NativeAdLayout) inflater.inflate(R.layout.native_ad, null);

Assets views population and registration

This code sample identifies the view used to display the title, icon, and MediaView. Then, populating the assets, and registering them with the nativeAdLayout object:

    // Locate all views to be populated
    TextView titleView = nativeAdLayout.findViewById(;
    ImageView iconView = nativeAdLayout.findViewById(;
    LevelPlayMediaView mediaView = nativeAdLayout.findViewById(;
    // Populate the views
    String title = nativeAd.getTitle();
    if (title != null) {
    NativeAdDataInterface.Image icon = nativeAd.getIcon();
    if (icon != null) {
        if (icon.getDrawable() != null) {
    // Register the views to be bound

    // Setting the native ads 

For each asset provided by the native ad object that the app will display, repeat the process of locating the view that corresponds to that asset, setting its value, and registering it with the ad view class.


The MediaView is a designated container that is intended to display the main media element. It is recommended to use a fixed size for the container.

Step 4. Destroy the Native Ad

To destroy a native ad, call the following method:


A destroyed native ad can no longer be loaded. If you want to serve it again, you must initiate it again.

Supported networks

Network SDK Adapter
Google AdMob and Ad Manager 22.1.0 4.3.38
Meta 6.14.0 4.3.43