My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 19938: The TrafficStats API, TrafficStats.getMobileRxBytes() and TrafficStats.getMobileTxBytes() seem to be broken on Android 3.0.1 (I am using Galaxy Tab 10.1).
28 people starred this issue and may be notified of changes. Back to list
Status:  Assigned
Owner:  jshar...@android.com


Sign in to add a comment
 
Reported by newtux2...@gmail.com, Sep 9, 2011
The TrafficStats API, TrafficStats.getMobileRxBytes() and TrafficStats.getMobileTxBytes() seem to be broken on Android 3.0.1 (I am using Galaxy Tab 10.1). 

TrafficStats.getMobileRxBytes() and TrafficStats.getMobileTxBytes() are used to monitor the data received and sent by the device over a cellular network. The values returned by these APIs are expected to increment as the device receives and sends data and reset only after a phone reboot. 

The behavior on my Android 2.2 and 2.3 phone is as expected, the values returned by TrafficStats.getMobileRxBytes() and TrafficStats.getMobileTxBytes() keep increasing as the devices receives and sends cellular data. 

However, on Android 3.0.1 (on my tablet), the values returned by TrafficStats.getMobileRxBytes() and TrafficStats.getMobileTxBytes() reset very frequently. This makes it impossible to monitor the cellular data consumption of the tablet.

My Device Details are as follows:
--------------------------------

Model: Samsung Galaxy Tablet 10.1
Model Number: GT-P7100
Android Version: 3.0.1
Kernel Version: 2.6.36.3-00558-g7c1c334 
                se.infra@SEI-29#1]
Build number: HRI83.BUKD9

Sep 9, 2011
Project Member #1 marc...@google.com
 Issue 19939  has been merged into this issue.
Sep 9, 2011
Project Member #2 marc...@google.com
 Issue 19937  has been merged into this issue.
Sep 14, 2011
Project Member #3 jshar...@android.com
(No comment was entered for this change.)
Owner: jshar...@android.com
Nov 1, 2011
#4 kevin.di...@gmail.com
Same issue observed on Galaxy Tab 10.1 running Android 3.1. I also tried polling the "/sys/class/net/rmnet0/statistics/rx_bytes" file and observed the same behavior where the value resets frequently.
Jan 29, 2012
Project Member #5 jshar...@android.com
 Issue 16989  has been merged into this issue.
Jan 29, 2012
Project Member #6 jshar...@android.com
Tracked as 5317395 in buganizer.
Status: Reviewed
Feb 8, 2012
#7 janfre...@googlemail.com
I am facing similar issues since update from 2.2 to 2.3.6 ...
Values returned by TrafficStats.getMobileRxBytes() and TrafficStats.getMobileTxBytes() are reset very frequently (I've got the feeling these are reset whenever moving from 3G to WiFi and vice versa for example, but can't confirm for sure) and all traffic counting apps (e.g. 3G Watchdog, Net counter, FreeStats, ..) stopped working.
Feb 26, 2012
#8 alexandr...@gmail.com
Dear google. Any esimation when this can be fixed?
Feb 27, 2012
#9 rudilu...@gmail.com
I seem to have the same issue exactly on a Galaxy Ace GT-S5830 running Android 2.2.1. The mobile counts are reset when I move from 3G to Wifi i.e. when I connect to wifi. It doesn't seem to just be enabling wifi, but actually connecting that does it.
Mar 1, 2012
#10 rudilu...@gmail.com
Also, as far as i can tell, when switching from 3G to Wifi, not only are the mobile counts reset to zero, but the total counts are reduced (rather than simply resetting to zero), maybe to erroneously try to compensate for the now zeroed mobile counts. Or, I suppose it is possible the total counts are computed by adding the mobile count to some "hidden" wifi count, so when the mobile count is reduced to zero the total count just automatically goes down. It is all very frustrating if one is trying to compute data transferred over a time period by remembering counts at the start, since the reset counts can be less than the start ones.

Another frustrating issue is that on power off the counts are reset to zero before one can respond to a android.intent.action.ACTION_SHUTDOWN intent, so one also loses data then
Jun 19, 2013
#11 jbq@android.com
(No comment was entered for this change.)
Status: Assigned
Sign in to add a comment

Powered by Google Project Hosting