# 03. SDK for Java

## **SDK** Installation <a href="#id-01.sdk-sdk" id="id-01.sdk-sdk"></a>

You can configure the SDK using Gradle.

## Maven Settings <a href="#id-01.sdk-maven" id="id-01.sdk-maven"></a>

Add the following Maven repository to the project-level `build.gradle`

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

## Dependency Settings

Add the following dependency to the app-level `build.gradle`

```java
dependencies {
    ...
    implementation 'com.oneadmax.sdk:sdk-ads:1.2.3'
    ...
}
```

## Permission Settings

The following required permissions must be added to the Android Manifest:

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

***

## **ONE AdMax SDK**  <a href="#id-01.sdk-oneadmaxsdk" id="id-01.sdk-oneadmaxsdk"></a>

### Media Key Registration

Add the media key issued from the ONE AdMax console within the `application` tag of the Android Manifest.

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

### **SDK Initialize** <a href="#id-01.sdk-sdk" id="id-01.sdk-sdk"></a>

```java
@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.");
            }
        });
    }
    ...
}
```

### **`onDestroy()` API** <a href="#id-01.sdk-sdk" id="id-01.sdk-sdk"></a>

Release the resources (View, Memory) allocated in memory when the application is terminated.\
This should be called in the `onDestroy()` method of the activity that is being terminated.

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

### **Log Settings** <a href="#id-01.sdk-log" id="id-01.sdk-log"></a>

You can enable or disable the logs for the ONE AdMax SDK.

```java
ONEAdMax.setLogEnable( true ); // default false
```

### **GDPR Settings** <a href="#id-01.sdk-gdpr" id="id-01.sdk-gdpr"></a>

To comply with the EU's GDPR (General Data Protection Regulation) regulation, the following API is used. It is called only for users who need to provide GDPR consent.

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

### COPPA Settings <a href="#coppa" id="coppa"></a>

To comply with the COPPA ([Children's Online Privacy Protection Rule](https://www.ftc.gov/legal-library/browse/rules/childrens-online-privacy-protection-rule-coppa)), the following API is added. For devices that fall under COPPA, all types of ad requests will be treated as "No ad" (default: false).

```csharp
ONEAdMaxClient.tagForChildDirectedTreatment(false);
```


---

# 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://one-admax-organization.gitbook.io/one-admax-sdk/oneadmax_dev_guide_en/oamsdk.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.
