recived = TrafficStats.getUidRxBytes(uid);
send = TrafficStats.getUidTxBytes(uid);
TrafficStats.getMobileRxBytes();
TrafficStats.getMobileTxBytes();
TrafficStats.getTotalRxBytes();
TrafficStats.getTotalTxBytes();
我有应用程序 ID,我可以获得该应用程序的数据使用情况,但我无法获得更详细的信息,例如使用 wifi 和网络的数据使用情况。我想为设备中所有已安装的应用程序分别找到两者。我怎样才能找到它?我已经尝试了很多东西,但没有得到任何解决方案。
最佳答案
我认为你应该使用其他方式,通过 UID 获取流量,例如 — getUidRxPackets(int uid)
也有帮助(如何获取 UID):( How to get all apps installed on android phone )
编辑:
can you tell me how i can determine how much data use by wifi and mobile.??
有一个很好的答案 — android statistic 3g traffic for each APP, how?看看他的逻辑。
关于android - 如何通过android中的特定应用程序分别查找wifi和网络数据使用情况?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20028124/