I would like to be able to detect all forms of data usage using the Android environment. Is it possible to keep tabs on which applications call on say RTP vs WAP, etc. such that I can know at all times when data is being used by a native program or third-party app?
If you are talking about an Android API to monitor network statistics by application then such an API seems to have been added in Android 2.2 (Froyo).
The main class you'll need is TrafficStats.
You can use getUid{Rx|Tx}Bytes(int uid)
for the given process user ID (which you can get from ActivityManager.getRunningAppProcesses()
).
The API is very simple and simply gives you the total bytes received/sent, so you'll have to do some more work to keep track of hourly, daily, and monthly stats. Well, that all depends on your needs.
I haven't tried using it myself, so I cannot give you any more detail, nor do I know the supported devices (not all devices will support this as the API points out).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With