How to get the use of battery and mobile data for specific applications?

Background

Starting with some versions of Android (donโ€™t remember which ones), Android has the ability to show battery statistics and the use of mobile data (3G ...) of installed applications, so that the user will know about such a thing and will be able to think whether the application should remain or not.

I am talking about those:

enter image description here

Question

I saw some applications in the playback store that somehow extract this data and show it to the user.

How do they do it?

How can I get battery statistics and mobile data usage in a specific application?

Is there a lesson about this?

The only thing I found is to get the battery status (charging / charging, ...).

+3
android mobile battery
source share

No one has answered this question yet.

See similar questions:

10
What is the intention for the settings - using data
7
Build Battery Use Android App
4
android dumpsys batteryinfo vs android dumpsys batterystats

or similar:

313
Does Android support almost real-time push notification?
242
Data Sync Between Android Application and Web Server
71
Is the Android application to remove the battery?
2
How to get a processor or battery usage for an application in a specific time
2
Using the battery for Android - Details
one
Battery usage for applications continues to grow at a constant rate, even if the application is closed and power is stopped
one
How to extract battery usage data using recovery or something else
one
Google Play Services Battery Drain Android App
0
Android App: Reduce Battery Consumption

All Articles