1e41f4b71Sopenharmony_ci# @ohos.enterprise.wifiManager (Wi-Fi Management) (System API)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **wifiManager** module provides APIs for Wi-Fi management of enterprise devices.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> The APIs of this module can be used only in the stage model.
10e41f4b71Sopenharmony_ci>
11e41f4b71Sopenharmony_ci> The APIs of this module can be called only by a [device administrator application](../../mdm/mdm-kit-guide.md#introduction) that is [enabled](js-apis-enterprise-adminManager-sys.md#adminmanagerenableadmin).
12e41f4b71Sopenharmony_ci>
13e41f4b71Sopenharmony_ci> This topic describes only the system APIs provided by the module. For details about its public APIs, see [@ohos.enterprise.wifiManager](js-apis-enterprise-wifiManager.md).
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Modules to Import
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci```ts
18e41f4b71Sopenharmony_ciimport { wifiManager } from '@kit.MDMKit';
19e41f4b71Sopenharmony_ci```
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci## wifiManager.isWifiActive
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciisWifiActive(admin: Want, callback: AsyncCallback<boolean>): void
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciChecks whether Wi-Fi is active through the specified device administrator application. This API uses an asynchronous callback to return the result.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**Parameters**
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci| Name     | Type                                      | Mandatory  | Description                      |
36e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | ------------------------------- |
37e41f4b71Sopenharmony_ci| admin    | [Want](../apis-ability-kit/js-apis-app-ability-want.md)     | Yes   | Device administrator application.                 |
38e41f4b71Sopenharmony_ci| callback | AsyncCallback<boolean>            | Yes   | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** indicates that Wi-Fi is active; and **false** indicates that Wi-Fi is inactive). If the operation fails, **err** is an error object.      |
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci**Error codes**
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci| ID| Error Message                                                                      |
45e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- |
46e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device.            |
47e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. |
48e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. |
49e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. |
50e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci**Example**
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci```ts
55e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit';
56e41f4b71Sopenharmony_cilet wantTemp: Want = {
57e41f4b71Sopenharmony_ci  bundleName: 'com.example.myapplication',
58e41f4b71Sopenharmony_ci  abilityName: 'EntryAbility',
59e41f4b71Sopenharmony_ci};
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ciwifiManager.isWifiActive(wantTemp, (err, result) => {
62e41f4b71Sopenharmony_ci  if (err) {
63e41f4b71Sopenharmony_ci    console.error(`Failed to query is wifi active or not. Code: ${err.code}, message: ${err.message}`);
64e41f4b71Sopenharmony_ci    return;
65e41f4b71Sopenharmony_ci  }
66e41f4b71Sopenharmony_ci  console.info(`Succeeded in query is wifi active or not, result : ${result}`);
67e41f4b71Sopenharmony_ci});
68e41f4b71Sopenharmony_ci```
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci## wifiManager.isWifiActive
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ciisWifiActive(admin: Want): Promise<boolean>
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ciChecks whether Wi-Fi is active through the specified device administrator application. This API uses a promise to return the result.
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci**Parameters**
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci| Name  | Type                                 | Mandatory  | Description     |
85e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- |
86e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci**Return value**
89e41f4b71Sopenharmony_ci
90e41f4b71Sopenharmony_ci| Type                  | Description                     |
91e41f4b71Sopenharmony_ci| --------------------- | ------------------------- |
92e41f4b71Sopenharmony_ci| Promise<boolean> | Promise used to return the result. The value **true** indicates that Wi-Fi is active, and the value **false** indicates that Wi-Fi is inactive. |
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ci**Error codes**
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci| ID| Error Message                                                                    |
99e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- |
100e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device.            |
101e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. |
102e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. |
103e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. |
104e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci**Example**
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci```ts
109e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit';
110e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
111e41f4b71Sopenharmony_cilet wantTemp: Want = {
112e41f4b71Sopenharmony_ci  bundleName: 'com.example.myapplication',
113e41f4b71Sopenharmony_ci  abilityName: 'EntryAbility',
114e41f4b71Sopenharmony_ci};
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ciwifiManager.isWifiActive(wantTemp).then((result) => {
117e41f4b71Sopenharmony_ci  console.info(`Succeeded in query is wifi active or not, result : ${result}`);
118e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
119e41f4b71Sopenharmony_ci  console.error(`Failed to query is wifi active or not. Code: ${err.code}, message: ${err.message}`);
120e41f4b71Sopenharmony_ci});
121e41f4b71Sopenharmony_ci```
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ci## wifiManager.setWifiProfile
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_cisetWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback<void>): void
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ciSets Wi-Fi profile through the specified device administrator application to enable the device to connect to the specified network. This API uses an asynchronous callback to return the result.
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci**Parameters**
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ci| Name     | Type                                      | Mandatory  | Description                      |
138e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | ------------------------------- |
139e41f4b71Sopenharmony_ci| admin    | [Want](../apis-ability-kit/js-apis-app-ability-want.md)     | Yes   | Device administrator application.                 |
140e41f4b71Sopenharmony_ci| profile    | [WifiProfile](js-apis-enterprise-wifiManager.md#wifiprofile) | Yes   | Wi-Fi profile information.                 |
141e41f4b71Sopenharmony_ci| callback | AsyncCallback<void>            | Yes   | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.     |
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci**Error codes**
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci| ID| Error Message                                                                      |
148e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- |
149e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device.            |
150e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. |
151e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. |
152e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. |
153e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ci**Example**
156e41f4b71Sopenharmony_ci
157e41f4b71Sopenharmony_ci```ts
158e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit';
159e41f4b71Sopenharmony_cilet wantTemp: Want = {
160e41f4b71Sopenharmony_ci  bundleName: 'com.example.myapplication',
161e41f4b71Sopenharmony_ci  abilityName: 'EntryAbility',
162e41f4b71Sopenharmony_ci};
163e41f4b71Sopenharmony_cilet profile: wifiManager.WifiProfile = {
164e41f4b71Sopenharmony_ci  'ssid': 'name',
165e41f4b71Sopenharmony_ci  'preSharedKey': 'passwd',
166e41f4b71Sopenharmony_ci  'securityType': wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
167e41f4b71Sopenharmony_ci};
168e41f4b71Sopenharmony_ci
169e41f4b71Sopenharmony_ciwifiManager.setWifiProfile(wantTemp, profile, (err) => {
170e41f4b71Sopenharmony_ci  if (err) {
171e41f4b71Sopenharmony_ci    console.error(`Failed to set wifi profile. Code: ${err.code}, message: ${err.message}`);
172e41f4b71Sopenharmony_ci    return;
173e41f4b71Sopenharmony_ci  }
174e41f4b71Sopenharmony_ci  console.info('Succeeded in setting wifi profile');
175e41f4b71Sopenharmony_ci});
176e41f4b71Sopenharmony_ci```
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci## wifiManager.setWifiProfile
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_cisetWifiProfile(admin: Want, profile: WifiProfile): Promise<void>
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ciSets Wi-Fi profile through the specified device administrator application to enable the device to connect to the specified network. This API uses a promise to return the result.
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci
190e41f4b71Sopenharmony_ci**Parameters**
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_ci| Name  | Type                                 | Mandatory  | Description     |
193e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- |
194e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
195e41f4b71Sopenharmony_ci| profile    | [WifiProfile](js-apis-enterprise-wifiManager.md#wifiprofile) | Yes   | Wi-Fi profile information.                 |
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ci**Return value**
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ci| Type                  | Description                     |
200e41f4b71Sopenharmony_ci| --------------------- | ------------------------- |
201e41f4b71Sopenharmony_ci| Promise<void> | Promise that returns no value. If the operation fails, an error object will be thrown.|
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci**Error codes**
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_ci| ID| Error Message                                                                    |
208e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- |
209e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device.            |
210e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. |
211e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. |
212e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. |
213e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci**Example**
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci```ts
218e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit';
219e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
220e41f4b71Sopenharmony_cilet wantTemp: Want = {
221e41f4b71Sopenharmony_ci  bundleName: 'com.example.myapplication',
222e41f4b71Sopenharmony_ci  abilityName: 'EntryAbility',
223e41f4b71Sopenharmony_ci};
224e41f4b71Sopenharmony_cilet profile: wifiManager.WifiProfile = {
225e41f4b71Sopenharmony_ci  'ssid': 'name',
226e41f4b71Sopenharmony_ci  'preSharedKey': 'passwd',
227e41f4b71Sopenharmony_ci  'securityType': wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
228e41f4b71Sopenharmony_ci};
229e41f4b71Sopenharmony_ci
230e41f4b71Sopenharmony_ciwifiManager.setWifiProfile(wantTemp, profile).then(() => {
231e41f4b71Sopenharmony_ci  console.info('Succeeded in setting wifi profile');
232e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => {
233e41f4b71Sopenharmony_ci  console.error(`Failed to set wifi profile. Code: ${err.code}, message: ${err.message}`);
234e41f4b71Sopenharmony_ci});
235e41f4b71Sopenharmony_ci```
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci## wifiManager.isWifiDisabled<sup>11+</sup>
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ciisWifiDisabled(admin: Want): boolean
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ciChecks whether Wi-Fi is disabled through the specified device administrator application.
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_WIFI
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci**System API**: This is a system API.
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_ci**Parameters**
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci| Name  | Type                                 | Mandatory  | Description     |
252e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- |
253e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes   | Device administrator application.|
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci**Return value**
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci| Type                  | Description                     |
258e41f4b71Sopenharmony_ci| --------------------- | ------------------------- |
259e41f4b71Sopenharmony_ci| boolean | Returns **true** if Wi-Fi is disabled; returns **false** otherwise.|
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci**Error codes**
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci| ID| Error Message                                                                    |
266e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- |
267e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device.            |
268e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. |
269e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. |
270e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. |
271e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci**Example**
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci```ts
276e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit';
277e41f4b71Sopenharmony_cilet wantTemp: Want = {
278e41f4b71Sopenharmony_ci  bundleName: 'com.example.myapplication',
279e41f4b71Sopenharmony_ci  abilityName: 'EntryAbility',
280e41f4b71Sopenharmony_ci};
281e41f4b71Sopenharmony_citry {
282e41f4b71Sopenharmony_ci  let result: boolean = wifiManager.isWifiDisabled(wantTemp);
283e41f4b71Sopenharmony_ci  console.info(`Succeeded in query the wifi is disabled or not, result : ${result}`);
284e41f4b71Sopenharmony_ci} catch (err) {
285e41f4b71Sopenharmony_ci  console.error(`Failed to query the wifi is disabled or not. Code: ${err.code}, message: ${err.message}`);
286e41f4b71Sopenharmony_ci};
287e41f4b71Sopenharmony_ci```
288e41f4b71Sopenharmony_ci
289e41f4b71Sopenharmony_ci## wifiManager.setWifiDisabled<sup>11+</sup>
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_cisetWifiDisabled(admin: Want, disabled: boolean): void
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ciSets the Wi-Fi policy through the specified device administrator application.
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_WIFI
296e41f4b71Sopenharmony_ci
297e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_ci**System API**: This is a system API.
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci**Parameters**
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci| Name    | Type                               | Mandatory| Description                                     |
304e41f4b71Sopenharmony_ci| ---------- | ----------------------------------- | ---- | ----------------------------------------- |
305e41f4b71Sopenharmony_ci| admin      | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes  | Device administrator application.                           |
306e41f4b71Sopenharmony_ci| disabled   | boolean                             | Yes  | Whether to disable Wi-Fi. The value **true** means to disable Wi-Fi; the value **false** means the opposite.|
307e41f4b71Sopenharmony_ci
308e41f4b71Sopenharmony_ci**Error codes**
309e41f4b71Sopenharmony_ci
310e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md).
311e41f4b71Sopenharmony_ci
312e41f4b71Sopenharmony_ci| ID| Error Message                                                    |
313e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ |
314e41f4b71Sopenharmony_ci| 9200001  | The application is not an administrator application of the device. |
315e41f4b71Sopenharmony_ci| 9200002  | The administrator application does not have permission to manage the device. |
316e41f4b71Sopenharmony_ci| 201      | Permission verification failed. The application does not have the permission required to call the API. |
317e41f4b71Sopenharmony_ci| 202      | Permission verification failed. A non-system application calls a system API. |
318e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
319e41f4b71Sopenharmony_ci
320e41f4b71Sopenharmony_ci**Example**
321e41f4b71Sopenharmony_ci
322e41f4b71Sopenharmony_ci```ts
323e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit';
324e41f4b71Sopenharmony_cilet wantTemp: Want = {
325e41f4b71Sopenharmony_ci  bundleName: 'com.example.myapplication',
326e41f4b71Sopenharmony_ci  abilityName: 'EntryAbility',
327e41f4b71Sopenharmony_ci};
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_citry {
330e41f4b71Sopenharmony_ci  wifiManager.setWifiDisabled(wantTemp, true);
331e41f4b71Sopenharmony_ci  console.info('Succeeded in set the wifi disabled');
332e41f4b71Sopenharmony_ci} catch (err) {
333e41f4b71Sopenharmony_ci  console.error(`Failed to set the wifi disabled. Code: ${err.code}, message: ${err.message}`);
334e41f4b71Sopenharmony_ci};
335e41f4b71Sopenharmony_ci```
336