我想编写代码,让我有时间从 Internet 下载文件(特别是应用程序)。更具体地说,我想知道上次下载的应用程序的下载速度。
所以我想找到下载的时间,然后将文件大小除以时间,我会得到速度。
谁能帮我找出从互联网下载文件所需的时间。
我想编写代码,让我有时间从 Internet 下载文件(特别是应用程序)。更具体地说,我想知道上次下载的应用程序的下载速度。
所以我想找到下载的时间,然后将文件大小除以时间,我会得到速度。
谁能帮我找出从互联网下载文件所需的时间。
I think you should have a look at TrafficStats
class in Android
which :
Class that provides network traffic statistics. These statistics include bytes transmitted and received and network packets transmitted and received, over all interfaces, over the mobile interface, and on a per-UID basis.
I did not used this class, but I think it can do what you are trying to achieve.