Overview

The ProfilingManager API lets you collect real-user performance profiles, such as system traces and Java heap dumps, from production devices running Android 15 (API level 35) and higher. It supports two collection mechanisms: app-driven profiles where your app controls the profile collection from start to stop (Android 15 and higher) and trigger-based profiles where the system handles the capture in response to events that you register interest in on Android 16 (API level 36) and higher.

This guide covers the following topics:

Supported profile types

ProfilingManager supports collecting several types of profiles so you can target specific performance concerns in your app. You can configure requests directly using platform APIs or using the AndroidX Core builders:

Integrate ProfilingManager with an AI agent

You can use an AI coding agent to integrate ProfilingManager into your app. For example, run the following prompt in your AI coding agent to set up Application Not Responding (ANR) trigger collection, replacing </path/to/codebase> with the path to your app:

Read https://developer.android.com/topic/performance/tracing/profiling-manager/trigger-based-capture
and https://developer.android.com/topic/performance/tracing/profiling-manager/upload-worker
and integrate ProfilingManager ANR trigger collection (TRIGGER_TYPE_ANR) into my
app at </path/to/codebase>, including registering the result listener after app
startup completes and scheduling a WorkManager upload job when a profile is
received.

You can adapt this prompt to set up other system triggers (such as TRIGGER_TYPE_OOM), or configure app-driven profile captures using the app-driven profiling guide. After integrating, test your setup locally using the debug commands for local profiling, and analyze collected profiles with an AI agent.