Is it possible to measure Android WebView inbound/outbound traffic?
My task is to measure all network activity performed by my app. As far as I understood TrafficStats class has serious limitations. It may not work under some circumstances. And it also appeared only in API 8, whereas I have to support 7 also. So using it is an option for me only for the case when I won't find any other solution.
Note, that all other network traffic is easily measured, as it is controlled by my app. so the problem is only that part that is issued/received by WebView component.
Thanks.
Is it possible to measure Android WebView inbound/outbound traffic?
Use TrafficStats
, or use something outside of your device (e.g., some proxy server that can record this information).
As far as I understood TrafficStats class has serious limitations.
You are certainly welcome to your opinion.
And it also appeared only in API 8, whereas I have to support 7 also.
Unless you have significantly different behavior in your app specific to API Level 7, the bandwidth consumed by your WebView
probably does not change much. Set your build target to API Level 8 and use TrafficStats
on API Level 8+ devices (by means of a Build.VERSION.SDK_INT
check).