Question

I'm developing an application that measure the data traffic recived through mobile data interface (no wifi) from all processes. Additionally this counter have to be related to a date range, i.e. betheen March 1 and April 1.

I had read about TrafficStats class, but in the documentation doesn't mentioned any about from when are the stats.

This is my first question and I really appreciate your help.

Thanks

Était-ce utile?

La solution

I had read about TrafficStats class, but in the documentation doesn't mentioned any about from when are the stats.

"From when" should not matter to you. Take a reading at a point in time, take another reading at a later point in time, and the difference between the two is the bandwidth consumed between those two points in time.

Additionally this counter have to be related to a date range, i.e. betheen March 1 and April 1.

You would need to handle this yourself, most likely, checking for the amount of bandwidth consumption every so often (e.g., every 4 hours via AlarmManager), storing the results in a database, and then using that information to determine the bandwidth consumed over extended periods of time.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top