ManagedRenderingNative - Atmosplay/AtmosplayAds-Android Wiki

Integrate Managed Rendering Native Ad

Managed rendering is a rendering mode of native ad. In this mode, ad will be rendered automatically. This approach simplifies the process of accessing native ad, and you can integrate native ad more convient since you do not need to deal with ad rendering related issues.

Initialization and request

// Create NativeExpressAd object
AtmosplayNativeExpressAd mAtmosplayNativeAd = new AtmosplayNativeExpressAd(mContext, mAppId, mAdUnitId);

// Set listener event of loading ads:
// AtmosplayAdLoadListener: you can set NativeAdLoadListener to get request events from the object's callbacks

// Call the following method to load ad

NativeAdLoadListener definition

Creat NativeAd Template Layout

Suppose RecyclerView is carrier of information flow, the layout of NativeTemplateViewHolder itemView we creat is as follows:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android=""
        android:layout_margin="10dp" />

Render NativeAd

In RecyclerView Adapter, fire the function onBindViewHolder(ViewHolder holder, int position)

NativeAd nativeAd = mNativeAds.get(position);
if (nativeAd != null) {


NativeAdLoadListener definition

interface NativeAdLoadListener {
    // Success to request ad, put nativeAd into Adapter for future use
    void onNativeAdLoaded(NativeAd nativeAd);
    // Fail to request ad, check "State Code and Description" section of this doc according to errorCode to locate problem quickly
    void onNativeAdFailed(int errorCode, String msg);

Add NativeEventListener

If necessery, you can add listener callback of ad's impression/click as follows

// Set listener event of impression/click ads:
// NativeEventListener: you can set NativeEventListener to get impression/click events from the object's callbacks

NativeEventListener definition

interface NativeEventListener {
    // Ad has been impressed
    void onAdImpressed(View view);
    // Ad has been clicked
    void onAdClicked(View view);

The NativeExpressAdSample file is the sample code for the native ad(Managed Rendering).