TrafficStats functions always return -1

大城市里の小女人 提交于 2019-12-02 19:43:58

问题


When i try to retrieve traffic data using TrafficStats class,

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

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.

Thank you.


回答1:


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



来源:https://stackoverflow.com/questions/21330735/trafficstats-functions-always-return-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!