기본 설정

1. SDK 초기화

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

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

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

2. 로그 설정

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

AdPopcornSSP.setLogEnable(true);

3. 샘플 코드

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) {        
    },
});

Last updated

Was this helpful?