4

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

dinostroza
  • 103
  • 7
  • 1
    http://stackoverflow.com/questions/4812032/how-to-go-about-detecting-data-usage-in-the-android-env. Should give you an insight of how to do it. – Raghunandan Oct 20 '12 at 04:55
  • http://stackoverflow.com/questions/11939939/android-how-can-i-find-the-data-usage-on-per-application-basis. One more for your reference. – Raghunandan Oct 20 '12 at 04:56

1 Answers1

1

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491