Skip to main content

Android

Android is a widely-used mobile operating system developed by Google, designed for touchscreen devices such as smartphones and tablets. It is based on a modified version of the Linux kernel and other open-source software.

Configuration

Integrate Android data into Boltic in the following manner

To connect with an App:

  1. Enter a Source Name by which you want to refer to this Android integration.
  2. Test and Save your source.

Once source is created use the below steps to integrate it to your Android app

Step 1: Create libs Directory
First, you need to add our SDK's .aar file to your project. Perform the following steps:

  • Navigate to your app's main directory.
  • Create a new directory named libs within the app directory.

Step 2: Add .aar File
Place the .aar file of the SDK you wish to integrate into the libs the directory you just created.

Step 3: Update build.gradle
Open your app/build.gradle file and add the following line to the dependencies section:

implementation fileTree(dir: "libs", include: ["*.aar"])

This line instructs Gradle to include any .aar files located in the libs directory as dependencies for your project.

Step 4: SDK Initialization
In your application code, initialize the SDK as follows:

private val analytics = Analytics.Builder(context, 'your_access_token')
.collectDeviceId(true)
.logLevel(if (debugging)
Analytics.LogLevel.VERBOSE
else
Analytics.LogLevel.NONE)
.trackDeepLinks()
.crypto(Crypto.none())
.trackApplicationLifecycleEvents()
.tag(System.currentTimeMillis().toString()).build()

Step 5: Tracking Events The SDK allows you to track events throughout your application. Ensure that you do not call these tracking methods on the main or UI thread to avoid UI blocking.

val pageTitle = "Sample Page Title"
val pageUrl = "https://example.com"
val event = "Page Viewed"
val page = mapOf("title"
to pageTitle, "url"
to pageUrl)
val mainContext = Options().putContext("page", page)
// Replace 'key-values' with your event-specific key-value pairs
analytics.track(event, Properties()
.apply {
putAll(mapOf("key1"
to "value1", "key2"
to "value2"))
}, mainContext)

This example demonstrates how to track a "Page Viewed" event with additional context and properties.

You have now successfully integrated your Android App to Boltic!