As per my question above... does the data usage that came into existence in ICS count uploads as well as downloads?
Selon ma question ci-dessus ... L'utilisation des données qui est venue dans l'existence dans ICS comptent les téléchargements ainsi que les téléchargements?
As per my question above... does the data usage that came into existence in ICS count uploads as well as downloads?
Oui, il y a une API pour cela (la classe est android.net.TrafficStats
). Il a été ajouté avec API Niveau 8 (Android 2.2).
Comme vous pouvez le voir ci-dessous, il offre des octets RX et TX au total, uniquement sur mobile comptable ou par application (ajouté au niveau API 14, noter qu'avec un nombre égal de l'UID en tant que). Ceci est un extrait, voir le lien ci-dessous pour toutes les méthodes.
statique longue getmobilerxbytes ()
statique longue getmobiletxbytes ()
statique longue gettotalrxbytes ()
statique longue gettotaltxbytes ()
statique longue getuidrxbytes (int uid)
statique longue getuidtxbytes (int uid)
...
API-Source: http://developer.android.com/reference/ Android / Net / Trafficstats.html
implémentation de la vue "Data USage": ici
final long foregroundBytes = entry.rxBytes + entry.txBytes;
PS: Les transporteurs comptent également le trafic UDP qui quitte leur fin, mais n'arrivent jamais, tels que les flux RTP où le téléphone perd le transporteur mais toute la vidéo est diffusée de toute façon.
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.
© 2022 www.demandez.top All Rights Reserved. Questions et réponses Accueil Tous les droits sont réservés