Android 设置wifi连接应用开发
来源:互联网 发布:怎样才可以成为程序员 编辑:程序博客网 时间:2024/05/21 04:21
言简意赅的说吧。设置androidwifi连接,
1.new 一个wificonfiguration对象。
2.设置这个对象的一些属性。
- WifiConfiguration wc = new WifiConfiguration();
- wc.SSID = "\""+sr.SSID+"\""; //<span style="color: rgb(255, 0, 0); ">这个地方一定要注意了。旁边的“是不能够省略的。密码的地方也一样。</span>
- wc.preSharedKey = "\""+etPassword.getText().toString()+"\""; //该热点的密码
- wc.hiddenSSID = true;
- wc.status = WifiConfiguration.Status.ENABLED;
- wc.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
- wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
- wc.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
- wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
- wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
- wc.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
- wc.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
3.判断wifi是否加密:
- public static int getSecurity(ScanResult result) {
- if (result.capabilities.contains("WEP")) {
- return 1;
- } else if (result.capabilities.contains("PSK")) {
- return 2;
- } else if (result.capabilities.contains("EAP")) {
- return 3;
- }
- return 0;
- }
4.连接未加密wifi连接:
- <pre name="code" class="java">WifiConfiguration config = new WifiConfiguration();
- config.SSID = "\"" + sr.SSID + "\"";
- config.allowedKeyManagement.set(KeyMgmt.NONE);
- int networkId = wifiManager.addNetwork(config);
- if(networkId != -1){
- wifiManager.enableNetwork(networkId, false);
- wifiManager.saveConfiguration();
- }
- Android 设置wifi连接应用开发
- android WIFI连接开发
- android WIFI连接开发
- android WIFI连接开发
- android WIFI连接开发
- android WIFI连接开发
- android wifi连接开发
- android WIFI连接开发
- android WIFI连接开发
- android开发--WIFI应用开发
- Android WIFI连接开发 WIFI工具类
- android wifi开发 连接wifi 创建AP
- android wifi连接开发实例
- android wifi连接开发实例
- android wifi连接开发实例
- android wifi连接开发实例
- 【Android开发】wifi开关与wifi连接(密码连接)
- 打开android系统设置,连接wifi
- 达到一个目标投资组合的价值
- 转 -- Zynga:从Amazon公共云到zCloud私有云
- 使用Iperf工具测试android系统网络wifi的吞吐量wifithrougput
- 个人学习网址
- js 类型转换
- Android 设置wifi连接应用开发
- Flex 资源帖
- [ASP.NET]为什么CustomValidator验证控件在验证DropdownList的时候不能设置ControlToValidate属性
- javassist 编译器字节码增强
- 查找所有嵌套iframe
- 如何与猎头打交道?坚持八“不”原则
- VB.NET 使用其他用户启动程序
- the cause of the delegate why use assign
- 几种MFC对话框的隐藏方法