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

Upload speed #27

Open arianaa30 opened 8 years ago

arianaa30 commented 8 years ago

Hi, Nice API. Can I use it to sample upload speed as well? Actually I want to use it to profile download speed, upload speed, along with time stamp and GPS info and save to a .csv file. Does it allow me enough flexibility to do that?

zlern2k commented 8 years ago

You would need to modify DeviceBandwidthStats to read TrafficStats.getTotalTxBytes in addition to getTotalRxBytes (and store that in a separate counter). Timestamp should be obvious but GPS is out of scope of this library. Note that the strategy of this library is passive -- if your app isn't consuming data, it won't be updating any estimates.

arianaa30 commented 8 years ago

Thanks. But what do you mean of Passive? All the file upload and file download process is there, so I will only getTotalBytes and divide it by the time elapsed?! Isn't there any simpler ways? Basically speed data are being shown on the UI. Maybe I can just store them?