TrafficStats functions always return -1

302 Views Asked by At

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

There are 1 best solutions below

0
On

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