TrafficStats functions always return -1

2019-03-03 12:52发布

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条回答
smile是对你的礼貌
2楼-- · 2019-03-03 13:26

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

查看更多
登录 后发表回答