Link up

This document covers how to integrate the DFINERY Android SDK into Android. Installing the DFINERY SDK provides event analytics, user profiles, and actions.

Before you start

Service Settings

You must check Android in the Data Source section on the Service Management/Service Information page of the DFINERY console.

Service Information

Support Information

  • Minimum supported SDK: Android 4.4+ / API 19+

  • Target SDK: 33

  • Recently compiled Firebase Cloud Messaging version: 24.0.0

Installing the SDK

Adding dependencies

To apply the DFINERY SDK dependency in your app, complete the following steps:

1. Add mavenCentralin repositories to fetch maven dependencies.

2. Open the build.gradle file inside the app's module directory.

3. Add SDK dependencies for the latest version of DFINERY SDK and required components to dependencies.

DFINERY requires play-services-appset dependency to collect AppSetId.

SDK Initialization

Initialize

To initialize the DFINERY SDK in your app, complete the following steps:

1. Create an object that inherits Application. If an inherited object already exists, use that object.

2. Override the onCreate() method in an object that inherits Application

3. Write the following code in the onCreate() method.

The Service ID can be found in the path of the DFINERY Console. Service Management/Service Information/Key Information/Service Key

The following code snippet shows an example of when initialization is complete.

4. Register the application written in AndroidManifest.xml.

5. Add the required permissions to AndroidManifest.xml.

Set up your Google Advertising ID (optional)

To collect the Google Advertising ID, setGoogleAdvertisingId()you must set it manually via the method.

1. Open the build.gradle file inside your app's module directory.

3. Add the required permissions to AndroidManifest.xml.

4. Set the advertising ID via thesetGoogleAdvertisingId() method.

SDK Setup

You can set options such as enabling logs when initializing the SDK.

Activate log

Logging can be enabled using DfineryConfig, which applies the settings of DFINERY. DfineryConfig can init()be applied by passing it as a parameter when calling a method, or res/values/dfinery.xmlcan be set using.

  • The first argument, enableis a value that sets whether to display the log or not. The default value is false.

Change the log level

Log levels can be set using DfineryConfig, which applies Dfinery's settings. DfineryConfig can be applied as a parameter when calling the init() method, or set using res/values/dfinery.xml.

Log level values โ€‹โ€‹follow the definition of constant values โ€‹โ€‹in android.util.Log.

  • The first argument, logLevel, is a value that sets the log display level. The default value is Log.ERROR(6).

Complete

SDK installation and initialization is complete.

Last updated