gpt4 book ai didi

java - 如何获取扫描的wifi网络安全类型?在android中使用WiFi连接到特定网络所需的网络配置是什么?

转载 作者:行者123 更新时间:2023-11-30 03:06:41 24 4
gpt4 key购买 nike

我是 android 开发的新手,我正在尝试创建一个连接到可用 wifi 网络进行数据通信的应用程序。 wifi 网络配置有多种安全类型。(EX WEP 等)。如何知道哪个网络正在使用哪种安全类型?&在知道之后,如何连接到特定网络。

我搜索了很多我的问题,并找到了这个:

  1. WEP 网络要求:

    wifiConfigObj.wepKeys[0] = "\"" + networkPass + "\"";
    wifiConfigObj.wepTxKeyIndex = 0;
    wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    wifiConfigObj.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  2. EAP 网络要求:

     wifiConfigObj.preSharedKey = "\""+ networkPass +"\"";
  3. 公网要求

     wifiConfigObj.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);

但我仍然无法弄清楚。请让我知道如何度过难关。谢谢..

最佳答案

参见 ayj 在 this question 中给出的答案.

如果以后链接失效了,让我复制粘贴到这里。

您需要在 scanComplete 方法中解析 ScanResult 的功能字符串。根据Android developer documentation , :

ScanResult.capabilities describes the authentication, key management, and encryption schemes supported by the access point.

您可能能够使用——或者至少作为示例使用——AccessPointState 类中可用的静态辅助方法。

关于java - 如何获取扫描的wifi网络安全类型?在android中使用WiFi连接到特定网络所需的网络配置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21704431/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com