Android
The SDK is available as an AAR (recommended) and JAR library. The library is available in the MavenCentral and GitHub repository.

In the Project build.gradle file, declare the mavenCentral repository:
repositories {
mavenCentral()
}

If you use Gradle for building apps specify the following dependencies in the application build.gradle file.
dependencies {
// Requirement
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.google.android.gms:play-services-base:17.6.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
// if you use AAR (recommended) or JAR downloaded from GitHub, please add:
implementation fileTree(dir: "libs", include: ["*.aar"])
// or just add the dependency, get the latest version from
// https://mvnrepository.com/artifact/com.devtodev/android-analytics
implementation 'com.devtodev:android-analytics:*.*.*'
// Optional (recommended)
implementation 'com.android.installreferrer:installreferrer:2.2'
}

Use the following way to initialize the library in the first Activity onCreate() method:
Kotlin
Java
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val analyticsConfiguration = DTDAnalyticsConfiguration()
analyticsConfiguration.logLevel = DTDLogLevel.Error
DTDAnalytics.initialize("appKey", analyticsConfiguration, context)
}
}
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DTDAnalyticsConfiguration configuration = new DTDAnalyticsConfiguration();
configuration.setLogLevel(DTDLogLevel.Error);
DTDAnalytics.INSTANCE.initialize("App ID", configuration, context);
}
}
  • You can find the App ID in the settings of the respective app in devtodev (Settings → SDK → Integration → Credentials).
  • config - is a DTDAnalyticsConfiguration object instance that is used for specifying additional properties during initialization.
DTDAnalyticsConfiguration
Parameter
Type
Description
currentLevel
Integer
The player level at the moment of devtodev SDK initialization. It’s optional but we recommend using it for improving data accuracy.
userId
String
A custom user ID assigned by the developer. In the case of default calculation by device IDs, the identifier can be used for searching users in devtodev. In case the project uses calculation by user IDs, the parameter is mandatory because it becomes the principal calculation ID in devtodev.
trackingAvailability
DTDTrackingStatus (enum)
The property allows or disallows devtodev tracking of the user. By default, it is set to DTDTrackingStatus.enable. SDK stores the previously assigned value. Pass DTDTrackingStatus.disable if the user opted out of tracking in line with GDPR.
logLevel
DTDLogLevel (enum)
The level of logging the SDK activity. The DTDLogLevel.no value is used by default. For troubleshooting during integration it is recommended to set it to DTDLogLevel.debug, and either switch it off DTDLogLevel.no or use it only for error handling DTDLogLevel.error in the release version.
Example:
Kotlin
Java
val config = DTDAnalyticsConfiguration()
config.currentLevel = 1
config.userId = "CustomUserID"
config.trackingAvailability = DTDTrackingStatus.Enable
config.logLevel = DTDLogLevel.Error
DTDAnalytics.initialize("appKey", config, context)
DTDAnalyticsConfiguration config = new DTDAnalyticsConfiguration();
config.setCurrentLevel(1);
config.setUserId("CustomUserID");
config.setTrackingAvailability(DTDTrackingStatus.Enable);
config.setLogLevel(DTDLogLevel.Error);
DTDAnalytics.INSTANCE.initialize("appKey", config, context);

Add the following strings to the proguard-rules.pro file of your app
-keep class com.devtodev.** { *; }
-dontwarn com.devtodev.**
Last modified 3mo ago
Export as PDF
Copy link
On this page
Step 1. Declare repositories
Step 2. Add Gradle Build Dependencies
Step 3. SDK Initialization
Step 4. SDK Initialization