TrafficStats函数总是返回-1函数、TrafficStats

2023-09-03 23:25:24 作者:回不到过去看不见未来丶

当我尝试使用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.