Install the Teak SDK in Android
It’s time to add the Teak SDK to your Android project and give it your game’s credentials.
-
Teak supports Android 5.0 (API level 21) or newer.
-
Your project is connected to a Firebase project (from the previous step).
Add the Teak AAR
The latest Teak Android SDK is always available as an AAR at sdks.teakcdn.com/android/teak.aar.
Download it and add it to your project’s libs/ directory, then reference it from your app-level build.gradle:
dependencies {
implementation files('libs/teak.aar')
// ... your other dependencies
}
Add Teak’s Dependencies
Teak relies on the following libraries. Add them to your app-level build.gradle if they aren’t already present.
dependencies {
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.google.android.gms:play-services-ads-identifier:16+'
implementation 'com.google.android.gms:play-services-base:16+'
implementation 'com.google.android.gms:play-services-basement:16+'
implementation 'com.google.firebase:firebase-messaging:21+'
implementation 'androidx.core:core:1.0.+'
implementation 'androidx.work:work-runtime:2.5.+'
// Optional: enables install-attribution reporting
implementation 'com.android.installreferrer:installreferrer:2.2+'
}
Configure Teak Credentials
Teak needs your Teak App ID and Teak API Key to talk to the Teak service. You provide these through a res/values/teak.xml resource file.
Create res/values/teak.xml in your app module:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="io_teak_app_id">YOUR_TEAK_APP_ID</string>
<string name="io_teak_api_key">YOUR_TEAK_API_KEY</string>
</resources>
Replace YOUR_TEAK_APP_ID and YOUR_TEAK_API_KEY with your game’s values. You’ll find both in for your app on the Teak dashboard.
|
The Teak SDK is now installed and has its credentials. Next, we’ll add the code that brings it to life.