Skip to content

Quick Start

This document provides the shortest path to integrate the Android RUM SDK, helping you complete a verifiable data upload with minimal steps.

Prerequisites

Before starting, please complete the following preparations:

  1. Create an Android application in RUM and obtain the RUM App ID.
  2. Confirm the upload address and authentication method:
  3. Local environment deployment: Prepare datakitUrl.
  4. Public DataWay: Prepare datawayUrl and clientToken.
  5. Confirm that the application already has an Application, or prepare to create a new one and declare it in AndroidManifest.xml.

Integration Steps

  1. Configure the Maven repository and introduce ft-sdk.
  2. Introduce ft-plugin, ft-native, okhttp as needed.
  3. Install the SDK and initialize RUM in Application.onCreate(), while enabling crash and lag detection.
  4. If log collection or distributed tracing is needed, then initialize Log and Trace.
  5. Enable debug logs and trigger a page view or network request to confirm successful data upload.

Maven Repository

If integrating both ft-plugin and ft-sdk, you need to configure Maven repositories for the plugin and AAR dependencies separately. For specific Gradle configuration methods, please refer directly to Application Access.

Minimum Dependencies

// build.gradle
plugins {
    id 'com.cloudcare.ft.mobile.sdk.tracker.plugin' version '[latest_version]'
}
// app/build.gradle
dependencies {
    implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:[latest_version]'
    // json serialization
    implementation 'com.google.code.gson:gson:2.8.+'
    // Optional, required if automatic network request collection and automatic trace enabling are needed, minimum compatible version 3.12.+
    implementation 'com.squareup.okhttp3:okhttp:4.+'
}
// app/build.gradle
apply plugin: 'ft-plugin'

If the following capabilities are needed, please add the corresponding dependencies:

  • ft-native: For collecting Native Crash.
  • okhttp: Required when automatic network request collection or automatic Trace Header injection is needed.

ft-plugin is used for automatic collection of page views, clicks, OkHttp requests, WebView data, etc. If the current project uses an older version of AGP, please use ft-plugin-legacy instead. For the complete syntax, refer to Application Access.

Application Declaration

If your project does not yet have a custom Application, please create one first and declare it in AndroidManifest.xml:

<application
    android:name=".DemoApplication">
</application>

Minimum Initialization Example

public class DemoApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // Use FTSDKConfig.builder(datakitUrl) for local environment deployment
        FTSDKConfig config = FTSDKConfig.builder(datawayUrl, clientToken);
        config.setDebug(true);
        FTSdk.install(config);

        FTSdk.initRUMWithConfig(
                new FTRUMConfig()
                        .setRumAppId(RUM_APP_ID)
                        .setEnableTraceUserView(true)
                        .setEnableTraceUserAction(true)
                        .setEnableTraceUserResource(true)
                        .setEnableTrackAppUIBlock(true)
                        .setEnableTrackAppCrash(true)
                        .setEnableTrackAppANR(true)
        );
    }
}
class DemoApplication : Application() {
    override fun onCreate() {
        super.onCreate()

        // Use FTSDKConfig.builder(datakitUrl) for local environment deployment
        val config = FTSDKConfig.builder(datawayUrl, clientToken)
        config.setDebug(true)
        FTSdk.install(config)

        FTSdk.initRUMWithConfig(
            FTRUMConfig()
                .setRumAppId(RUM_APP_ID)
                .setEnableTraceUserView(true)
                .setEnableTraceUserAction(true)
                .setEnableTraceUserResource(true)
                .setEnableTrackAppUIBlock(true)
                .setEnableTrackAppCrash(true)
                .setEnableTrackAppANR(true)
        )
    }
}

The above example meets the minimum RUM integration requirements and enables crash and ANR detection by default. If using local environment deployment, replace FTSDKConfig.builder(datawayUrl, clientToken) with FTSDKConfig.builder(datakitUrl).

Optional: Initialize Log and Trace

If you also need log collection or distributed tracing, you can add the following initialization:

FTSdk.initLogWithConfig(
    FTLoggerConfig()
        .setEnableCustomLog(true)
        .setEnableLinkRUMData(true)
)

FTSdk.initTraceWithConfig(
    FTTraceConfig()
        .setEnableAutoTrace(true)
        .setEnableLinkRUMData(true)
)

Verify Integration Success

  1. Keep config.setDebug(true) enabled and run the application.
  2. Open a page, or initiate a network request in a scenario where okhttp is integrated.
  3. Search for [FT-SDK] in Logcat and confirm logs similar to initRUMWithConfig complete or Sync Success appear.
  4. Return to the Guance console and confirm that corresponding RUM data has appeared in the application.

Next Steps