如何获得的WiFi接入点的连接强度? [英] How to get the connection strength of Wifi access points?

查看:190
本文介绍了如何获得的WiFi接入点的连接强度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个应用程序读取每个可用的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:

  1. 在调试时,的configs 只包含一个连接。不过,我可以看到,有系统的WiFi设置几个可用的接入点。即的configs 是一个不完整的清单。

  1. 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文档<一href="http://developer.android.com/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks%28%29">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.

要获得实际可见的网络,你必须调用<一href="http://developer.android.com/reference/android/net/wifi/WifiManager.html#startScan%28%29">WifiManager.startScan()启动WiFi无线电扫描和<一href="http://developer.android.com/reference/android/net/wifi/WifiManager.html#getScanResults%28%29">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.

这篇关于如何获得的WiFi接入点的连接强度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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