安卓App流量统计
http://keepcleargas.bitbucket.org/2013/10/12/android-App-Traffic.html 安卓App流量统计 12 OCT 2013 android流量简介 流量统计文件 :路径 /proc/net/dev 如上图: lo 为本地流量, rmnet0 为3g/2g流量, wlan0 为无线流量. 在 /sys/class/net/ 下 可以找到相关类别(如rmnet0)的目录.在其子目录statistics下游rx bytes和tx bytes记录收发流量. 在 /proc/uid_stat/{uid}/tcp_rcv 记录该uid应用下载流量字节, /proc/uid_stat/{uid}/tcp_snd 有该uid应用上传流量字节 TrafficStats学习 TrafficStats google develop文档 TrafficStats 源文件 查看 重要API: static long getMobileRxBytes () //获取通过Mobile连接收到的字节总数,不包含WiFi static long getMobileRxPackets () //获取Mobile连接收到的数据包总数 static long getMobileTxBytes () //Mobile发送的总字节数 static long