Android agent
Installing the agent
To install SixthSense Mobile Monitoring Android SDK add the dependency to your build.gradle file dependencies block
Add the following lines to the repositories block
Configuring the agent
Configuration is done via AndroidManifest.xml.
- Configure the Access Token in the application tag.
For accessing the token, see Accessing your Access Token under Getting started with the Observability Portal.
- Similarly configure reporting Base URL.
- (Optional) Similarly you can configure the application name that you want to see on the SixthSense dashboard when data is reported for this application.
If you do not configure this field, the default application name is used for reporting the data for this application. This option is useful when you have different product flavors (for example, dev, test, production environments) and want data for each of these to be reported separately to the dashboard.
- Initialize SSObservability in the OnCreate callback of your application subclass:
This will capture crashes and ANRs and list them on the dashboard. To report handled exceptions use the following SSLogger.
In order to get de-obfuscated stack traces (when using R8 minification and so on) add the following to your ProGuard config file (proguard.cfg, proguard-android.txt, proguard-rules.pro, and so on).
- OkHttp3, Retrofit and Volley integration.
To capture all network calls made from your application using OkHttp3 client directly, or Retrofit using OkHttp3, or Volley using HttpURLConnection add the SSNetworkPlugin which will auto instrument for all the respective clients in the project.
Add these lines to repositories specified for downloading plugins (in buildscript)
Add the following to the dependencies block of buildscript.
Apply the plugin in the module level build.gradle.
apply plugin: "SSNetworkPlugin"
The requirements for the above Http Clients auto instrumentation are
- Android Gradle Plugin 7.1+
- Gradle version - 7.2+
Alternatively, if you want to manually instrument OkHttp clients to capture network calls made only from specific places in the code, you need to add SSEventListener as event listener when you create your OkHttpClient instance as in the following code.