Docs » Get your Android data in

Get your Android data in 🔗

Follow these steps to instrument your Android application and get data into Splunk RUM for Mobile.

Note

You need to enable desugaring to get your Android data in to Splunk RUM for Mobile.

Enable desugaring in API level 21 and higher 🔗

Splunk RUM for Mobile supports API Level 21 and higher, with core library desugaring enabled.

To enable desugaring follow these steps:

  1. Go to documentation Java 8+ API desugaring support (Android Gradle Plugin 4.0.0+) on the Android developer website.

  2. Update the Android plugin to the version 4.1.x. For instructions on how to upgrade, see Update the Android Gradle plugin.

  3. Add the code snippet from the documentation Java 8+ API desugaring support (Android Gradle Plugin 4.1.x) on the Android developer website for either Groovy or Kotlin to your app module’s build.gradle file.

  4. Depending on the configuration of your app, you might also need to add the code snippet you selected in step 2 to the build.gradle file of your library module. For more information, see the documentation Java 8+ API desugaring support (Android Gradle Plugin 4.1.x) on the Android developer website.

Import the Splunk RUM Android instrumentation library 🔗

Import the Splunk RUM Android instrumentation library with a Gradle dependency from Maven Central.

  1. Add Maven Central as a Maven repository to the repositories section of your main build.gradle file:

allprojects {
    repositories {
        google()
...
        mavenCentral()
    }
}
  1. Then, add the latest Splunk RUM Android Instrumentation library release as a dependency in your application’s build.gradle file. To find the latest release, see Releases in splunk-otel-android on GitHub.

dependencies {
...
    implementation ("com.splunk:splunk-otel-android:<latest-release>")
...
}

Set up Splunk RUM for Mobile to monitor your Android application 🔗

Follow these steps to set up Splunk RUM for mobile to monitor your Android application:

Prerequisites and requirements 🔗

Initialize the Splunk RUM Android Library 🔗

To initialize the Splunk RUM Android library you need to create a configuration object.

Example Configuration

String realm = "<your Observability realm>";
String rumAccessToken = "<your RUM access token>";
String appVersion = "<your app version>";
Config config = SplunkRum.newConfigBuilder()
        .realm(realm)
        .rumAccessToken(rumAccessToken)
        .applicationName("<your Android app>")
        .globalAttributes(
            Attributes.builder()
                .put(StandardAttributes.APP_VERSION, appVersion)
                .build())
        .build();

Next, pass your configuration to the static method SplunkRum.initialize(Config, Application) as seen in the following example:

Example Initialization

class MyApplication extends Application {
    //...

    @Override
    public void onCreate() {
        super.onCreate();
        SplunkRum.initialize(config, this);
    }
}

(Optional) Additional configuration options 🔗

You can customize your instrumentation by adding configurations to the Config.Builder.

Configuration option

Type

Description

deploymentEnvironment

String

Sets the Splunk Environment attribute on the spans that are generated by the instrumentation.

beaconEndpoint

String

Use this method instead of realm(String) to explicitly give the full URL of the RUM ingest endpoint. For example, https://rum-ingest.<your Observability realm>.signalfx.com/v1/rum.

debugEnabled

Boolean
  • Default: false

Enable debug mode to turn on the OTel logging span exporter.

crashReportingEnabled

Boolean
  • Default: true

Ability to disable crash reporting

anrDetectionEnabled

Boolean
  • Default: true

Ability to disable ANR (application not responding) detection and reporting.

networkMonitorEnabled

Boolean
  • Default: true

Ability to disable network monitoring.

globalAttributes

Attributes

Ability to append every span collected by with a set of OTel attributes.

filterSpans

Consumer<SpanFilterBuilder>

Ability to customize and remove spans emitted by the splunk-otel-android library.

Advanced usage 🔗

For more, see Advanced usage in the splunk-otel-android project on GitHub.