2011-03-30 80 views

回答

1

所有方法(除了public static long getUidRxBytes (int uid))在TrafficStats彷彿回到UNSUPPORTED。這是一個常數值,用於指示所請求的統計信息對此設備不可用。

快速的代碼示例:

final long bytes = TrafficStats.getMobileRxBytes(); 
if (bytes != TrafficStats.UNSUPPORTED) { 
    // Supported on this device 
} else { 
    // Not supported on this device 
} 

另外值得一提的是,使用至少需要Android API Level 8