App performance for Android

  • Latest Dynatrace
  • Explanation

App performance monitoring provides insight into how an Android app is experienced on screen. This includes how long the app takes to become ready, which screens are shown, and how users move between them.

OneAgent for Android tracks this flow from the app start to in-app navigations between views, until the app is backgrounded or terminated.

OneAgent for Android captures the following concepts and stores them as events in Grail:

  • App Start events—measures app startup and foreground transitions.
  • Views—represent user-visible screens.
  • Navigation events—represent transitions between screens and state changes (for example, app start and app going to background).
  • View summaries—aggregated events created when a view ends, summarizing what happened while the view was visible.

These concepts follow the general mobile RUM model described in Mobile RUM Concepts. For definitions, see Application start, Views and view summaries, and Navigations.

Each event consists of well-defined key-value fields as specified in the Semantic Dictionary for user events, including app_start.*, navigation.*, and view.*.

This data can be analyzed in apps such as Experience Vitals and Users & Sessions, or queried directly in Grail using DQL.

OneAgent for Android captures startup and lifecycle information automatically by registering for Android lifecycle callbacks (via ActivityLifecycleCallbacks). Based on this information, OneAgent can automatically detect views (currently limited to activities). For fragments, Jetpack Compose screens, or other UI components, views can be captured manually using Dynatrace.startView(...).

App Start event

The App Start event measures how long it takes for an app to become ready after a startup or foreground transition.

OneAgent classifies app starts into three types: cold, warm, and hot (see Application start for definitions and examples).

On Android, classification is derived from process and Activity lifecycle signals (for example, whether the process needed to be created and whether the launching Activity is recreated).

In addition to being available as an app start event, an app start is also represented as a navigation event (a navigation without a source view).

How app start is captured

OneAgent tracks app start based on Android lifecycle callbacks, capturing a sequence of phases such as:

  • Application initialization
  • Activity.onCreate
  • Activity.onStart
  • Activity.onResume

Ensure accurate measurement

To capture the full app start duration, measurement must begin as early as possible. For auto-instrumented applications, OneAgent starts measuring in Application.onCreate. If automatic startup is disabled in the DSL or the agent is started manually, measurement begins only when the agent starts. In this case, calling Dynatrace.startup(...) as early as possible ensures accurate results. Otherwise, the reported duration may be shorter than the actual startup time.

A Navigation event represents a transition context between views, or a change in the app's visible state (see Navigations).

The Navigation event can have:

  • Source view—the view that was active before transition.
  • Current view—the view that becomes active after transition.

In the common case, the Navigation event acts as a glue event between two views.

Navigation events are generated for both automatic view tracking (activity-to-activity transitions) and manual view tracking (via Dynatrace.startView(...)).

  • App start—a navigation without a source view.
  • Visibility change to background—a navigation with a source view but no current view.

Views

In Dynatrace, a view represents a user-visible screen (see Views and view summaries).

For the field reference, see View attributes.

OneAgent tracks views automatically for activities. Other UI components can be tracked manually.

Only one view can be active at a time. Starting a new view automatically closes the previous one and triggers a navigation.

While the app is in the foreground, OneAgent for Android maintains a current view context. The view name is attached to events captured automatically (for example, web requests) and to events created via the Dynatrace APIs. This provides the screen context in which an event occurred.

Automatic view tracking

For activities, OneAgent captures views based on lifecycle callbacks:

  • A view starts when an activity enters onResume.
  • A view ends when an activity enters onPause.

Manual view tracking

For UI components that are not auto-detected (such as fragments, Jetpack Compose screens, or custom views), use Dynatrace.startView(...):

Dynatrace.startView("Login")

Calling startView starts a new view and automatically ends the previously active view.

View summary

When a view ends, OneAgent creates a view summary, an aggregated event summarizing what happened during the view's lifetime (see Views and view summaries). View summaries are reported separately from other events.

  • Start time—when the view started.
  • Duration—how long the view was active.
  • Error counts—the number of reported errors, request errors, and exceptions that occurred while the view was active. For the field reference, see View summary.
Related tags
Digital Experience