Mediated Native ads are customised views, data is provided from different ad networks and can be displayed to fit the design of any app.

1. Override TMAdListener

Next, you will need to override the TMAdListener class to receive callbacks on mediated native adverts. Create a new file and implement it like so:

public class MediatedNativeListener extends TMAdListener {

    public void didLoad(TDMediatedNativeAd ad) {
        // Provides the ad object full of data

2. Load the ad

To load a mediated native ad, we recommend you load them once the Tapdaq SDK has initialised.

Go back to the TapdaqInitListener you created in the Quickstart guide, and add a call to load the ad, like so:

public class TapdaqInitListener extends TMInitListener {
    public void didInitialise() {
        // Ads may now be requested
        Tapdaq.getInstance().loadMediatedNativeAd(<CurrentActivity>, "my_tag", new MediatedNativeListener());

3. Display the ad

Using the TDMediatedNativeAd provided in the didLoad callback, a layout can now be populated.

Original data objects from each of the networks are available in the ad object if you want to interact directly with the network. It can be retrieved with the TDMediatedNativeAd getNativeAd() method

Depending on the ad networks integrated, some fields are required whilst some fields will be null or empty

Title Required Required
Subtitle N/A Optional
Body Optional Optional
Caption N/A N/A
Media View Optional Optional
Ad View Optional N/A
Call to action Required Required
Ad Choices Optional Optional
Images Optional Optional
Icon Required Optional
Star Rating N/A N/A
Store Optional Optional

3a. Build the layout

Create a custom layout class, e.g. our sample app has a NativeAdLayout class which imports an xml layout resource like so:

public class NativeAdLayout extends RelativeLayout {
    private LayoutInflater mInflater;

    public NativeAdLayout(Context context) {
        mInflater = LayoutInflater.from(context);

    public NativeAdLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        mInflater = LayoutInflater.from(context);

    public NativeAdLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mInflater = LayoutInflater.from(context);

    private void init()
        View v = mInflater.inflate(R.layout.nativead_layout, this, true);

3b. Populate the layout

For each view element used, populate them with data provided in the ad.

TDMediatedNativeAd ad
TextView mTitleView;

NOTE: When repopulating or replacing an ad, clear all the previous data or use a new view as the new ad may not have all the same data fields as the last.

3c. Trigger impression

For full impression stats, manually call trackImpression when the ad is displayed.

TDMediatedNativeAd ad;

3d. Register clickable views

Some networks handle the click event themselves, for others Tapdaq will handle it - for either case register the view(s) that should be clickable.

TDMediatedNativeAd ad;
ad.registerView(view); //e.g Use Button object as parameter

3e. Displaying image content

Each network handles images differently, some ads will provide a drawable, others just a url. Some ads will also provide multiple images, however its optional to display them.

if (ad.getImages() != null) {
    TDMediatedNativeAdImage image = ad.getImages().get(0);
    if (image.getDrawable() != null) {
    } else if (image.getUrl() != null) {
        //Download the image from url

3f. Playing video content

Video's will not auto play, use the VideoController object provided to control them.

TDMediatedNativeAd ad;
if (ad.getMediaView() != null) {
    RelativeLayout.LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,      ViewGroup.LayoutParams.MATCH_PARENT);
    mMediaView.addView(ad.getMediaView(), params);
if (ad.getVideoController() != null && ad.getVideoController().hasVideoContent()) {

NOTE: Applovin does not provide a MediaView or VideoController, Tapdaq has however implemented a simple one which is automatically used.

4. Destroy the ad

When the ad is being removed from view, call destroy

TDMediatedNativeAd ad;

Build and run your application to test the advert displays correctly.

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.

What's next?

Now that you have successfully integrated an interstitial into your app, what would you like to do next?