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:

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, ...).
android mobile battery
android developer
source share