# AP 미디에이션(Unity AOS)

Android 환경에서 미디에이션 기능을 사용하기 위해서는 build.gradle / AndroidManifest.xml 파일 내 추가 설정만 진행하면 됩니다.&#x20;

{% hint style="warning" %}
다만, 일부 미디에이션의 경우 AGP 버전이 구버전일 경우, 빌드에 실패하므로, UnityTool 최신 버전을 사용해 주셔야 합니다.
{% endhint %}

### **1 Build.gradle(Project Level)**

Pangle SDK를 사용하고자 하는 경우에는 아래 Pangle 부분을 추가해 주시면 됩니다.

#### 1.1  `Custom Gradle Settings Template` 활성화 확인

Unity에서 프로젝트 레벨의 설정을 변경하려면 이 템플릿이 활성화되어 있어야 합니다.

* Unity 에디터 > Edit > Project Settings > Player > Android 탭 > Publishing Settings에서 \*\*`Custom Gradle Settings Template`\*\*가 체크되어 있는지 확인합니다.

#### 1.2 `settingsTemplate.gradle` 파일 수정

프로젝트 레벨 설정 파일인 `Assets/Plugins/Android/settingsTemplate.gradle` 파일을 열고, `allprojects { repositories { ... } }` 블록 내에 Pangle/Bytedance 저장소 URL을 추가해야 합니다.

```
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        **ARTIFACTORYREPOSITORY**
        google()
        mavenCentral()		
        
        // Pangle
		    maven { url 'https://artifact.bytedance.com/repository/pangle' }
		
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}
```

### **2 Build.gradle(App Level)**

아래 설정 중, Common 라이브러리와 사용 예정인 업체의 SDK만 탑재하면 됩니다.

#### 2.1  `Custom Base Gradle Template` 활성화 확인

Unity에서 프로젝트 레벨의 설정을 변경하려면 이 템플릿이 활성화되어 있어야 합니다.

* Unity 에디터 > Edit > Project Settings > Player > Android 탭 > Publishing Settings에서 \*\*`Custom Main Gradle Template`\*\*가 체크되어 있는지 확인합니다.

#### 2.2 `mainTemplate.gradle` 파일 수정

위 설정을 활성화하면, Unity는 프로젝트 내의 특정 폴더에 기본 템플릿 파일을 생성합니다.

* 생성된 파일 경로: `Assets/Plugins/Android/mainTemplate.gradle`

```
dependencies{
    // unity 플러그인에 포함된(Assets/AdPopcornSSP/Plugins/Android 폴더)
    // aar 사용 안하고 최신 버전 사용하고자 할 경우 해당 aar 삭제 후 아래 선언을 추가해 주세요.
    implementation 'com.igaworks.ssp:IgawAdPopcornSSP:3.10.2'
    // Common
    api 'com.google.android.gms:play-services-ads-identifier:18.2.0'
    
    // AppLovin
    api 'com.applovin:applovin-sdk:13.6.2'
    
    // UnityAds
    api 'com.unity3d.ads:unity-ads:4.17.0'
    
    // Vungle(Liftoff)
    api 'com.vungle:vungle-ads:7.7.2'
       
    // AdMob
    api 'com.google.android.gms:play-services-ads:24.8.0'
    
    // Fyber
    api "com.fyber:marketplace-sdk:8.4.1"
    
    // Pangle
    api 'com.pangle.global:pag-sdk:7.9.1.3'
    
    // FAN(Meta)
    api 'androidx.annotation:annotation:1.4.0'
    api 'com.facebook.android:audience-network-sdk:6.21.0'
}
```

### **3. AndroidManifest.xml**

AdMob SDK를 사용하는 경우에는 아래의 설정을 추가해 줍니다.

입력해야 되는 키 값에 대해서는 사업팀(<monetize@adpopcorn.com>)에 문의해 주세요

```
<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://adpopcornssp.gitbook.io/ssp-sdk/undefined-1/ap/ap-unity-aos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
