我建立一个应用程序读取每个可用的WiFi接入点的信号强度。
I am building an application reading the signal strength of each available Wifi access point.
我已经写了code这样的:
I've written code like:
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
// Get WiFi status
WifiInfo info = wifi.getConnectionInfo();
textStatus.append("\n\nWiFi Status: " + info.toString());
// List available networks
List<WifiConfiguration> configs = wifi.getConfiguredNetworks();
不过,我有两个问题:
However, I have two problems:
在调试时,的configs
只包含一个连接。不过,我可以看到,有系统的WiFi设置几个可用的接入点。即的configs
是一个不完整的清单。
In debugging, configs
only contains one connection. However, I can see that there are several APs available in the system's wifi setting. I.e. configs
is an incomplete list.
我不知道如何获得的信号强度在 WifiConfiguration
。
I don't know how to get the signal strength in WifiConfiguration
.
顺便说一句,我使用的HTC Hero和Android 1.5。
btw, I am using HTC Hero and Android 1.5.
根据Android的API文档WifiManager.getConfiguredNetworks()不填写的信号强度paramters。此数据仅重presents记住的接入点设置,不可见的。
According to the Android API documentation WifiManager.getConfiguredNetworks() does not fill the signal strength paramters. This data only represents the remembered access point settings, not the visible ones.
要获得实际可见的网络,你必须调用WifiManager.startScan()启动WiFi无线电扫描和WifiManager.getScanResults()一段时间后获得的扫描效果。
To get actually visible networks you must call WifiManager.startScan() to initiate WiFi radio scanning and WifiManager.getScanResults() after a while to get the scanning results.
上一篇:在ACTION_VIEW意图显示图像?意图、图像、ACTION_VIEW
下一篇:如何使用setOutlineProvider代替setOutline在棒棒糖棒棒糖、如何使用、setOutlineProvider、setOutline