> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
## Modules to Import
```
```
import account_distributedAccount from '@ohos.account.distributedAccount';
import account_distributedAccount from '@ohos.account.distributedAccount';
| [DistributedAccountAbility](#distributedaccountability) | **DistributedAccountAbility** instance obtained. This instance provides methods for querying and updating the login state of a distributed account.|
<td class="cellrowborder" valign="top" width="79.95%" headers="mcps1.1.3.1.2 "><p id="p108356521449"><a name="p108356521449"></a><a name="p108356521449"></a>Instance that provides methods for querying and updating the login state of a distributed account.</p>
Provides methods for querying and updating the login state of a distributed account. You must obtain a **DistributedAccountAbility** instance first.
Provides methods for querying and updating the login state of a distributed account. \(You must obtain a **DistributedAccountAbility** instance first.\)
Obtains distributed account information. This method uses an asynchronous callback to return the result.
Obtains distributed account information. This method uses an asynchronous callback to return the result.
The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS or ohos.permission.DISTRIBUTED\_DATASYNC** permission is required. This permission is intended for system applications only.
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
Obtains distributed account information. This method uses a promise to return the result asynchronously.
Obtains distributed account information. This method uses a promise to return the result asynchronously.
The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS or ohos.permission.DISTRIBUTED\_DATASYNC** permission is required. This permission is intended for system applications only.
**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
<td class="cellrowborder" valign="top" width="82.17%" headers="mcps1.1.3.1.2 "><p id="p1819375961417"><a name="p1819375961417"></a><a name="p1819375961417"></a>Promise used to return the result.</p>
</td>
</tr>
</tbody>
</table>
- Example
- Return value
| Type| Description|
| -------- | -------- |
| Promise<[DistributedInfo](#distributedinfo)> | Promise used to return the distributed account information obtained.|
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p21661112204"><a name="p21661112204"></a><a name="p21661112204"></a>Callback invoked when the distributed account information is updated.</p>
<td class="cellrowborder" valign="top" width="82.17%" headers="mcps1.1.3.1.2 "><p id="p5576134941817"><a name="p5576134941817"></a><a name="p5576134941817"></a>Promise used to return the result.</p>
| event | string | Yes| Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>- Ohos.account.event.LOGIN<br>- Ohos.account.event.LOGOUT<br>- Ohos.account.event.TOKEN_INVALID<br>- Ohos.account.event.LOGOFF |
</th>
| scalableData | object | No| Extended information about a distributed account. Customized information is passed in key-value pairs.<br>Note: This parameter is reserved and not used in query and update methods.|
<tdclass="cellrowborder"valign="top"width="67.52%"headers="mcps1.1.5.1.4 "><pid="p1773051213414"><aname="p1773051213414"></a><aname="p1773051213414"></a>Name of a distributed account. It must be a non-null string.</p>
<tdclass="cellrowborder"valign="top"width="67.52%"headers="mcps1.1.5.1.4 "><pid="p171141242153717"><aname="p171141242153717"></a><aname="p171141242153717"></a>UID of a distributed account. It must be a non-null string.</p>
<tdclass="cellrowborder"valign="top"width="67.52%"headers="mcps1.1.5.1.4 "><pid="p1951165714370"><aname="p1951165714370"></a><aname="p1951165714370"></a>Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:</p>
<tdclass="cellrowborder"valign="top"width="67.52%"headers="mcps1.1.5.1.4 "><pid="p111151126143816"><aname="p111151126143816"></a><aname="p111151126143816"></a>Extended information about a distributed account. Customized information is passed in key-value pairs.</p>
<pid="p11123717144012"><aname="p11123717144012"></a><aname="p11123717144012"></a>Note: This parameter is reserved and not used in query and update methods.</p>
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
| callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | No| Callback used to return the P2P peer device state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The APIs described in this document are used only for non-universal products, such as routers.
The APIs described in this document are used only for non-universal products, such as routers.
...
@@ -21,7 +21,7 @@ Enables the WLAN hotspot.
...
@@ -21,7 +21,7 @@ Enables the WLAN hotspot.
ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
- System capability:
- System capability:
SystemCapability.Communication.WiFi.HotspotExt
SystemCapability.Communication.WiFi.AP.Extension
- Return value
- Return value
| **Type**| **Description**|
| **Type**| **Description**|
...
@@ -39,7 +39,7 @@ Disables the WLAN hotspot.
...
@@ -39,7 +39,7 @@ Disables the WLAN hotspot.
ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
- System capability:
- System capability:
SystemCapability.Communication.WiFi.HotspotExt
SystemCapability.Communication.WiFi.AP.Extension
- Return value
- Return value
| **Type**| **Description**|
| **Type**| **Description**|
...
@@ -57,7 +57,7 @@ Obtains the supported power models. The method uses a promise to return the resu
...
@@ -57,7 +57,7 @@ Obtains the supported power models. The method uses a promise to return the resu
ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability:
- System capability:
SystemCapability.Communication.WiFi.HotspotExt
SystemCapability.Communication.WiFi.AP.Extension
- Return value
- Return value
| Type| Description|
| Type| Description|
...
@@ -86,7 +86,7 @@ Obtains the supported power models. The method uses an asynchronous callback to
...
@@ -86,7 +86,7 @@ Obtains the supported power models. The method uses an asynchronous callback to
ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability:
- System capability:
SystemCapability.Communication.WiFi.HotspotExt
SystemCapability.Communication.WiFi.AP.Extension
- Parameters
- Parameters
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
...
@@ -104,7 +104,7 @@ Obtains the power model. The method uses a promise to return the result.
...
@@ -104,7 +104,7 @@ Obtains the power model. The method uses a promise to return the result.
ohos.permission.GET_WIFI_INFO
ohos.permission.GET_WIFI_INFO
- System capability:
- System capability:
SystemCapability.Communication.WiFi.HotspotExt
SystemCapability.Communication.WiFi.AP.Extension
- Return value
- Return value
| Type| Description|
| Type| Description|
...
@@ -122,7 +122,7 @@ Obtains the power model. The method uses an asynchronous callback to return the
...
@@ -122,7 +122,7 @@ Obtains the power model. The method uses an asynchronous callback to return the