Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

As per my question above... does the data usage that came into existence in ICS count uploads as well as downloads?

share|improve this question
add comment

1 Answer

Yes, there's an API for that (the class is android.net.TrafficStats). It was added with API level 8 (Android 2.2).

As you can see below, it offers both Rx and Tx bytes in total, only accounting mobile or per app (added in API level 14, note that with an equal UID count as one). This is an excerpt, see the link below for all methods.

static long getMobileRxBytes()
static long getMobileTxBytes()
static long getTotalRxBytes()
static long getTotalTxBytes()
static long getUidRxBytes(int uid)
static long getUidTxBytes(int uid)
...

API-Source: http://developer.android.com/reference/android/net/TrafficStats.html

Implementation for the "data usage" view: here

final long foregroundBytes = entry.rxBytes + entry.txBytes;

PS: The carriers also count UDP traffic that just leaves their end but never arrives, such as rtp streams where the phone loses the carrier but the whole video gets streamed anyway.

share|improve this answer
    
What does the Data usage view in the Settings app display? Total volume, or just download? –  vsp Jan 9 at 9:57
    
rxBytes+txBytes. I.e., the sum of download (rx = receive) + upload (tx = transmit). –  ce4 Jan 12 at 19:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.