TrafficStats 函数总是返回 -1 [英] TrafficStats functions always return -1

查看:38
本文介绍了TrafficStats 函数总是返回 -1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 TrafficStats 类检索交通数据时,

When i try to retrieve traffic data using TrafficStats class,

TrafficStats.getTotalRxBytes()TrafficStats.getTotalTxBytes() 函数总是返回 -1,即使我使用浏览器加载一些网页.

TrafficStats.getTotalRxBytes() and TrafficStats.getTotalTxBytes() functions always return -1 even if i use the browser to load some web pages.

我从一些论坛得知 -1 表示设备不支持该操作.我使用了 WVGA、NEXUS ONE 和 NEXUS S,但问题仍然存在.

I knew from some forums that -1 mean that the device don't support the action. I used WVGA, NEXUS ONE and NEXUS S and the problem persists.

谢谢.

推荐答案

如果您使用的是模拟器,它可能无法工作.在真机上试一试.

If you are using emulator it might not work. Try on a real device.

这篇关于TrafficStats 函数总是返回 -1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆