Network traffic monitoring per android application

喜夏-厌秋 提交于 2019-12-06 04:06:11

问题


I was wondering if I can do network traffic monitoring per android application?

Basically see which app is receiving/sending how much data?

I know there are many apps which already do that but I want to know how to do it.


回答1:


Well you surely can. A very simple way is to use the TrafficStats class. It can manage per app (more formally, per UID) But the problem is, it can return UNSUPPORTED. When this happens, I don't think you will have some easy (i.e. using the high level Java language) method to get the network traffic data you need.




回答2:


Not sure if it can be implemented in Java as I imagine you need to access some low-level Operating system functions which are just not available in Java (but don't quote me on this!).

The obvious way I see of doing this is through C language and the Android Native Development Kit.



来源:https://stackoverflow.com/questions/7181045/network-traffic-monitoring-per-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!