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

Step 1. Gradle Build Dependencies

If you use Gradle for building apps specify the following dependencies in the build.gradle file in the dependencies block.
Kotlin
Java
1
defaultConfig {
2
//other existing fields
3
versionName "1.0" //your app version (required)
4
}
5
6
dependencies {
7
implementation ‘androidx.preference:preference-ktx:1.1.1
8
implementation 'com.android.installreferrer:installreferrer:2.2'
9
implementation 'com.google.android.gms:play-services-base:17.6.0'
10
implementation 'com.google.code.gson:gson:2.8.6'
11
implementation 'com.google.firebase:firebase-core:19.0.0'
12
// if you use AAR (recommended) or JAR downloaded from GitHub, please add:
13
implementation fileTree(dir: "libs", include: ["*.aar"])
14
// or just add the dependency
15
implementation 'com.devtodev:android-analytics:2.0.0'
16
}
Copied!
1
defaultConfig {
2
//other existing fields
3
versionName "1.0" //your app version (required)
4
}
5
6
dependencies {
7
implementation ’androidx.preference:preference:1.1.1
8
implementation 'com.android.installreferrer:installreferrer:2.2'
9
implementation 'com.google.android.gms:play-services-base:17.6.0'
10
implementation 'com.google.code.gson:gson:2.8.6'
11
implementation 'com.google.firebase:firebase-core:19.0.0'
12
// if you use AAR (recommended) or JAR downloaded from GitHub, please add:
13
implementation fileTree(dir: "libs", include: ["*.aar"])
14
// or just add the dependency
15
implementation 'com.devtodev:android:2.0.0'
16
}
Copied!

Step 2. SDK Initialization

Use the following way to initialize the library in the first Activity onCreate() method:
Kotlin
Java
1
class MainActivity : Activity() {
2
override fun onCreate(savedInstanceState: Bundle?) {
3
super.onCreate(savedInstanceState)
4
5
val analyticsConfiguration = DTDAnalyticsConfiguration()
6
analyticsConfiguration.logLevel = DTDLogLevel.Error
7
DTDAnalytics.initialize("App ID", analyticsConfiguration, context)
8
}
9
}
Copied!
1
public class MainActivity extends Activity {
2
@Override
3
protected void onCreate(Bundle savedInstanceState) {
4
super.onCreate(savedInstanceState);
5
6
DTDAnalyticsConfiguration configuration = new DTDAnalyticsConfiguration();
7
configuration.setLogLevel(DTDLogLevel.Error);
8
DTDAnalytics.INSTANCE.initialize("App ID", configuration, context);
9
}
10
}
Copied!
  • 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:
1
let config = DTDAnalyticsConfiguration()
2
config.currentLevel = 1
3
config.userId = "CustomUserID"
4
config.trackingAvailability = DTDTrackingStatus.Enable
5
config.logLevel = .error
6
DTDAnalytics.initialize(applicationKey: "appKey", configuration: config)
Copied!

Step 3. SDK Initialization

Add the following strings to the proguard-rules.pro file of your app
1
-keep class com.devtodev.** { *; }
2
-dontwarn com.devtodev.**
Copied!
Last modified 3mo ago