45. mWifiLock.acquire();// 锁定wifi
46. }
47.
48. public void rlockWifi() {
49. if (mWifiLock.isHeld()) {
50. mWifiLock.acquire();// 解锁wifi
51. }
52. }
53.
54. public void Createwifilock() {
55. mWifiLock = mWifiManager.createWifiLock("Testss");// 创建一个wifilock
56. }
57.
58. public List<WifiConfiguration> GetConfinguration() {
59. return mWifiConfiguration;// 得到配置好的网络
60. }
61.
62. public void ConnectConfiguration(int index) {
63. if (index > mWifiConfiguration.size()) {
64. return;
65. }
66. mWifiManager.enableNetwork(mWifiConfiguration.get(index).networkId, true);//连接配置好的指定ID的网络
67. }
68. public void StartScan()
69. {
70. mWifiManager.startScan();
71. //得到扫描结果
72. mWifiList = mWifiManager.getScanResults();
73. //得到配置好的网络连接
74. mWifiConfiguration = mWifiManager.getConfiguredNetworks
();
75. }
76. //得到网络列表
77. public List<ScanResult> GetWifiList()
78. {
79. return mWifiList;
80. }
81. //查看扫描结果
82. public StringBuilder LookUpScan()
83. {
84. StringBuilder stringBuilder = new StringBuilder();
85. for (int i = 0; i < mWifiList.size(); i++)