Android 在变化时获取 WiFi 信号强度

标签 android android-wifi rssi

我想了解我所连接的 WiFi 网络的信号强度,因为它会发生变化。 这是我的广播接收器

     registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            int info = Wifi.getConnectionInfo().getRssi();
            textStatus.append("\n\n : " + Integer.toString(info));
        }
    }, new IntentFilter(WifiManager.RSSI_CHANGED_ACTION));

我只得到一次。我如何在它发生变化时得到它?

最佳答案

更新:根据 Android 4.4 和 5.0 中的测试,连续 WiFi 扫描之间的间隔似乎不到一秒。您可以在此处查看我使用 Android 设备进行 RF 测量的演示:

https://github.com/panosvas/Measurements

您可以在其中找到一个接一个 WiFi 测量的实现。我还创建了一个用于存储这些测量值的服务器以及一个使用 UDP 数据包的远程触发应用程序,您可以在此处找到:

https://github.com/panosvas/IndoorPositioningServer

实际上,您不能在每次更改时都获取 RSSI,因为 RSSI 值可能会在几毫秒甚至更快的时间内发生变化,Android 中的每次 wifi 测量大约需要 5 秒,具体取决于设备。

那么,您在以下帖子中建议我的回答是什么:

Wifi Scanner which scans 20 times

How to update wifi RSSI values without a click button

关于Android 在变化时获取 WiFi 信号强度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24053048/

相关文章:

android - iOS 或 Android 上的 WebKit 开发中的陷阱/错误

java - Google Play 游戏实时多人游戏 : How to get the participant id of the current user?

android - 如何通过wifi查找设备的IP地址?

android - ScanResult 能力解读

android - 与 Wifi Direct 的 p2p 连接中的信号强度?

android - 在华为设备上设置默认 Android 启动器?

android - Android BigPictureStyle 推送通知中的图像/位图大小应该是多少?

java - 连续 WifiManager 扫描获得重复的扫描结果

Swift - 将 RSSI 转换为距离

javascript - Node.js 卡尔曼滤波器一维