Find how much network traffic other Android apps generate -


I am trying to create a background service that should measure the traffic usage of different applications in order to be able to show the user Apps that consume most data traffic.

I found that the spare parts app is absolutely fine, but after installing it on a 1.6 Dell Streak device I always get "battery usage data not available" for "network usage." What is this function in all functions in spare parts? Also, I did not get a working source for spare parts.


Looks old or incomplete (?)

but measuring spare parts seems to per-CPU usage How does this happen on an unrooted phone?

"sys / class / net /" + sWiFiInterface + "/ statistics / rx_bytes"

According to my app, how generally traffic can be measured for each app

"sys / class / net /" + sWiFiInterface + "/ statistics / tx_bytes"

"sys / class / Net / "+ sMobileInterface +" / Statistics / Rx_byte " " sys / class / net / "+ sMobileInterface +" / statistics / tx_bytes "

files and to see which app is currently focused and thus can cause network traffic to be generated.

Unfortunately, I can not currently get an app that focuses on.

I have found this:

But it seems that the test is about not only running a 3D party service on an Android device Has been there.

We can do the activities running with ActivityManager.getCurrentTasks () , but with any of these focusing it may seem that Android architect is clear As such, the 3D party app does not want to know what the focus is on the app due to security concerns

(see).

Is there a way around this?

In addition to this, if I want to know not only what activities are traffic, but which services are also, I am currently running the ActivityManager.getCurrentSerives () and even for each if it is in foreground mode (as opposed to throwing out if Android requires resources)

Do not give any thought to you with the ActivityManager.getRunningAppProcesses call Foreground knowledge can detect application. This will return a list of RunningAppProcessInfo records. To determine which application is on the foreground check RunningAppProcessInfo.importance for field similarity, RunningAppProcessInfo.IMPORTANCE_FOREGROUND .

But be careful that the call to the ActivityManager.getRunningAppProcesses () method should not be done in the UI thread. It is called only in the background thread (for example by AsyncTask) and it will return the correct result to check for additional details.

Comments