facebookarchive / network-connection-class

Listen to current network traffic in the app and categorize the quality of the network.
Other
3.19k stars 515 forks source link

The library doesn't listen to the existing internet traffic done by a specific app #20

Open xardox69 opened 8 years ago

xardox69 commented 8 years ago

Hi, Checking out 1.0.1 release branch. In DeviceBandwidthSampler.java line 92 long newBytes = TrafficStats.getTotalRxBytes();

This method returns number of bytes received since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot.

It is not app specific as there might be another background task or sync service running/started by another app at the same time.

SimonMarquis commented 8 years ago

@xardox69 I think this is done on purpose. Using getUidRxBytes() will indeed return the value for a specific uid, but what you really want is to monitor the "system wide" network quality.