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.
android.process.media
is the process that is doing the network transfer for streaming media AFAIK. Even NetStat (per the one answer) should point the finger atandroid.process.media
. The same thing will hold true for other centralized network services, such asDownloadManager
. – Fabricate