# 기본 설정

## 1. SDK 초기화

앱 시작 시, init API를 사용하여 SDK를 초기화 합니다

```js
AdPopcornSSP.init(currentAppKey, (event, params) => this._onAdEvent(event, params));
```

init 호출 시, SDK에서 발생하는 event를 전달 받기 위해선 eventListener를 같이 전달해 주어야 합니다.

## 2. 로그 설정

SDK의 상세 로그를 확인하고 싶은 경우, setLogEnable API를 사용하여 설정을 변경합니다.

```js
AdPopcornSSP.setLogEnable(true);
```

## 3. 샘플 코드

```js
const AdPopcornSSP = require('AdPopcornSSPPlugin');

cc.Class({
    extends: cc.Component,
    
    onLoad() {
        const ANDROID_APP_KEY = 'your_android_app_key'; // 사용자가 채울 Android App Key
        const IOS_APP_KEY = 'your_android_ios_key';     // 사용자가 채울 iOS App Key
        
        const currentAppKey = cc.sys.os === cc.sys.OS_IOS ? IOS_APP_KEY : ANDROID_APP_KEY;
        if (cc.sys.os === cc.sys.OS_ANDROID || cc.sys.os === cc.sys.OS_IOS) {
            AdPopcornSSP.init(currentAppKey, (event, params) => this._onAdEvent(event, params));
            AdPopcornSSP.setLogEnable(true);
        }
    },
    _onAdEvent(event, params) {        
    },
});
```


---

# 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/sdk/cocoscreator/undefined-1.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.
