애드캐시
  • 제품안내
  • ANDROID
    • 릴리즈 노트
    • 시작하기
    • 배너광고(BannerView)
    • 배너광고(BannerLoader)
    • 전면광고(Interstitial)
    • 네이티브광고(NativeAd)
      • AdPopcorn
      • AdMob & GAM
      • NAM(Naver Ad Manager)
      • BizBoard
      • Pangle
      • AppLovinMax
    • 기타 설정
    • 광고 미디에이션 연동
    • 참조 모듈 버전 정보
    • 에러코드
    • Previous Version
      • 릴리즈 노트(~2.0.0.15)
      • 시작하기(~2.0.0.15)
  • iOS
    • 릴리즈 노트
  • miscellaneous
    • 애드캐시 매출 조회
Powered by GitBook
On this page
  • 미디에이션 설정
  • Layout
  • 레이아웃 구성 샘플(native_ad_unit_adpopcorn.xml)
  • ViewAdapter
  1. ANDROID
  2. 네이티브광고(NativeAd)

AdPopcorn

AdPopcorn(IGAWorks) 네이티브 미디에이션 레이아웃 구성

미디에이션 설정

AdPopcorn(IGAWorks)는 기본 제공으로 별도의 미디에이션 연동 작업이 필요하지 않습니다.


Layout

레이아웃 구성 샘플(native_ad_unit_adpopcorn.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/native_unit_adpopcorn_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#FFFFFF"
    android:gravity="center"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="#FFFFFF"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/native_unit_adpopcorn_icon_image"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_margin="10dp" />

        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:orientation="vertical">

            <TextView
                android:id="@+id/native_unit_adpopcorn_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000" />

            <TextView
                android:id="@+id/native_unit_adpopcorn_desc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLines="2"
                android:textColor="#000000" />
        </LinearLayout>

        <TextView
            android:id="@+id/native_unit_adpopcorn_cta"
            android:layout_width="60dp"
            android:layout_height="30dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="25dp"
            android:layout_marginRight="10dp"
            android:background="#3d7caf"
            android:gravity="center"
            android:textColor="#ffffff"
            android:textColorHint="#ffffff"
            android:textSize="16sp" />
    </LinearLayout>

    <ImageView
        android:id="@+id/native_unit_adpopcorn_main_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

ViewAdapter

XML에서 생성한 UI Component를 SDK에서 제공하는 ViewAdapter API를 사용하여 다음과 같이 설정해 줍니다.

// NativeViewAdapter
val builder = NativeViewAdapter.Builder()

// AdPopcorn
builder.setAdPopcornViewAdapter(
  viewAdapter = AdPopcornNativeViewAdapter.Builder(
    nativeAdLayoutId = R.layout.native_ad_unit_adpopcorn,
    nativeAdViewId = R.id.native_unit_adpopcorn_container
  )
  .setDescViewId(R.id.native_unit_adpopcorn_desc)
  .setCallToActionId(R.id.native_unit_adpopcorn_cta)
  .setIconImageViewId(R.id.native_unit_adpopcorn_icon_image)
  .setMainImageViewId(R.id.native_unit_adpopcorn_main_image)
  .setTitleViewId(R.id.native_unit_adpopcorn_title)
  .build()
)

// NativeLoader
NativeAdLoader(
  context = ...,
  placementId = ...,
  viewAdapter = builder.build(),
  listener = ...
)
// NativeViewAdapter
final NativeViewAdapter.Builder builder = new NativeViewAdapter.Builder();

// AdPopcorn
builder.setAdPopcornViewAdapter(
  // viewAdapter
  new AdPopcornNativeViewAdapter.Builder(
    // nativeAdLayoutId
    R.layout.native_ad_unit_adpopcorn,
    // nativeAdViewId
    R.id.native_unit_adpopcorn_container
  )
  .setDescViewId(R.id.native_unit_adpopcorn_desc)
  .setCallToActionId(R.id.native_unit_adpopcorn_cta)
  .setIconImageViewId(R.id.native_unit_adpopcorn_icon_image)
  .setMainImageViewId(R.id.native_unit_adpopcorn_main_image)
  .setTitleViewId(R.id.native_unit_adpopcorn_title)
  .build()
);

// NativeAdLoader
NativeAdLoader(
  /** Context **/ 
  context,
  /** PlacementId **/ 
  placementId,
  /** NativeViewAdapter **/ 
  builder.build(),
  /** NativeAdLoader.NativeListener **/ 
  listener
);
Previous네이티브광고(NativeAd)NextAdMob & GAM

Last updated 1 year ago