How to get battery & mobile-data-usage of specific

2019-02-11 01:49发布

问题:

Background

Starting with some Android version (don't remember which), Android has the ability to show battery stats and mobile-data-usage (3G...) of the installed apps, so that the user will be aware of such a thing and will be able to think if the app should stay or not.

I'm talking about those:

The question

I've seen some apps on the play store that somehow fetch this data and show it to the user.

How do they do it?

How can I get the battery stats and mobile data usage of a specific app?

Is there a tutorial about this?

The only thing I've found is getting the status of the battery (charging/not charging,...).