Skip to main content

Android - Installation & Integration

Requirements

Android SDK 25+

Installation

Add the following configuration to the app/build.gradle file in your project:

dependencies {
implementation "com.dfg.anfield:yuu-sdk:latest.release"
}

Also add the following to your project/build.gradle file.

buildscript {
repositories {
maven {
url "url"
credentials {
username "_json_key_base64"
password "password"
}
authentication {
basic(BasicAuthentication)
}
}
}
}

Using the Dependency Resolution Management block in settings.gradle

To use dependencyResolutionManagement in the new Gradle settings, add the following configuration to the settings.gradle file.

dependencyResolutionManagement {
repositories {
maven {
url 'url'
credentials {
username "_json_key_base64"
password privateProperties.get(password)
}
authentication {
basic(BasicAuthentication)
}
}
}
}

For settings.gradle.kts (Kotlin script) files:

dependencyResolutionManagement {
repositories {
maven {
url = uri("url")
credentials {
username = "_json_key_base64"
password = "password"
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
}

Integration

The yuu SDK automatically initializes itself when your app starts using the metadata defined in your AndroidManifest.xml. You must provide your client key, banner code, and target environment (SIT/PROD).

Metadata Configuration

First, update your strings.xml to include your specific credentials:

<string name="client_id">{$CLIENT_ID}</string>
<string name="banner_code">{$BANNER_CODE}</string>
<string name="yuu_env">SIT</string>

Then, add the following <meta-data> tags inside the <application> tag in your AndroidManifest.xml:

<application>
<!-- target environment: SIT or PROD -->
<meta-data
android:name="com.yuurewards.sdk.ApplicationEnv"
android:value="@string/yuu_env"
tools:replace="android:value" />
<meta-data
android:name="com.yuurewards.sdk.ClientId"
android:value="@string/client_id"
tools:replace="android:value" />
<meta-data
android:name="com.yuurewards.sdk.BannerCode"
android:value="@string/banner_code"
tools:replace="android:value" />
</application>

Permission

Since network calls are required, you must also include the internet permission in the AndroidManifest.xml file.

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