以编程方式获取wifi/移动网络的数据速度 [英] Getting data speed of wifi/mobile network programmatically

查看:119
本文介绍了以编程方式获取wifi/移动网络的数据速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的应用程序中以编程方式获得wifi/移动网络的数据速度.

How do I get the data speed of wifi/mobile network programmatically in my application.

推荐答案

以下是获取WiFi速度的代码:

Here's the code for getting the WiFi speed:

WifiManager wifiManager = getApplicationContext().getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if (wifiInfo != null) {
    Integer linkSpeed = wifiInfo.getLinkSpeed(); //measured using WifiInfo.LINK_SPEED_UNITS
}

有关移动网络速度,请参见以下链接:

For mobile network speed, refer to the below link:

http://www.gregbugaj.com/?p=47

这篇关于以编程方式获取wifi/移动网络的数据速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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