De acordo com a minha pergunta acima ... O uso de dados que se tornou a existência em uploads de contagem do ICS, bem como downloads?
De acordo com a minha pergunta acima ... O uso de dados que se tornou a existência em uploads de contagem do ICS, bem como downloads?
As per my question above... does the data usage that came into existence in ICS count uploads as well as downloads?
Sim, há uma API para isso (a classe é android.net.TrafficStats ). Foi adicionado com a API Nível 8 (Android 2.2).
Como você pode ver abaixo, ele oferece bytes rx e tx no total, somente contabilidade móvel ou por aplicativo (adicionado no nível da API 14, observe que com uma contagem de UID igual a uma). Este é um trecho, veja o link abaixo para todos os métodos.
.Longa estática getmobilerxbytes ()
Longa estática getmobileetxbytes ()
Longa estática gettotalrxbytes ()
Longa estática gettotaltxbytes ()
Longa estática GetuidRxbytes (int UID)
Longa estática GetuidtxBytes (int UID)
...
API-Fonte: http://developer.android.com/reference/ android / net / trafficstats.html
Implementação para o "Uso de dados" Ver: aqui
final long foregroundBytes = entry.rxBytes + entry.txBytes; PS: As transportadoras também contam o tráfego UDP que apenas deixa o fim, mas nunca chega, como fluxos RTP onde o telefone perde a transportadora, mas todo o vídeo é transmitido de qualquer maneira.
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 pergunte.org All Rights Reserved. Casa de perguntas e respostas todos os direitos reservados