如何知道任何数据下载进展在我的Andr​​oid设备 [英] How to know that any data download is progressing over my android device

查看:82
本文介绍了如何知道任何数据下载进展在我的Andr​​oid设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑的一首歌是越来越通过任何其他应用程序下载量超过我的Andr​​oid设备。
或应用程序正从市场下载。在这个阶段,我的设备使用移动网络。

Consider a song is getting downloaded over my android device via any other application. Or an application is getting downloaded from market. At this stage my device is using mobile network.

我们可以写code它会告诉下载数据是从连接的网络的进步。

Can we write code which will tell data download is in progress from connected network.

使用 ConnectivityManager 我可以得到所有活动的网络列表。我可以得到连接的网络的名称为好。

Using ConnectivityManager I can get all active network list. I can get the connected network name as well.

时的连接方式流已经准备好做任何数据传输或数据在传输?

Is connected means streams are ready to do any data transmission or data is transmitting?

如何知道时间数据越来越下载或不?

How to know at time data is getting downloaded or not?

推荐答案

android.net.TrafficStats (因为API级别8)提供您正在寻找的值。通过价值观的定期监测,你可以推断一些有关你的进展(但不分开,如果其他网络通信还没有任何并行)歌曲下载。

Class android.net.TrafficStats (since API level 8) provides values you are looking for. Via periodic monitoring of values you may conclude something about progress of your (but not separately, if other network communication is pending in parallel) song download.

更新:

由于API 12级,你可以从同一类更详细的信息。已经增添了许多实用的新功能。

Since API level 12 you can get much more detailed info from the same class. A number of useful new functions has been added.

这篇关于如何知道任何数据下载进展在我的Andr​​oid设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆