Adjust OneAgent configuration via Dynatrace Android Gradle plugin

The following configuration options can be used to modify the default configuration of the OneAgent. They are especially useful when used along with the automatic OneAgent startup feature.

They can also be used to adjust the OneAgent configuration when the manual startup approach is approached. In this case, you have to be careful because these settings might get overridden with the ConfigurationBuilder.

Change data privacy settings (opt-in mode)

With user opt-in mode, each user of your application can set their data privacy preferences and decide whether they want or don't want to share their information. When the opt-in mode is enabled, you need to ask each user for permission to capture their data; then, you store their data privacy preferences. For details, see User opt-in mode.

To activate the user opt-in mode (when you use the automatic OneAgent startup), enable the userOptIn property.

Use the OneAgent SDK to change user's data privacy preferences.

Configure hybrid applications

For hybrid applications, the native mobile app is monitored via OneAgent, while the browser part is observed by the Dynatrace RUM JavaScript. For this reason, hybrid application monitoring requires some additional configuration. See Instrument hybrid apps for more information.

All properties related to hybrid application monitoring are part of HybridWebView DSL, so configure them via the hybridWebView block.

Enable hybrid application monitoring

You can activate the hybrid application monitoring feature with the enabled property.

Specify domains, hostnames, and IP addresses

For hybrid applications that use the RUM JavaScript inside WebView, OneAgent must set cookies for each instrumented domain or server your application communicates with. When the hybrid application monitoring feature is enabled, OneAgent generates these cookies for every specified domain and stores them in the CookieManager. Dynatrace uses these cookies to identify mobile and web sessions within your application and merge these sessions into the same "hybrid" session.

To specify your domains, hostnames, and IP addresses, use either the domains or the httpsDomains property. Domains and subdomains must start with a period (.).

domains property

httpsDomains property

If you use the httpsDomains property, the Secure cookie attribute is added for all cookies that Dynatrace sets. This ensures that the browser sends these cookies only over secure connections.

Disable cookies for file domains

Dynatrace Android Gradle plugin version 8.271+

To set cookies for file domains (starting with file://), Dynatrace uses setAcceptFileSchemeCookies. However, this API is no longer recommended because of security issues; we plan to stop adding cookies to file scheme domains in a couple of months.

If you want to secure your application right now, set fileDomainCookies to false, and Dynatrace won't add cookies to file scheme domains.

Enable load balancing

OneAgent allows you to enable client-side load balancing that helps avoid unbalanced load on the server when multiple OneAgents simultaneously establish a connection to the ActiveGate.