> For the complete documentation index, see [llms.txt](https://one-admax-organization.gitbook.io/one-admax-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://one-admax-organization.gitbook.io/one-admax-sdk/oneadmax_dev_guide_en/oamsdk.md).

# 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()
}
```

## Dependency Settings

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

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

## 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);
```
