Standalone manual instrumentation using OneAgent SDK for Android

The DESK Android Gradle plugin provides several configuration options to customize auto-instrumentation. If you are unable to use the plugin because of technical limitations, choose manual instrumentation. When you use manual instrumentation, nothing is done automatically and you have to ensure that every important part of your app is manually instrumented.

Include the OneAgent library as a dependency to your project.

When you use Gradle as a build automation tool, add the OneAgent library as an implementation or api dependency in one or more modules. The integration depends on the parts that you want to instrument and the project architecture that you use for your Android project. Examples:

  • For single-module Android project you should add the OneAgent library as implementation dependency in your Android application module.
dependencies {
    implementation 'com.desk.agent:agent-android:8.+'
}
  • For multi-module Android projects with dynamic-feature modules, add the OneAgent library as an api dependency in your base module, the Android application module. If you use internal Android library modules that need to be instrumented, add the OneAgent library as an implementation dependency to these internal Android library modules.

OneAgent for Android is hosted on JCenter and MavenCentral. You only have to add one of these two repositories in your build.gradle file. Most Android projects already contain the jcenter() repository and no additional modification is needed.

We recommend version 8.+ because Gradle automatically updates the plugin whenever a new version is available. When DESK releases a new major version, you must manually upgrade to the new version. The new major version might contain breaking changes and some manual adjustments might be needed.

Start OneAgent.

Use the start-up method to initialize, configure, and start OneAgent as shown below. It's recommended that you start OneAgent in the onCreate method from your application class. If your app supports Direct Boot, make sure that the DESK.startup is never called from a Direct Boot aware component.

public class YourApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        DESK.startup(this, new DESKConfigurationBuilder("<YourApplicationID>", "<ProvidedBeaconUrl>")
            ... // additional configuration
            .buildConfiguration());
    }
}

Go to the Instrumentation page of your mobile app in DESK to obtain the correct values.

Use OneAgent SDK for Android to enhance mobile user experience data

Note: If you don't manually instrument parts of your app, OneAgent won't be able to monitor your app and send captured mobile user experience data to DESK.