现在我的程序可以通过wifi搜索到很多热点,包括自家的路由器,家里的路由器已经加密了。我肯定知道密码。
现在的问题是,我如何通过编程能够实现这样一个功能:1.判断家里的路由器是不是加密了
2.如果加密了当点击进行连接的时候就跳出一个对话框输入密码然后进行连接。各位大仙 大牛 这个问题困扰好久了,一直没有找到解决问题的办法。谁能指点指点??
现在的问题是,我如何通过编程能够实现这样一个功能:1.判断家里的路由器是不是加密了
2.如果加密了当点击进行连接的时候就跳出一个对话框输入密码然后进行连接。各位大仙 大牛 这个问题困扰好久了,一直没有找到解决问题的办法。谁能指点指点??
解决方案 »
- android 百度地图定位 error 167
- 公交8684的 “关于我们”界面 如何实现 ?
- GestureDetector构造器弃用
- xml问题
- android videoview oninfolistner如何监听
- 打算开始Android开发,正在下载API,有个API版本的疑问
- android中打开wifi时, 自动加载模块是如何实现的
- 使用android怎样查看错误提示信息?
- 请教AndroidManifest.xml中的Service的name和Action的name可以不一样?
- 关于Android调用GPS遇到的问题,大神请戳入
- Eclipse中为什么不能抓图
- android比较疑惑的问题
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiConfiguration wc = new WifiConfiguration();
wc.SSID = "\"SSIDName\"";
wc.preSharedKey = "\"password\"";
wc.hiddenSSID = true;
wc.status = WifiConfiguration.Status.ENABLED;
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.RSN);
int res = wifi.addNetwork(wc);
Log.d("WifiPreference", "add Network returned " + res );
boolean b = wifi.enableNetwork(res, true);
Log.d("WifiPreference", "enableNetwork returned " + b );
你懒得设置可以直接调用系统的wifi设置activity Intent it = new Intent();
it.setAction(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
// android.provider.Settings.ACTION_WIFI_SETTINGS
// android.provider.Settings.ACTION_WIFI_IP_SETTINGS
this.startActivityForResult(it,0);
1.判断家里的路由器是不是加密了????
[/Quote]
public class WifiManagerboolean startScan()
Request a scan for access points. List<ScanResult> getScanResults()
Return the results of the latest access point scan.
public class ScanResultFields
public String BSSID The address of the access point.
public String SSID The network name.
public String capabilities Describes the authentication, key management, and encryption schemes supported by the access point.
public int frequency The frequency in MHz of the channel over which the client is communicating with the access point.
public int level The detected signal level in dBm.