Catchpoint's RUM Mobile SDK enables you to send performance metrics to Catchpoint from your mobile applications. This article explains how to configure an Android application to send data to Catchpoint via the RUM Mobile SDK.
Demo App
To try out Mobile RUM before deploying it on your application, we've included a demo app. To run the app, install Android Studio, open the demo app package, and provide your app token (found in the RUM app in the portal UI).
RUM Mobile SDK -Android Installation
Step 1: Extract the Zip Files
The RUM Mobile SDK would typically be distributed through a centralized Android SDK distribution system such as Maven Central, but due to our dependency on the opentelemetry-android OkHttp instrumentation, we have forked opentelemetry-android library and customized it to create our SDK. Therefore, extensive discussions would be required to get approval to upload the SDK. Until the catchpoint-android-sdk and opentelemetry-android SDK are uploaded to Maven Central, we will provide local versions of these libraries.
Download the Zip files below to your computer.
io-8aa379c8-f13e-4eec-adbb-019f27623a67.zip
com-c0c4bbbd-a449-4101-9862-3db8d59156f1.zip
Once downloaded, extract the files to one of the following local paths on your computer:
-
Windows -
C:\Users\<your_user_name>\.m2\repository. -
Unix/Mac OS X -
~/.m2/repository[Full path -/Users/<your_user_name>/.m2/repository]com-0b9997b3-744f-42f2-9322-771f3f756793.zipcontains the compiledcatchpoint-android-sdk.io-48b67ffc-9481-4c2d-8d6d-92b118d6050e.zipcontains the compiledopentelemetry-android.
Step 2: Configure Maven Local Repository
Add mavenLocal() to your project's settings.gradle.kts file (if not already present) as shown below:

This makes your Android project look into your computer's local Maven store.
Step 3: Add the Plugin
In your app's build.gradle.kts file, add the following plugin:

id("net.bytebuddy.byte-buddy-gradle-plugin") version "1.17.1"
opentelemetry-android OkHttp instrumentation depends on ByteBuddy for it to be added to the app's compilation process. These dependencies are not transitive and must be defined within the target project to make the compilation process work properly.

Step 4: Add Dependencies
In the same app's build.gradle.kts file, add the following dependencies and build the project:
implementation("com.catchpoint.android.sdk:android-api:0.1.0-alpha-SNAPSHOT")
byteBuddy("io.opentelemetry.android:okhttp-3.0-agent:0.10.0-alpha-SNAPSHOT")

This step ensures the Catchpoint dependency is added to your app, along with the byteBuddy dependency for opentelemetry-android OkHttp instrumentation.
Step 5: Initialize Catchpoint SDK
In your Application file, you can access CatchpointSdk. Add the following code to start the Catchpoint Android SDK:
CatchpointSdk.start(this)
Example:
import android.app.Application
import com.catchpoint.android.api.CatchpointSdk
class MyApplication: Application() {
override fun onCreate() {
super.onCreate()
CatchpointSdk.start(this)
}
}

Now you can run the project, and the Catchpoint SDK should start sending data to Catchpoint's tracing collector.
Step 6 : Customize SDK Configuration
You can pass the config as a second parameter to the start function to customize the behavior of the SDK.
If you plan to use the Catchpoint collector, proceed with option 1 using the token from the Catchpoint Mobile RUM App created in control center. If you with to use your own collector, proceed with option 2.
Option 1: Set App Token
class MyApplication: Application() {
override fun onCreate() {
super.onCreate()
val config = CatchpointSdkConfiguration
.builder()
.setAppToken("<your_app_token>")
.build()
CatchpointSdk.start(this, config)
}
}
Option 2: Set Custom Collector
val defaultSpanProcessor: SpanProcessor by lazy {
BatchSpanProcessor.builder(
OtlpHttpSpanExporter.builder()
.setEndpoint(tracesIngestUrl)
.build()
).build()
}
val config = CatchpointSdkConfiguration.builder()
.setAppToken("<your_app_token>")
.setSpanProcessor(defaultSpanProcessor)
.build()
CatchpointSdk.start(this, config)