在Android中如何获得移动数据信号的速度,单位为kbps ??????
TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
CellInfoGsm cellinfogsm = (CellInfoGsm)telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthGsm cellSignalStrengthGsm = cellinfogsm.getCellSignalStrength();
cellSignalStrengthGsm.getDbm();
答案 0 :(得分:1)
如果您需要找到网络速度,请按照以下链接进行操作:
http://www.gregbugaj.com/?p=47
它的作用就是你点击一个提供文本文件的网址,并根据文件大小和时间下载文件,你可以判断确切的n / w速度。
此外,如果您只想检查网络质量,可以使用以下代码:
ConnectionQuality networkQuality = ConnectionClassManager.getInstance().getCurrentBandwidthQuality();
这将返回具有以下值的ConnectionQuality枚举:
public enum ConnectionQuality {
/**
* Bandwidth under 50 kbps.
*/
WORST,
/**
* Bandwidth under 150 kbps.
*/
POOR,
/**
* Bandwidth between 150 and 550 kbps.
*/
MODERATE,
/**
* Bandwidth between 550 and 2000 kbps.
*/
GOOD,
/**
* EXCELLENT - Bandwidth over 2000 kbps.
*/
EXCELLENT,
/**
* Placeholder for unknown bandwidth. This is the initial value and will stay at this value
* if a bandwidth cannot be accurately found.
*/
UNKNOWN
}
希望这会有所帮助..