Skip to content

Most visited

Recently visited

added in API level 24

The package contains a set of classes to provide data to track the system resources of applications.

Applications running in the background are responsible for a significant amount of battery usage on a typical android device. There are several things that applications can do in order to reduce their impact. For example, by using JobScheduler, an application does not need to independently monitor whether the network is available, whether the device is plugged in, etc. In addition to being simpler to use, the application's services are only started when the required conditions have been met. But even when using the appropriate helper APIs, applications still can reduce their footprint. This package provides more insight into what is going on behind the scenes when an application is running.

Application data is tracked by which user id (uid) is using particular resources. A snapshot of an application's measurements can be taken with the SystemHealth.takeMyUidSnapshot() method. The HealthStats object returned contains the statistics.

In order to be returned efficiently, the HealthStats class uses a set of int keys to identify the data returned. The UidHealthStats, PidHealthStats, PackageHealthStats , ProcessHealthStats, and ServiceHealthStats classes provide those constants. Each HealthStats object will be associated with exactly one of those classes. The object returned from SystemHealth.takeMyUidSnapshot() will be using the UidHealthStats keys, as it contains all of the data available for that uid.


HealthStats A HealthStats object contains system health data about an application. 
PackageHealthStats Keys for HealthStats returned from HealthStats.getStats(int) with the UidHealthStats.STATS_PACKAGES key. 
PidHealthStats Keys for HealthStats returned from HealthStats.getStats(int) with the UidHealthStats.STATS_PIDS key. 
ProcessHealthStats Keys for HealthStats returned from HealthStats.getStats(int) with the UidHealthStats.STATS_PROCESSES key. 
ServiceHealthStats Keys for HealthStats returned from HealthStats.getStats(int) with the PackageHealthStats.STATS_SERVICES key. 
SystemHealthManager Provides access to data about how various system resources are used by applications. 
TimerStat A TimerStat object stores a count and a time. 
UidHealthStats Keys for HealthStats returned from SystemHealthManager.takeUidSnapshot(int), SystemHealthManager.takeMyUidSnapshot(), and SystemHealthManager.takeUidSnapshots(int[])
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)