Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the network traffic stat for video streaming applications on Android?

I am trying to write a network traffic monitor application myself. I have been using the TrafficStat to get per app network traffic stat. But for video applications like YouTube, the streamed data cannot be captured by TrafficStat. Instead, the streamed data is captured in "android.process.media". Sometimes it is captured by the total network traffic API in TrafficStat instead of the per app API. If there is just one video application, say YouTube, I can always assign the data usage captured by "android.process.media" part back to YouTube. But some people have multiple different video applications on the phone and those applications usually use the same method to stream video. Thus I cannot distinguish how much data each video app consumes.

From Android market, I found My Data Manager, which seems to correctly capture each video application's data usage. So I assume there must be a way to do it. But I have spent a lot of time searching the solutions. Not successful yet. Does anyone know how to do it?

===== Update on 02/05/2014 ====

I happened to talk to the guy who implements Android TrafficStat in a Google event. He told me that earlier versions (Gingerbread and eariler) of TrafficStat is buggy. The new ones in ICS or later should be correct. I didn't test the new versions. So use it with caution.

like image 709
user1040786 Avatar asked Nov 10 '11 23:11

user1040786


1 Answers

You can use netstat command with shell to find network statistic hope this link will help you http://en.wikipedia.org/wiki/Netstat

like image 133
Vishal Pawar Avatar answered Sep 30 '22 23:09

Vishal Pawar