공통 설정

Android 네이티브 광고 미디에이션 레이아웃 가이드 입니다.

1. 네이티브 XML 공통 설정

AdPopcornSSPNativeAd View 안에 사용하고자 하는 미디에이션 업체의 네이티브 레이아웃을 아래 샘플과 같이 추가합니다.

<?xml version="1.0" encoding="utf-8"?>
<com.igaworks.ssp.part.nativead.AdPopcornSSPNativeAd
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/adpopcorn_native_ad"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <!-- AdPopopcorn SSP-->
    <include
        android:id="@+id/adpopcorn_native_ad_view"
        layout="@layout/adpopcorn_native_ad_unit_layout"/>

    <!-- FAN -->
    <com.facebook.ads.NativeAdLayout
        android:id="@+id/fan_native_ad_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <include layout="@layout/fan_native_ad_unit_layout"/>
    </com.facebook.ads.NativeAdLayout>

    <!-- AdMob or GAM or ADOP or AdForus -->
    <com.google.android.gms.ads.nativead.NativeAdView
        android:id="@+id/admob_unified_native_ad_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <include layout="@layout/admob_native_ad_unit_layout"/>
    </com.google.android.gms.ads.nativead.NativeAdView >

    <!-- Mintegral -->
    <include
        android:id="@+id/mintegral_native_ad_view"
        layout="@layout/mintegral_native_ad_unit_layout" />

    <!-- Mobon -->
    <include
        android:id="@+id/mobon_native_ad_view"
        layout="@layout/mobon_native_ad_unit_layout" />

    <!-- AdFit Native-->
    <com.kakao.adfit.ads.na.AdFitNativeAdView
        android:id="@+id/adFitNativeAdView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginLeft="23dp"
        android:layout_marginTop="15dp"
        android:layout_marginRight="23dp"
        android:layout_marginBottom="15dp">
        <include layout="@layout/adfit_native_ad_unit_layout"/>
    </com.kakao.adfit.ads.na.AdFitNativeAdView>

    <!-- AdFit BizBoard -->
    <com.kakao.adfit.ads.na.AdFitBizBoardAdTemplateLayout
        android:id="@+id/adFitNativeAdView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <!-- Pangle -->
    <include
        android:id="@+id/pangle_native_ad_view"
        layout="@layout/pangle_native_ad_unit_layout" />

    <!-- Naver Ad Manager -->
    <com.naver.gfpsdk.GfpNativeSimpleAdView
        android:id="@+id/gfp_native_simple_ad"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="visible">
    </com.naver.gfpsdk.GfpNativeSimpleAdView>

    <!-- AppLovin Max -->
    <include
        android:id="@+id/applovin_native_ad_view"
        layout="@layout/applovin_native_ad_unit_layout" />
    
    <!-- Vungle -->
    <include
        android:id="@+id/vungle_native_ad_view"
        layout="@layout/vungle_native_ad_layout"/>
    
    <!-- Coupang -->
    <com.coupang.ads.custom.AdsNativeView
        android:id="@+id/coupang_ads_native_view"
        android:layout_width="300dp"
        android:layout_height="250dp"
        android:layout_gravity="center_horizontal"
        android:visibility="invisible">
        <include layout="@layout/coupang_native_ad_unit_layout"/>
    </com.coupang.ads.custom.AdsNativeView>    
    
    <!-- MobWith -->
    <FrameLayout
        android:id="@+id/mobwith_native_ad_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="30dp" />
</com.igaworks.ssp.part.nativead.AdPopcornSSPNativeAd>

2. Placement ID 설정

XML로 생성한(native_ad_mediation_layout.xml) AdPopcornSSPNativeAd에 placement ID 설정합니다.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    adPopcornSSPNativeAd = (AdPopcornSSPNativeAd) findViewById(R.id.adpopcorn_native_ad);
    adPopcornSSPNativeAd.setPlacementId("8n12virz5gmkwqr");
}

Last updated