問題描述
如何按時間從android獲取trafficStats信息? (How to get trafficStats information from android by time?)
有沒有辦法從某個日期獲取 trafficStats?例如從上個月開始。
我正在使用這個 獲取 wifi 流量統計信息android 並且從代碼中您可以看到,該文件中只有流量的數值,但例如在 DroidStats 應用程序中,數據是從最後一天/一個月等開始計算的。
還有當我重新啟動手機或搞亂網絡設置時總是 0
參考解法
方法 1:
Is there a way how to get trafficStats from some date? For example from last month.
You would have had to have been running last month, collected the data yourself, and saved it to a database or something. TrafficStats
does not have any history. It only reports current cumulative values, except for resets (e.g., reboots).
Also value is always 0 when i reboot my phone
Correct. This is working as intended.
do i have to store this data myself if i don´t want to lose them?
Yes.
(by Blackess、CommonsWare)