배너, 네이티브, 네이티브 심플 결합 광고
NAM SDK 에서는 GfpAdLoader
를 통해서 배너와 네이티브 그리고 네이티브 심플 광고를 동시에 수신할 수 있는 방법을 제공합니다.
하나의 지면에서 여러 유형을 지원해야 하기 때문에 광고 유닛 설정이 필요하니 NAM 담당자와 논의가 필요합니다.
[Step 1] Dependency 추가
이하 내용은 NAM SDK 적용이 완료된 상태를 가정하고 진행합니다.
[Step 2] 레이아웃 설정
광고가 삽입될 ViewGroup
을 추가 합니다
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<RelativeLayout
android:id="@+id/ad_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
[Step 3] 파라미터 생성시 유닛 확인
하나의 지면에서 여러 Creative Type 의 광고 응답값을 제공하는 AdUnitId 가 설정된 AdParam
객체를 생성하고 해당 객체를 GfpAdLoader
생성시 할당합니다.