Android examples for Phone:wifi
new Wifi Configuration
//package com.java2s; import android.net.wifi.WifiConfiguration; public class Main { private static WifiConfiguration newWifiConfiguration(String ssid, String preSharedKey) { WifiConfiguration wifiConfiguration = new WifiConfiguration(); wifiConfiguration.SSID = quotedString(ssid); wifiConfiguration.preSharedKey = getWPASupplicantCompatibleWirelessWPAKey(preSharedKey); wifiConfiguration.hiddenSSID = true; return wifiConfiguration; }/*w w w .ja v a2 s.co m*/ public static String quotedString(String value) { return '"' + value + '"'; } public static String getWPASupplicantCompatibleWirelessWPAKey(String key) { // android if (key == null || key.isEmpty() || key.matches("[0-9A-Fa-f]{64}")) { return key; } return quotedString(key); } }