Integration Guide - adbcsdk/SDK_Integration GitHub Wiki
ํ๋ก์ ํธ libs ํด๋ ์์ sdk ํ์ผ์ ๋ณต์ฌํ ํ, build.gradle ํ์ผ์ ์๋์ ๋ด์ฉ์ ์ถ๊ฐํฉ๋๋ค.
repositories {
...
flatDir {
dirs 'libs'
}
}
dependencies {
...
implementation 'com.adbc:ADBC_SDK:1.0@aar'
}-dontwarn com.adbc.**
-keep class com.adbc.** { *; }
์ฑ ์ต์ด ์คํ ์ ์๋์ ์ฝ๋๋ฅผ ํธ์ถํ์ฌ SDK ๋ฅผ ์ด๊ธฐํํฉ๋๋ค.
AdbcSDK.init(context, "๋ฐ๊ธ๋ฐ์ appCode");
AdbcInterstitial ๊ฐ์ฒด์์ requestAd ๋ฉ์๋๋ฅผ ํธ์ถํ์ฌ ๊ด๊ณ ๋ฆฌ์คํธ๋ฅผ ์์ ํฉ๋๋ค.
onResult๋ฅผ ํตํด ๊ด๊ณ ์ ๋ฌด์ ๋ํ ๊ฐ์ ์ ๋ฌ๋ฐ์ showAd ๋ฉ์๋๋ฅผ ํธ์ถํ์ฌ ์ ๋ฉด๊ด๊ณ ๋ฅผ ๋ ธ์ถํ ์ ์์ต๋๋ค.
AdbcAdInfo info = new AdbcAdInfo.Builder("๋ฐ๊ธ๋ฐ์ appCode").build();
AdbcInterstitial interstitial = new AdbcInterstitial(context);
interstitial.setAdInfo(info);
interstitial.requestAd(new AdbcInterstitialListener() {
@Override
public void onResult(boolean hasAd) {
if(hasAd == true) {
interstitial.showAd();
}
}
});
requestAd ๋ฅผ ํตํ์ฌ ๊ด๊ณ ๋ฅผ ์์ ํ ์ดํ์๋ showAd๋ฅผ ํตํด ์ฌ๋ฌ๋ฒ ์ ๋ฉด๊ด๊ณ ๋ฅผ ๋ ธ์ถํ ์ ์์ผ๋, hasAd ๋ฉ์๋๋ฅผ ํตํด ๋ ธ์ถ๊ฐ๋ฅํ ๊ด๊ณ ๊ฐ ์กด์ฌํ๋์ง ํ์ธํด์ผํฉ๋๋ค.
if(interstitial.hasAd()) {
interstitial.showAd();
}