Is it possible to collect the amount of data spent over a period of time?

1

I'm making an Android application and I need to pick up the amount of data the person uses in a specific time period, in Androids that use the level 21 (lollipop) APIs up to the current (Nougat) API.

I searched and found two classes, one of them is the TrafficStats that through it I can take all the amount of data spent since the boot of the phone, that is, every time the phone is turned off and turned on the value returned goes to zero, this class is supported by the 21+ (lollipop) APIs. So to make the collection correctly my app would always need to get worked up which does not always happen because the user can choose to close it.

The other class is NetworkStatsManager that does exactly what I need, but only works for APIs 23+ (Marshmallow).

So, is there any other class or tool I can use that works similar to NetworkStatsManager but is compatible with older versions of Android?

    
asked by anonymous 23.09.2016 / 19:24

0 answers