Android 流量统计方法

官方文档链接 TrafficStats

static long getMobileRxBytes()
Return number of bytes received across mobile networks since device boot.
static long getMobileRxPackets()
Return number of packets received across mobile networks since device boot.
static long getMobileTxBytes()
Return number of bytes transmitted across mobile networks since device boot.
static long getMobileTxPackets()
Return number of packets transmitted across mobile networks since device boot.

static long getTotalRxBytes()
Return number of bytes received since device boot.
static long getTotalRxPackets()
Return number of packets received since device boot.
static long getTotalTxBytes()
Return number of bytes transmitted since device boot.
static long getTotalTxPackets()
Return number of packets transmitted since device boot.

static long getUidRxBytes(int uid)
Return number of bytes received by the given UID since device boot.
static long getUidRxPackets(int uid)
Return number of packets received by the given UID since device boot.
static long getUidTxBytes(int uid)
Return number of bytes transmitted by the given UID since device boot.
static long getUidTxPackets(int uid)
Return number of packets transmitted by the given UID since device boot.
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容