Skip to content

Quick Start

This document provides the shortest integration path for the Android RUM SDK to help you complete a verifiable data upload with minimal steps.

The application supports Agent automatic integration and manual integration. The following steps describe the minimum configuration for manual integration.

Prerequisites

Before you begin, complete the following preparations:

  1. Create an Android app in Real User Monitoring (RUM) and obtain the RUM App ID.
  2. Confirm the reporting endpoint and authentication method:
    • Local environment deployment: Prepare datakitUrl.
    • Public DataWay: Prepare datawayUrl and clientToken.
  3. Confirm that the app already has an Application class, or create one and declare it in AndroidManifest.xml.

Integration Steps

  1. Configure the Maven repository and add ft-sdk.
  2. Add ft-plugin, ft-native, and okhttp as needed.
  3. Install the SDK and initialize RUM in Application.onCreate(), and enable crash and UI block detection.
  4. If you need Log Collection or Distributed Tracing, initialize Log and Trace.
  5. Enable debug logs and trigger a page view or network request to confirm that data is reported successfully.

Maven Repository

If you integrate both ft-plugin and ft-sdk, you need to configure Maven repositories separately for the plugin and the AAR dependency. For details about the Gradle configuration, refer to App Access.

Minimal 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 for automatic collection of network requests and automatic tracing. Minimum compatible version: 3.12.+.
    implementation 'com.squareup.okhttp3:okhttp:4.+'
}
// app/build.gradle
apply plugin: 'ft-plugin'

To use the following capabilities, add the corresponding dependencies:

  • ft-native: Collect native crashes.
  • okhttp: Required for automatic collection of network requests or automatic injection of Trace Header.

ft-plugin is used to automatically collect data such as page views, clicks, OkHttp requests, and WebView events. If the current project uses an older version of AGP, use ft-plugin-legacy instead. For the complete syntax, refer to App Access.

Application Declaration

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

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

Minimal Initialization Example

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

        // For local environment deployment, use FTSDKConfig.builder(datakitUrl)
        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()

        // For local environment deployment, use FTSDKConfig.builder(datakitUrl)
        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 UI block detection by default. If you use a 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 the Integration

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

Next Steps

Feedback

Is this page helpful?