Skip to content

adiscope/Adiscope-Android-Sample

Repository files navigation

Adiscope-Android-Sample

GitHub package.json version GitHub package.json version GitHub package.json version GitHub package.json version GitHub package.json version

Requirements

  • minSdkVersion 23
  • compileSdkVersion 35
Network Adapter Requirements
Adapter minSdk bidding in-house
admob 23 - -
chartboost 21 - -
max 21 O -
pangle 23 - -
vungle 21 - -
tnkpub 23 - O

Network Version

Ad Network Android Version MAX bidder
AdMob 24.8.0 O
Amazon 11.1.1 O
AppLovin 13.5.1 O
BidMachine 3.5.1 O
Bigo 5.6.2 O
Chartboost 9.11.0 O
DT Exchange 8.4.2 O
InMobi 11.1.0 O
Ironsource 9.2.0 O
Liftoff(Vungle) 7.6.3 O
Line 2.9.20251028 O
Meta(Fan) 6.21.0 O
Mintegral(Mobvista) 17.0.61 O
Moloco 4.4.0 O
Ogury 6.2.1 O
Pangle 7.8.5.2 O
Pubmatic 4.11.0 O
Smaato 22.7.2 O
TNKPub 7.25.03 -
Unity Ads 4.16.5 O
Verve 3.7.1 O

⚠️ 애드몹 SDK(com.google.android.gms:play-services-ads)를 프로젝트에 이미 포함하고 있는 경우 버전 호환에 유의
기존에 gms SDK 사용중인 퍼블리셔는 admob, max 어댑터 사용 시 24버전으로 마이그레이션 필요 (관련 문서)

  • gms 22 버전: 애디스콥 3.3.0~4.0.1
  • gms 23 버전: 애디스콥 4.1.0~4.3.2
  • gms 24 버전: 애디스콥 4.4.0 이상

Contents


Integration Guide

1. Import Adiscope Sdk

1-1. Add Adiscope module

운영에 필요한 각각의 네트워크 어댑터 의존성을 추가

build.gradle(root)

repositories {
    google()
    mavenCentral()
  
    // [required] adiscope library
    maven {
        url "https://repository.adiscope.com/repository/adiscope/"
    }

    // [optional] adiscope network library
    // pangle 혹은 max 연동 시 추가
    maven { url "https://artifact.bytedance.com/repository/pangle" }
  
    // chartboost 혹은 max 연동 시 추가
    maven { url "https://cboost.jfrog.io/artifactory/chartboost-ads/" }

    // max 연동 시 아래 url 모두 추가
    maven { url "https://s3.amazonaws.com/smaato-sdk-releases/" } 
    maven { url "https://artifactory.bidmachine.io/bidmachine" }
    maven { url "https://maven.ogury.co" }
    maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
    maven { url "https://android-sdk.is.com" } // (4.2.0~)
    maven { url "https://repo.pubmatic.com/artifactory/public-repos" } // (5.0.0~)
    maven { url "https://verve.jfrog.io/artifactory/verve-gradle-release" } // (5.2.0~)

    // tnkpub 연동 시 추가
    maven { url "https://repository.tnkad.net:8443/repository/public/" }
}

build.gradle(app)
앱 모듈의 build.gradle의 manifestPlaceholders에 애디스콥 설정값을 정의해야 하며, 미정의 시 컴파일 에러가 발생함. 애디스콥 측에 아래 값에 대해 문의 후 기입

  • adiscope_media_id: 매체 아이디
  • adiscope_media_secret: 매체 시크릿키
  • adiscope_sub_domain: 옵션값 (오퍼월 상세페이지 이동 기능에 사용하는 값으로, 필요 시 담당자 전달 예정)
android {
    defaultConfig {
        manifestPlaceholders = [
            adiscope_media_id    : "media id 기입필요",
            adiscope_media_secret: "media secret 기입필요",
            adiscope_sub_domain  : "" // 옵션값으로 사용 시 value에 전달값을 기입
        ]
    }
}

5.1.0 버전부터 bom 연동 방식을 지원.
어댑터별 버전을 명시하지 않아도 코어 모듈 버전으로 매핑된 버전의 어댑터가 자동으로 연동됨

dependencies {
    // bom으로 연동 시 어댑터별 버전을 명시하지 않아도 코어 모듈 버전으로 매핑된 버전의 어댑터가 자동으로 연동됨
    Dependency adiscopeBom = platform("com.nps.adiscope:adiscope-bom:5.2.0")
    implementation adiscopeBom
  
    // [required] adiscope core library
    implementation "com.nps.adiscope:adiscopeCore"
    implementation "com.nps.adiscope:adiscopeAndroid"
    
    // [optional] adiscope video simple integration library
    implementation "com.nps.adiscope:adiscopeWalnut"
  
    // [optional] adiscope network adapter library
    // bidding, waterfall adapter
    implementation "com.nps.adiscope:adapter.admob"
    
    // bidding adapter
    implementation "com.nps.adiscope:adapter.max"

    // waterfall adapter
    implementation "com.nps.adiscope:adapter.chartboost"
    implementation "com.nps.adiscope:adapter.pangle"
    implementation "com.nps.adiscope:adapter.vungle"
  
    // direct sold adapter
    implementation "com.nps.adiscope:adapter.tnkpub"
}

⚠️ exoplayer 2.15.x 사용하는 경우 (SDK 의존성 충돌)
  • exoplayer 2.15.x 이하 사용 시 chartboost sdk에서 충돌 발생
    • chartboost에서 exoplayer(com.google.android.exoplayer:exoplayer-core) 2.18.7과 media3 exoplayer(androidx.media3:media3-exoplayer) 1.4.1를 모두 사용하고 있음
  • exoplayer 2.18.x 이상 혹은 androidx media3 exoplayer 사용을 권고
    • adiscope의 adapter.max의 chartboost, moloco sdk에서 exoplayer 2.18.x 사용 중으로 기존 의존성을 exclude하면 크래시가 발생함

(bom 미사용) 각 모듈 버전을 명시하여 연동할 경우
dependencies {
    // [required] adiscope core library
    implementation "com.nps.adiscope:adiscopeCore:5.2.0"
    implementation "com.nps.adiscope:adiscopeAndroid:1.2.3"

    // [optional] adiscope video simple integration library
    implementation "com.nps.adiscope:adiscopeWalnut:1.0.0"
  
    // [optional] adiscope network adapter library
    // bidding, waterfall adapter
    implementation "com.nps.adiscope:adapter.admob:24.8.0.0"
    
    // bidding adapter
    implementation "com.nps.adiscope:adapter.max:13.5.1.0"

    // waterfall adapter
    implementation "com.nps.adiscope:adapter.chartboost:9.11.0.0"
    implementation "com.nps.adiscope:adapter.pangle:7.8.5.2.0"
    implementation "com.nps.adiscope:adapter.vungle:7.6.3.0"

    // direct sold adapter
    implementation "com.nps.adiscope:adapter.tnkpub:7.25.03.0"
}

하위 버전 연동 시 해당 버전의 브랜치 README를 참고하여 연동해주세요.

3.9.0~ adiscopeCore 버전 기준으로 코어 버전과 매핑되는 어댑터 버전이 아닐 경우
이니셜라이즈 시점에 아래와 같이 에러 레벨의 로그가 표시됩니다.

adapter version checker log

1-2. Add Adiscope, Network AppId metadata in AndroidManifest.xml

AndroidManifest.xml
애디스콥으로부터 설정값을 전달받은 후 adiscope_media_id, adiscope_media_secret 메타데이터 추가
admob 혹은 max 어댑터 연동 시 애드몹 appId 메타데이터를 추가해야 함 (값 미기입 시 앱 크래시 발생)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools">
    <application>
        <!-- define mediaId, secretKey metadata and 
         use AdiscopeSdk.initialize(activity, listener) function,
         sdk reads this information and initializes it  -->
        <meta-data android:name="adiscope_media_id" android:value="${adiscope_media_id}"/>
        <meta-data android:name="adiscope_media_secret" android:value="${adiscope_media_secret}"/>

        <!-- insert admob app id for adiscope admob/max network adapter -->
        <meta-data
              android:name="com.google.android.gms.ads.APPLICATION_ID"
              android:value="INPUT_YOUR_ADMOB_APP_ID"/>
    </application>
</manifest>

2. Initialize Adiscope Sdk

이니셜라이즈 함수는 크게 아래 두 가지로 지원하며, 용도에 따라 선택해서 사용할 수 있음

  • AdiscopeSdk.initialize(Activity activity, int mediaId, String mediaSecret, AdiscopeInitializeListener listener)
  • AdiscopeSdk.initialize(Activity activity, AdiscopeInitializeListener listener)
  • Other Initialize API

A) AdiscopeSdk.initialize(activity, mediaId, mediaSecret, listener)

빌드 환경에 따라 매체 환경을 코드 내에서 분기처리하여 이니셜라이즈하는 경우

// initialize parameters
// mediaId: 관리자를 통해 발급
// mediaSecret: 관리자를 통해 발급
// callbackTag: 관리자를 통해 발급, 기본 ""
// childYN: 어린이 여부를 설정해주는 값 (Google GMA에 세팅)
AdiscopeSdk.initialize(this, 
        INPUT_YOUR_MEDIA_ID, 
        "INPUT_YOUR_MEDIA_SECRET_KEY", 
        new AdiscopeInitializeListener() {
            @Override
            public void onInitialized(boolean isSuccess) {
                if (isSuccess) {
                    Log.d(TAG, "AdiscopeSdk initialized.");
                    // (recommend) get ad instance and set ad event listener
                    mOfferwallAd = AdiscopeSdk.getOfferwallAdInstance(this);
                    mOfferwallAd.setOfferwallAdListener(this);
            
                    mRewardedVideoAd = AdiscopeSdk.getRewardedVideoAdInstance(this);
                    mRewardedVideoAd.setRewardedVideoAdListener(this);
                    
                    mInterstitialAd = AdiscopeSdk.getInterstitialAdInstance(this);
                    mInterstitialAd.setInterstitialAdListener(this);
                    
                    mRewardedInterstitialAd = AdiscopeSdk.getRewardedInterstitialAdInstance(this);
                    mRewardedInterstitialAd.setRewardedInterstitialAdListener(this);

                    mAdEvent = AdiscopeSdk.getAdEventInstance(this);
                    mAdEvent.setAdEventListener(this);
                } else {
                    // Init 실패 에 대한 처리 Code 
                    Log.d(TAG, "AdiscopeSdk initialize failed.");
                }
            }
        }

B) AdiscopeSdk.initialize(activity, listener)

mediaId, mediaSecret 값을 고정으로 사용하는 경우

앱 모듈의 build.gradle의 manifestPlaceholders에 정의된 adiscope_media_id, adiscope_media_secret 값을 매니페스트에 각각 adiscope_media_id, adiscope_media_secret meta-data로 설정하고 AdiscopeSdk.initialize(activity, listener) 함수를 사용하면 SDK가 해당 meta-data 값을 읽어와 이니셜라이즈를 수행한다.

AdiscopeSdk.initialize(this, new AdiscopeInitializeListener() {
    @Override
    public void onInitialized(boolean isSuccess) {
        if (isSuccess) {
            Log.d(TAG, "AdiscopeSdk initialized.");
            // (recommend) get ad instance and set ad event listener
            mOfferwallAd = AdiscopeSdk.getOfferwallAdInstance(this);
            mOfferwallAd.setOfferwallAdListener(this);
            
            mRewardedVideoAd = AdiscopeSdk.getRewardedVideoAdInstance(this);
            mRewardedVideoAd.setRewardedVideoAdListener(this);
            
            mInterstitialAd = AdiscopeSdk.getInterstitialAdInstance(this);
            mInterstitialAd.setInterstitialAdListener(this);
            
            mRewardedInterstitialAd = AdiscopeSdk.getRewardedInterstitialAdInstance(this);
            mRewardedInterstitialAd.setRewardedInterstitialAdListener(this);

            mAdEvent = AdiscopeSdk.getAdEventInstance(this);
            mAdEvent.setAdEventListener(this);
        } else {
            // Init 실패 에 대한 처리 Code 
        }
    }
}

3. Set User Id

AdiscopeSdk.setUserId("exampleUniqueUserId");
  • 참여/시청한 광고에 대한 보상 지급을 위한 사용자 아이디 설정 (최대길이 64자)
    • Offerwall, Rewarded Video, Rewarded Interstitial 사용 시 필수 설정
  • 다계정 사용이 가능한 서비스일 경우, 계정 변경 시 setUserId 호출로 애디스콥에 변경 정보를 전달해주어야 함
    • 그렇지 않을 경우 변경된 계정 정보로 보상 지급이 되지 않음



Ad Formats

Offerwall Ads

Create Ad Instance

import com.nps.adiscope.offerwall.OfferwallAd;
if (AdiscopeSdk.isInitialize()) {
    OfferwallAd mOfferwallAd = AdiscopeSdk.getOfferwallAdInstance(this);
} else {
    // Reinitialize
}

Set Event Callback

if (mOfferwallAd != null) {
    mOfferwallAd.setOfferwallAdListener(this);

    @Override
    public void onOfferwallAdOpened(String unitId) {
        // offerwall ad show completed
    }

    @Override
    public void onOfferwallAdFailedToShow(String unitId, AdiscopeError adiscopeError) {
        // offerwall ad failed to show
    }

    @Override
    public void onOfferwallAdClosed(String unitId) {
        // offerwall ad closed
    }
}

Show

String OFFERWALL_UNIT_ID = "";
String[] excludeAdTypeList = {}; // 제외할 오퍼월 광고 타입 (ex. ["CPS"])
if (mOfferwallAd != null) {
    if (mOfferwallAd.show(activity, OFFERWALL_UNIT_ID, excludeAdTypeList)) {
        // succeed
    } else {
        // show is already in progress
    }
} else {
    // reinitialize
}
  • 애디스콥 이니셜라이즈 후 호출 가능
  • 어드민 페이지에 등록된 오퍼월 광고 유닛으로 사용자에게 오퍼월 광고를 보여줌
  • show는 중복 호출 불가
  • show가 실행되면 onOfferwallAdOpenedonOfferwallAdFailedToShow 중 하나가 항상 호출
  • onOfferwallAdOpened가 호출되었다면 이후 onOfferwallAdClosed가 항상 호출

Show Detail

오퍼월 상세 페이지 이동 함수는 두 가지로 지원

  • offerwallAd.showDetail(Activity activity, String unitId, String[] excludeAdTypeList, int sponsorshipItemId)
  • offerwallAd.showDetail(Activity activity, String url)

A) showDetail(activity, unitId, excludeAdTypeList, sponsorshipItemId)

String OFFERWALL_UNIT_ID = "";
String SPONSORSHIP_ITEM_ID = "";
String[] excludeAdTypeList = {}; // 제외할 오퍼월 광고 타입 (ex. ["CPS"])
if (mOfferwallAd != null) {
    if (mOfferwallAd.showDetail(activity, OFFERWALL_UNIT_ID, excludeAdTypeList, SPONSORSHIP_ITEM_ID)) {
        // succeed
    } else {
        // show is already in progress
    }
} else {
    // Reinitialize
}

B) showDetail(activity, url)

String SPONSORSHIP_URL = "";
if (mOfferwallAd != null) {
    if (mOfferwallAd.showDetail(activity, SPONSORSHIP_URL)) {
        // succeed
    } else {
        // show is already in progress
    }
} else {
    // Reinitialize    
}
  • 애디스콥 이니셜라이즈 후 호출 가능
  • 특정 광고 아이템의 상세 화면으로 이동
  • url는 mediaId, unitId, excludeAdTypeList, sponsorshipItemId가 포함된 형식
  • 요청하고자 하는 스폰서십 아이디 및 URL은 애디스콥에 문의 필요

Rewarded Ads

Create Ad Instance

import com.nps.adiscope.reward.RewardedVideoAd;
if (AdiscopeSdk.isInitialize()) {
    RewardedVideoAd mRewardedVideoAd = AdiscopeSdk.getRewardedVideoAdInstance(this); 
} else {
    // Reinitialize
}

Set Event Callback

if (mRewardedVideoAd != null) {
    mRewardedVideoAd.setRewardedVideoAdListener(this);
    
    @Override
    public void onRewardedVideoAdLoaded(String unitId) {
        // rewarded ad is ready
    }

    @Override
    public void onRewardedVideoAdFailedToLoad(String unitId, AdiscopeError adiscopeError) {
        // rewarded ad failed to load
    }

    @Override
    public void onRewardedVideoAdOpened(String unitId) {
        // rewarded ad show completed
    }

    @Override
    public void onRewardedVideoAdClosed(String unitId) {
        // rewarded ad closed
    }

    @Override
    public void onRewarded(String unitId, RewardItem rewardItem) {
        // user should receive the reward
        // RewardItem.getType: 보상 타입
        // RewardItem.getAmount: 보상 양
    }

    @Override
    public void onRewardedVideoAdFailedToShow(String unitId, AdiscopeError adiscopeError) {
        // rewarded ad failed to show
    }
}

Load

if (mRewardedVideoAd != null) {
    String RV_UNIT_ID = "";
    mRewardedVideoAd.load(RV_UNIT_ID);
} else {
    // Reinitialize
}
  • 애디스콥 이니셜라이즈 후 로드 호출 가능
  • 특정 보상형 광고 유닛에 속한 광고 네트워크의 광고를 로드
  • RewardedVideoAd의 LoadShow는 pair로 호출
    • Load를 한 후 Show를 하고, 광고를 Show한 후에는 다시 Load하여 다음 번 Show를 준비
  • 광고가 Show되는 동안 다음 광고를 Load할 수 있지만 이는 사용하는 Mediation Ad Network에 따라 달라질 수 있으므로 항상 보장되는 동작은 아님
  • 로드 성공 시 onRewardedVideoAdLoaded, 로드 실패 시 onRewardedVideoAdFailedToLoad 이벤트 콜백 호출
  • 로드 성공 콜백에 따라 보상형 광고 송출(show) 가능
  • (Optional) load의 시간이 필요해 로드 중에는 프로그래스바 노출 추천

isLoaded

if (mRewardedVideoAd != null) {
    if (mRewardedVideoAd.isLoaded(RV_UNIT_ID)) {
        // show rewarded ad
    } else {
        // do something else
    }
} else {
    // Reinitialize
}
  • 특정 보상형 광고 유닛의 광고 로드 여부 상태를 확인할 수 있음

Show

if (mRewardedVideoAd != null) {
    if (mRewardedVideoAd.show()) {
        // succeed
    } else {
        // this show request is duplicated
    }
} else {
    // Reinitialize
}
  • 마지막으로 로드된 보상형 광고를 사용자에게 송출함
  • show 성공 시 onRewardedVideoAdOpened, 실패 시 onRewardedVideoAdFailedToShow 이벤트 콜백 호출
  • onRewardedVideoAdOpened가 호출되었다면 이후 onRewardedVideoAdClosed가 항상 호출
  • RewardedVideoAd의 LoadShow는 pair로 호출
    • Load를 한 후 Show를 하고, 광고를 Show한 후에는 다시 Load하여 다음 번 Show를 준비
  • onRewarded 콜백이 호출되었을 경우 사용자에게 보상 지급이 가능함

Callback Reward

@Override
public void onRewarded(String unitId, RewardItem rewardItem) {
    // user should receive the reward
    // RewardItem.getType: 보상 타입
    // RewardItem.getAmount: 보상 양
}
  • 보상이 주어져야 할 경우 OnRewarded가 호출되며 파라미터로 관련 정보가 전달 (RewardItem)
    • RewardItem.type: 보상 타입
    • RewardItem.amount: 보상의 양
  • 이 보상 정보를 바탕으로 게임 내에서 보상을 지급
  • OnRewarded는 보통 onRewardedVideoAdOpenedonRewardedVideoAdClosed 사이에 호출되는 경우가 많으나 광고 미디에이션 네트워크마다 동작이 다를 수 있음
  • OnRewarded가 호출되지 않는 경우도 존재할 수 있음
    • 보상 콜백 설정을 Server-to-Server(S2S)로 하였다면, Video 시청 후에는 OnRewarded가 호출되지 않음
  • Reward 정보는 어뷰징 방지를 위해서 S2S 방식으로 전달 받는 것을 권장
    • S2S 방식을 선택하더라도 보상이 전달 될 시에는 OnRewarded가 호출
    • 이때는 서버를 통해 전달받은 정보를 기준으로 처리하고, OnRewarded를 통해 전달받은 정보는 검증용으로 사용하거나 무시하도록 함

Interstitial Ads

Create Ad Instance

import com.nps.adiscope.interstitial.InterstitialAd;
if (AdiscopeSdk.isInitialize()) {
    InterstitialAd mInterstitialAd = AdiscopeSdk.getInterstitialAdInstance(this);
} else {
    // Reinitialize
}

Set Event Callback

if (mInterstitialAd != null) {
    mInterstitialAd.setInterstitialAdListener(this);

    @Override
    public void onInterstitialAdLoaded() {
        // interstitial ad is ready
    }

    @Override
    public void onInterstitialAdFailedToLoad(AdiscopeError adiscopeError) {
        // interstitial ad failed to load
    }

    @Override
    public void onInterstitialAdOpened(String unitId) {
        // interstitial ad show completed
    }

    @Override
    public void onInterstitialAdClosed(String unitId) {
        // interstitial ad closed
    }

    @Override
    public void onInterstitialAdFailedToShow(String unitId, AdiscopeError adiscopeError) {
        // interstitial ad failed to show
    }
}

Load

if (mInterstitialAd != null) {
    String INTERSTITIAL_UNIT_ID = "";
    mInterstitialAd.load(INTERSTITIAL_UNIT_ID);
} else {
    // Reinitialize
}
  • 애디스콥 이니셜라이즈 후 로드 호출 가능
  • 특정 인터스티셜 유닛에 속한 광고 네트워크의 광고를 로드
  • Interstitial의 LoadShow는 pair로 호출
    • Load를 한 후 Show를 하고, 광고를 Show한 후에는 다시 Load하여 다음 번 Show를 준비
  • 광고가 Show되는 동안 다음 광고를 Load할 수 있지만 이는 사용하는 Mediation Ad Network에 따라 달라질 수 있으므로 항상 보장되는 동작은 아님
  • 로드 성공 시 onInterstitialAdLoaded, 로드 실패 시 onInterstitialAdFailedToLoad 이벤트 콜백 호출
  • 로드 성공 콜백에 따라 인터스티셜 광고 송출(show) 가능

isLoaded

if (mInterstitialAd != null) {
    if (mInterstitialAd.isLoaded(INTERSTITIAL_UNIT_ID)) {
        // show interstitial ad
    } else {
        // ad is not loaded
    }
} else {
    // Reinitialize
}
  • 특정 인터스티셜 유닛의 광고 로드 여부 상태를 확인할 수 있음

Show

if (mInterstitialAd != null) {
    if (mInterstitialAd.show()) {
        // succeed
    } else {
        // this show request is duplicated
    }
} else {
    // Reinitialize
}
  • 마지막으로 로드된 인터스티셜 광고를 사용자에게 송출함
  • show 성공 시 onInterstitialAdOpened, 실패 시 onInterstitialAdFailedToShow 이벤트 콜백 호출
  • onInterstitialAdOpened가 호출되었다면 이후 onInterstitialAdClosed가 항상 호출
  • Interstitial의 LoadShow는 pair로 호출
    • Load를 한 후 Show를 하고, 광고를 Show한 후에는 다시 Load하여 다음 번 Show를 준비

Rewarded Interstitial Ads

Create Ad Instance

import com.nps.adiscope.rewardinterstitial.RewardedInterstitialAd;
if (AdiscopeSdk.isInitialize()) {
    RewardedInterstitialAd mRewardedInterstitialAd = AdiscopeSdk.getRewardedInterstitialAdInstance(this);
}

Set Event Callback

if (mRewardedInterstitialAd != null) {
    mRewardedInterstitialAd.setRewardedInterstitialAdListener(this);

    @Override
    public void onRewardedInterstitialAdSkipped(String s) {
        // user skipped rewarded interstitial ad
    }

    @Override
    public void onRewardedInterstitialAdOpened(String s) {
        // rewarded interstitial ad show completed
    }

    @Override
    public void onRewardedInterstitialAdClosed(String s) {
        // rewarded interstitial ad closed
    }

    @Override
    public void onRewardedInterstitialAdRewarded(String s, RewardItem rewardItem) {
        // user should receive the reward
        // RewardItem.getType: 보상 타입
        // RewardItem.getAmount: 보상 양
    }

    @Override
    public void onRewardedInterstitialAdFailedToShow(String s, AdiscopeError adiscopeError) {
        // rewarded interstitial ad failed to show
    }
}

Preload

// preload rewarded interstitial ad which belongs to specific unit list
if (mRewardedInterstitialAd != null) {
    String[] unitList = {"RI_UNIT1", "RI_UNIT2", "RI_UNIT3"};
    mRewardedInterstitialAd.preloadUnit(unitList);
} else {
    // Reinitialize
}
  • 파라미터에 지정한 전면형 보상 광고 유닛들에 대한 로드를 순차적으로 진행
  • 이니셜라이즈 콜백 이후 1회 호출 권장

Preload All

// preload all activated rewarded interstitial ad
if (mRewardedInterstitialAd != null) {
    mRewardedInterstitialAd.preloadAll();
} else {
    // Reinitialize
}
  • 어드민 페이지에 등록된 활성화된 전면형 보상 광고 유닛들을 순차적으로 로드
  • 이니셜라이즈 콜백 이후 1회 호출 권장

Show

if (mRewardedInterstitialAd != null) {
    mRewardedInterstitialAd.show("RI_UNIT1");
} else {
    // Reinitialize
}
  • 로드된 전면형 보상 광고의 유닛을 지정하여 사용자에게 보여줌
  • 해당 유닛이 로드되어 있으면 안내 팝업을 보여준 뒤 해당 광고를 사용자에게 보여줌
    • 안내 팝업의 건너뛰기 버튼 클릭 시 팝업이 종료되며 onRewardedInterstitialAdSkipped가 호출됨
    • onRewardedInterstitialAdRewarded는 보통 onRewardedInterstitialAdOpenedonRewardedInterstitialAdClosed 사이에 호출되는 경우가 많으나 광고 미디에이션 네트워크마다 동작이 다를 수 있음
  • show는 중복하여 호출할 수 없음
  • onRewardedInterstitialAdClosed 혹은 onRewardedInterstitialAdFailedToShow가 호출되면 내부에서 해당 유닛을 자동으로 로드한다

Callback Reward

@Override
 public void onRewardedInterstitialAdRewarded(String unitId, RewardItem rewardItem) {
    // user should receive the reward
    // RewardItem.getType: 보상 타입
    // RewardItem.getAmount: 보상 양
 }
  • 보상이 주어져야 할 경우 onRewardedInterstitialAdRewarded가 호출되며 파라미터로 관련 정보가 전달 (RewardItem)
    • RewardItem.type: 보상 타입
    • RewardItem.amount: 보상의 양
  • 이 보상 정보를 바탕으로 게임 내에서 보상을 지급
  • onRewardedInterstitialAdRewarded는 보통 onRewardedInterstitialAdOpenedonRewardedInterstitialAdClosed 사이에 호출되는 경우가 많으나 광고 미디에이션 네트워크마다 동작이 다를 수 있음
  • onRewardedInterstitialAdRewarded가 호출되지 않는 경우도 존재할 수 있음
    • 보상 콜백 설정을 Server-to-Server(S2S)로 하였다면, Video 시청 후에는 onRewardedInterstitialAdRewarded가 호출되지 않음
  • Reward 정보는 어뷰징 방지를 위해서 S2S 방식으로 전달 받는 것을 권장
    • S2S 방식을 선택하더라도 보상이 전달 될 시에는 onRewardedInterstitialAdRewarded가 호출
    • 이때는 서버를 통해 전달받은 정보를 기준으로 처리하고, onRewardedInterstitialAdRewarded를 통해 전달받은 정보는 검증용으로 사용하거나 무시하도록 함

About

Sample for Adiscope Android sdk

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors