04. SDK for Java

SDK Installation

gradle์„ ์ด์šฉํ•˜์—ฌ SDK ์„ค์ •์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. (You can configure the SDK using gradle.)

Maven Settings

ํ”„๋กœ์ ํŠธ ์ˆ˜์ค€ build.gradle์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด maven์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. (Add maven to your project level build.gradle as follows:)

repositories {
    google()
    mavenCentral()
 
    maven{
        url "https://repo.onestore.co.kr/repository/onestore-sdk-public"
    }
}

Dependency Settings

์•ฑ ์ˆ˜์ค€ build.gradle์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด dependency๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. (Add the dependency to your app level build.gradle as follows:)

dependencies {
    ...
    implementation 'com.oneadmax.sdk:sdk-ads:1.2.1'
    ...
}

ํ•„์ˆ˜ Permission ์ถ”๊ฐ€ ๋ฐ ํ™•์ธ(Adding and Verifying Required Permissions)

๋‹ค์Œ์˜ ํ•„์ˆ˜ ๊ถŒํ•œ์ดAndroid Manifest์— ์ถ”๊ฐ€๋˜์–ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. (The following essential permissions must be added to your Android Manifest as follows:)

<manifest>
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
...
</manifest>

ONE AdMax SDK

๋งค์ฒดํ‚ค ๋“ฑ๋ก(Media Key Registration)

ONE AdMax ์ฝ˜์†”์—์„œ ๋ฐœ๊ธ‰๋ฐ›์€ ๋งค์ฒดํ‚ค๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด Android Manifest์˜ application ํƒœ๊ทธ ๋‚ด์— ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. (The media key issued by the ONE AdMax console must be added within the application tag of your Android Manifest as follows:)

<manifest>
    ...
    <application>  
        <meta-data android:name="com.oneadmax.global.appkey" android:value="your_app_key" />
    </application>
     ...
</manifest>

SDK ์ดˆ๊ธฐํ™”(SDK Initialize)

ONE AdMax SDK ์—์„œ๋Š” ๋‹ค์–‘ํ•œ ํ˜•ํƒœ์˜ ๊ด‘๊ณ ๋ฅผ ์ œ๊ณตํ•˜๋ฉฐ, ๊ฐ ์„ธ๋ถ€ ๊ด‘๊ณ ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์ „์— SDK ์ดˆ๊ธฐํ™” ์ž‘์—…์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. (The ONE AdMax SDK offers various types of ads, and you need to initialize the SDK before using any specific ad formats.)

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate( savedInstanceState );
    ...
     
    if( ONEAdMax.isInit( MyActivity.this ) == false ){
        ONEAdMax.init( MyActivity.this, new IOAMInitListener() {
            @Override
            public void onInitialized() {
                Log.d( Tag, "ONEAdMax SDK Initialized.");
            }
        });
    }
    ...
}

SDK ํ•ด์ œ(SDK Destroy)

์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ข…๋ฃŒ๋  ๋•Œ ๋ฉ”๋ชจ๋ฆฌ์— ํ• ๋‹น๋œ ๋ฆฌ์†Œ์Šค( View, Memory )๋ฅผ ํ•ด์ œํ•ฉ๋‹ˆ๋‹ค.

์•ฑ์ด ์ข…๋ฃŒ๋  ๋•Œ ํ˜ธ์ถœ๋˜๋Š” activity์˜ onDestroy()์—์„œ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค. (Delete allocated resources (View, Memory) when the application is about to close. Call this in the onDestroy() method of the activity that gets called when the app is closing.)

@Override
protected void onDestroy() {
    // TODO Auto-generated method stub 
    super.onDestroy();  
     
    ...
 
    ONEAdMax.unInit();
}

Log Settings

ONE AdMax SDK์˜ ๋กœ๊ทธ๋ฅผ ํ™œ์„ฑ ๋˜๋Š” ๋น„ํ™œ์„ฑํ™” ํ•ฉ๋‹ˆ๋‹ค. (Enable or disable logs for the ONE AdMax SDK.)

ONEAdMax.setLogEnable( true ); // default false

GDPR Settings

EU์˜ GDPR (General Data protection Regulation) ๋ฒ•์•ˆ์— ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜ API๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. GDPR ๋™์˜๊ฐ€ ํ•„์š”ํ•œ ์œ ์ €์— ํ•œํ•ด ๋‹ค์Œ API๋ฅผ ํ˜ธ์ถœํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. (To comply with the EU's General Data Protection Regulation (GDPR), use the following API. Call the following API for users who require GDPR consent.)

ONEAdMax.gdprConsentAvailable( false ); // Default : true

COPPA Settings

COPPA(Children's Online Privacy Protection Rule)๋ฒ•์•ˆ์— ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜ API๋ฅผ ์ถ”๊ฐ€ ํ•ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ๋””๋ฐ”์ด์Šค์—์„œ๋Š” ๋ชจ๋“  ๊ด‘๊ณ  ํƒ€์ž…์˜ ๊ด‘๊ณ  ์š”์ฒญ์— ๋Œ€ํ•ด No ad ์ฒ˜๋ฆฌ ๋ฉ๋‹ˆ๋‹ค. (๊ธฐ๋ณธ๊ฐ’: false) (To comply with the Children's Online Privacy Protection Rule (COPPA), we've added the following API. This API will ensure that no ads are served on devices where this setting is enabled. (Default: false))

ONEAdMaxClient.tagForChildDirectedTreatment(true);

Last updated