提交 19090002 编写于 作者: A annie_wangli

updatedocs

Signed-off-by: Nannie_wangli <annie.wangli@huawei.com>
上级 fcbcccd5
...@@ -387,7 +387,7 @@ Checks whether an app account allows application data synchronization. This meth ...@@ -387,7 +387,7 @@ Checks whether an app account allows application data synchronization. This meth
### setAccountCredential ### setAccountCredential
setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback&lt;void&gt;): void setAccountCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback&lt;void&gt;): void
Sets a credential for an app account. This method uses an asynchronous callback to return the result. Sets a credential for an app account. This method uses an asynchronous callback to return the result.
......
# Distributed Account Management<a name="EN-US_TOPIC_0000001160355878"></a> # Distributed Account Management
>![](../../public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> > 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';
``` ```
## System Capabilities ## System Capability
SystemCapability.Account.OsAccount SystemCapability.Account.OsAccount
## account\_distributedAccount.getDistributedAccountAbility<a name="section192192415554"></a> ## account_distributedAccount.getDistributedAccountAbility
getDistributedAccountAbility(): DistributedAccountAbility
getDistributedAccountAbility\(\): DistributedAccountAbility Obtains a **DistributedAccountAbility** instance.
Obtains a **DistributedAccountAbility** instance. - Return value
| Type| Description|
| -------- | -------- |
| [DistributedAccountAbility](#distributedaccountability) | **DistributedAccountAbility** instance obtained. This instance provides methods for querying and updating the login state of a distributed account.|
- Return values - Example
```
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
```
<a name="table16391145317913"></a> ## DistributedAccountAbility
<table><thead align="left"><tr id="row2391145319910"><th class="cellrowborder" valign="top" width="20.05%" id="mcps1.1.3.1.1"><p id="p13911353991"><a name="p13911353991"></a><a name="p13911353991"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="79.95%" id="mcps1.1.3.1.2"><p id="p193911531395"><a name="p193911531395"></a><a name="p193911531395"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1339114531391"><td class="cellrowborder" valign="top" width="20.05%" headers="mcps1.1.3.1.1 "><p id="p6835165294410"><a name="p6835165294410"></a><a name="p6835165294410"></a><a href="#section189341937163212">DistributedAccountAbility</a></p>
</td>
<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>
</td>
</tr>
</tbody>
</table>
- Example Provides methods for querying and updating the login state of a distributed account. You must obtain a **DistributedAccountAbility** instance first.
``` ### queryOsAccountDistributedInfo
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
```
queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): void
## DistributedAccountAbility<a name="section189341937163212"></a> Obtains distributed account information. This method uses an asynchronous callback to return the result.
Provides methods for querying and updating the login state of a distributed account. \(You must obtain a **DistributedAccountAbility** instance first.\) **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
### queryOsAccountDistributedInfo<a name="section7209156183516"></a> - Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the distributed account information obtained.|
queryOsAccountDistributedInfo\(callback: AsyncCallback<DistributedInfo\>\): void - Example
```
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
});
```
Obtains distributed account information. This method uses an asynchronous callback to return the result. ### queryOsAccountDistributedInfo
The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS or ohos.permission.DISTRIBUTED\_DATASYNC** permission is required. This permission is intended for system applications only. queryOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt;
- Parameters
<a name="table114831131512"></a>
<table><thead align="left"><tr id="row914851141517"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p214819113159"><a name="p214819113159"></a><a name="p214819113159"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1214921121519"><a name="p1214921121519"></a><a name="p1214921121519"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p11491711141512"><a name="p11491711141512"></a><a name="p11491711141512"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p171491011171512"><a name="p171491011171512"></a><a name="p171491011171512"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row91491211131519"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1238213593910"><a name="p1238213593910"></a><a name="p1238213593910"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p173828593913"><a name="p173828593913"></a><a name="p173828593913"></a>AsyncCallback&lt;<a href="#section720518449379">DistributedInfo</a>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p138216591899"><a name="p138216591899"></a><a name="p138216591899"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1238218595918"><a name="p1238218595918"></a><a name="p1238218595918"></a>Callback invoked to return the distributed account information.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
});
```
### queryOsAccountDistributedInfo<a name="section186285471210"></a>
queryOsAccountDistributedInfo\(\): Promise<DistributedInfo\>
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)
- Return values - Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise used to return the distributed account information obtained.|
<a name="table1527413113225"></a> - Example
<table><thead align="left"><tr id="row827519116223"><th class="cellrowborder" valign="top" width="17.83%" id="mcps1.1.3.1.1"><p id="p827512192212"><a name="p827512192212"></a><a name="p827512192212"></a>Type</p> ```
</th> const accountAbility = account_distributedAccount.getDistributedAccountAbility();
<th class="cellrowborder" valign="top" width="82.17%" id="mcps1.1.3.1.2"><p id="p127515142218"><a name="p127515142218"></a><a name="p127515142218"></a>Description</p> accountAbility.queryOsAccountDistributedInfo().then((data) => {
</th> console.log('Query account info name: ' + data.name);
</tr> console.log('Query account info id: ' + data.id);
</thead> }).catch((err) => {
<tbody><tr id="row22758142211"><td class="cellrowborder" valign="top" width="17.83%" headers="mcps1.1.3.1.1 "><p id="p171934599141"><a name="p171934599141"></a><a name="p171934599141"></a>Promise&lt;<a href="#section720518449379">DistributedInfo</a>&gt;</p> console.log("queryOsAccountDistributedInfoerr: " + JSON.stringify(err));
</td> });
<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 ### updateOsAccountDistributedInfo
``` updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback&lt;void&gt;): void
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name);
console.log('Query account info id: ' + data.id);
}).catch((err) => {
console.log("queryOsAccountDistributedInfoerr: " + JSON.stringify(err));
});
```
Updates distributed account information. This method uses an asynchronous callback to return the result.
### updateOsAccountDistributedInfo<a name="section52221846181514"></a> **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only to system applications)
updateOsAccountDistributedInfo\(accountInfo: DistributedInfo, callback: AsyncCallback<void\>\): void - Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked when the distributed account information is updated.|
Updates distributed account information. This method uses an asynchronous callback to return the result. - Example
```
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
});
```
### updateOsAccountDistributedInfo
The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS** permission is required. This permission is intended for system applications only. updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt;
- Parameters
<a name="table822216466150"></a>
<table><thead align="left"><tr id="row1522324617153"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p922314611514"><a name="p922314611514"></a><a name="p922314611514"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p822313469154"><a name="p822313469154"></a><a name="p822313469154"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p722394661517"><a name="p722394661517"></a><a name="p722394661517"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p422374614153"><a name="p422374614153"></a><a name="p422374614153"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row15223846111519"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p19136121717206"><a name="p19136121717206"></a><a name="p19136121717206"></a>accountInfo</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p161361717122014"><a name="p161361717122014"></a><a name="p161361717122014"></a><a href="#section720518449379">DistributedInfo</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p7136317112017"><a name="p7136317112017"></a><a name="p7136317112017"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p4376343191617"><a name="p4376343191617"></a><a name="p4376343191617"></a>Distributed account information.</p>
</td>
</tr>
<tr id="row16769105315198"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p181660132015"><a name="p181660132015"></a><a name="p181660132015"></a>callback</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p15166015201"><a name="p15166015201"></a><a name="p15166015201"></a>AsyncCallback&lt;void&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p116681142016"><a name="p116681142016"></a><a name="p116681142016"></a>Yes</p>
</td>
<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>
</tr>
</tbody>
</table>
- Example
```
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
});
```
### updateOsAccountDistributedInfo<a name="section122504611155"></a>
updateOsAccountDistributedInfo\(accountInfo: DistributedInfo\): Promise<void\>
Updates distributed account information. This method uses a promise to return the result asynchronously. Updates distributed account information. This method uses a promise to return the result asynchronously.
The **ohos.permission.MANAGE\_LOCAL\_ACCOUNTS** permission is required. This permission is intended for system applications only. **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only to system applications)
- Parameters - Parameters
| Name| Type| Mandatory| Description|
<a name="table183757341918"></a> | -------- | -------- | -------- | -------- |
<table><thead align="left"><tr id="row23761234190"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p837673171914"><a name="p837673171914"></a><a name="p837673171914"></a>Name</p> | accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information.|
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1837618371914"><a name="p1837618371914"></a><a name="p1837618371914"></a>Type</p> - Return value
</th> | Type| Description|
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p173761391912"><a name="p173761391912"></a><a name="p173761391912"></a>Mandatory</p> | -------- | -------- |
</th> | Promise&lt;void&gt; | Promise used to return the result.|
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1737633141914"><a name="p1737633141914"></a><a name="p1737633141914"></a>Description</p>
</th> - Example
</tr> ```
</thead> const accountAbility = account_distributedAccount.getDistributedAccountAbility();
<tbody><tr id="row13761931195"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p14444202014199"><a name="p14444202014199"></a><a name="p14444202014199"></a>accountInfo</p> let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
</td> accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1244402010195"><a name="p1244402010195"></a><a name="p1244402010195"></a><a href="#section720518449379">DistributedInfo</a></p> console.log('updateOsAccountDistributedInfo Success');
</td> }).catch((err) => {
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p8444112013195"><a name="p8444112013195"></a><a name="p8444112013195"></a>Yes</p> console.log("updateOsAccountDistributedInfo err: " + JSON.stringify(err));
</td> });
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p744452014197"><a name="p744452014197"></a><a name="p744452014197"></a>Distributed account information.</p> ```
</td>
</tr>
</tbody> ## DistributedInfo
</table>
- Return values
<a name="table20225174621513"></a>
<table><thead align="left"><tr id="row18225134671517"><th class="cellrowborder" valign="top" width="17.83%" id="mcps1.1.3.1.1"><p id="p82251246171515"><a name="p82251246171515"></a><a name="p82251246171515"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.17%" id="mcps1.1.3.1.2"><p id="p13225546161518"><a name="p13225546161518"></a><a name="p13225546161518"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row16225646121517"><td class="cellrowborder" valign="top" width="17.83%" headers="mcps1.1.3.1.1 "><p id="p4576349151812"><a name="p4576349151812"></a><a name="p4576349151812"></a>Promise&lt;void&gt;</p>
</td>
<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>
</td>
</tr>
</tbody>
</table>
- Example
```
const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
console.log('updateOsAccountDistributedInfo Success');
}).catch((err) => {
console.log("updateOsAccountDistributedInfo err: " + JSON.stringify(err));
});
```
## DistributedInfo<a name="section720518449379"></a>
Defines distributed OS account information. Defines distributed OS account information.
<a name="t1e7d4d4f9078490d8dcdbb56465b8ab3"></a>
<table><thead align="left"><tr id="r85a1aa805727476a8e768b658530fc49"><th class="cellrowborder" valign="top" width="13.08%" id="mcps1.1.5.1.1"><p id="a58cac6e212134a42a245df58d7b6f3a3"><a name="a58cac6e212134a42a245df58d7b6f3a3"></a><a name="a58cac6e212134a42a245df58d7b6f3a3"></a>Name</p> | Name| Type| Mandatory| Description|
</th> | -------- | -------- | -------- | -------- |
<th class="cellrowborder" valign="top" width="8.9%" id="mcps1.1.5.1.2"><p id="ae520989fe4be4482acdfdf2c26d6517d"><a name="ae520989fe4be4482acdfdf2c26d6517d"></a><a name="ae520989fe4be4482acdfdf2c26d6517d"></a>Type</p> | name | string | Yes| Name of a distributed account. It must be a non-null string.|
</th> | id | string | Yes| UID of a distributed account. It must be a non-null string.|
<th class="cellrowborder" valign="top" width="10.5%" id="mcps1.1.5.1.3"><p id="a6b396dd84a564272a6f3d4732b4e12fe"><a name="a6b396dd84a564272a6f3d4732b4e12fe"></a><a name="a6b396dd84a564272a6f3d4732b4e12fe"></a>Mandatory</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>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;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.|
<th class="cellrowborder" valign="top" width="67.52%" id="mcps1.1.5.1.4"><p id="ae728420f819e42d1b31424ac9747665b"><a name="ae728420f819e42d1b31424ac9747665b"></a><a name="ae728420f819e42d1b31424ac9747665b"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="r3e8e2a236aee4030b7f7878cf5bc7537"><td class="cellrowborder" valign="top" width="13.08%" headers="mcps1.1.5.1.1 "><p id="p622724611205"><a name="p622724611205"></a><a name="p622724611205"></a>name</p>
</td>
<td class="cellrowborder" valign="top" width="8.9%" headers="mcps1.1.5.1.2 "><p id="p9227114615203"><a name="p9227114615203"></a><a name="p9227114615203"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="10.5%" headers="mcps1.1.5.1.3 "><p id="p172273462204"><a name="p172273462204"></a><a name="p172273462204"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="67.52%" headers="mcps1.1.5.1.4 "><p id="p1773051213414"><a name="p1773051213414"></a><a name="p1773051213414"></a>Name of a distributed account. It must be a non-null string.</p>
</td>
</tr>
<tr id="row144831617482"><td class="cellrowborder" valign="top" width="13.08%" headers="mcps1.1.5.1.1 "><p id="p10228184662019"><a name="p10228184662019"></a><a name="p10228184662019"></a>id</p>
</td>
<td class="cellrowborder" valign="top" width="8.9%" headers="mcps1.1.5.1.2 "><p id="p122844612207"><a name="p122844612207"></a><a name="p122844612207"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="10.5%" headers="mcps1.1.5.1.3 "><p id="p1722874602015"><a name="p1722874602015"></a><a name="p1722874602015"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="67.52%" headers="mcps1.1.5.1.4 "><p id="p171141242153717"><a name="p171141242153717"></a><a name="p171141242153717"></a>UID of a distributed account. It must be a non-null string.</p>
</td>
</tr>
<tr id="row197156101511"><td class="cellrowborder" valign="top" width="13.08%" headers="mcps1.1.5.1.1 "><p id="p62281846172013"><a name="p62281846172013"></a><a name="p62281846172013"></a>event</p>
</td>
<td class="cellrowborder" valign="top" width="8.9%" headers="mcps1.1.5.1.2 "><p id="p1722810460203"><a name="p1722810460203"></a><a name="p1722810460203"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="10.5%" headers="mcps1.1.5.1.3 "><p id="p4228846182017"><a name="p4228846182017"></a><a name="p4228846182017"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="67.52%" headers="mcps1.1.5.1.4 "><p id="p1951165714370"><a name="p1951165714370"></a><a name="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>
<a name="ul098673061720"></a><a name="ul098673061720"></a><ul id="ul098673061720"><li>Ohos.account.event.LOGIN</li><li>Ohos.account.event.LOGOUT</li><li>Ohos.account.event.TOKEN_INVALID</li><li>Ohos.account.event.LOGOFF</li></ul>
</td>
</tr>
<tr id="row227311811513"><td class="cellrowborder" valign="top" width="13.08%" headers="mcps1.1.5.1.1 "><p id="p1422815463200"><a name="p1422815463200"></a><a name="p1422815463200"></a>scalableData</p>
</td>
<td class="cellrowborder" valign="top" width="8.9%" headers="mcps1.1.5.1.2 "><p id="p1022834619208"><a name="p1022834619208"></a><a name="p1022834619208"></a>object</p>
</td>
<td class="cellrowborder" valign="top" width="10.5%" headers="mcps1.1.5.1.3 "><p id="p17228204619208"><a name="p17228204619208"></a><a name="p17228204619208"></a>No</p>
</td>
<td class="cellrowborder" valign="top" width="67.52%" headers="mcps1.1.5.1.4 "><p id="p111151126143816"><a name="p111151126143816"></a><a name="p111151126143816"></a>Extended information about a distributed account. Customized information is passed in key-value pairs.</p>
<p id="p11123717144012"><a name="p11123717144012"></a><a name="p11123717144012"></a>Note: This parameter is reserved and not used in query and update methods.</p>
</td>
</tr>
</tbody>
</table>
...@@ -147,11 +147,11 @@ Enumerates the WLAN security types. ...@@ -147,11 +147,11 @@ Enumerates the WLAN security types.
| **Name**| **Default Value**| **Description**| | **Name**| **Default Value**| **Description**|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| WIFI_SEC_TYPE_INVALID | 0 | Invalid security type | | WIFI_SEC_TYPE_INVALID | 0 | Invalid security type|
| WIFI_SEC_TYPE_OPEN | 1 | Open security type | | WIFI_SEC_TYPE_OPEN | 1 | Open security type|
| WIFI_SEC_TYPE_WEP | 2 | Wired Equivalent Privacy (WEP) | | WIFI_SEC_TYPE_WEP | 2 | Wired Equivalent Privacy (WEP)|
| WIFI_SEC_TYPE_PSK | 3 | Pre-shared key (PSK) | | WIFI_SEC_TYPE_PSK | 3 | Pre-shared key (PSK)|
| WIFI_SEC_TYPE_SAE | 4 | Simultaneous Authentication of Equals (SAE) | | WIFI_SEC_TYPE_SAE | 4 | Simultaneous Authentication of Equals (SAE)|
## wifi.addUntrustedConfig<sup>7+</sup> ## wifi.addUntrustedConfig<sup>7+</sup>
...@@ -182,11 +182,11 @@ Represents the WLAN configuration. ...@@ -182,11 +182,11 @@ Represents the WLAN configuration.
| **Name**| **Type**| **Readable/Writable**| **Description**| | **Name**| **Type**| **Readable/Writable**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ssid | string | Read only| Hotspot SSID, in UTF-8 format.| | ssid | string | Read only| Hotspot service set identifier (SSID), in UTF-8 format.|
| bssid | string | Read only| BSSID of the hotspot.| | bssid | string | Read only| BSSID of the hotspot.|
| preSharedKey | string | Read only| Private key of the hotspot.| | preSharedKey | string | Read only| Private key of the hotspot.|
| isHiddenSsid | boolean | Read only| Whether to hide the network.| | isHiddenSsid | boolean | Read only| Whether to hide the network.|
| securityType | [WifiSecurityType](#WifiSecurityType) | Read only| Security type. | | securityType | [WifiSecurityType](#WifiSecurityType) | Read only| Security type|
## wifi.addUntrustedConfig<sup>7+</sup> ## wifi.addUntrustedConfig<sup>7+</sup>
...@@ -335,7 +335,7 @@ Represents the WLAN connection information. ...@@ -335,7 +335,7 @@ Represents the WLAN connection information.
| Name| Type| Readable/Writable| Description| | Name| Type| Readable/Writable| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ssid | string | Read only| SSID of the hotspot, in UTF-8 format.| | ssid | string | Read only| Hotspot SSID, in UTF-8 format.|
| bssid | string | Read only| BSSID of the hotspot.| | bssid | string | Read only| BSSID of the hotspot.|
| rssi | number | Read only| Signal strength of the hotspot, in dBm.| | rssi | number | Read only| Signal strength of the hotspot, in dBm.|
| band | number | Read only| Frequency band of the WLAN AP.| | band | number | Read only| Frequency band of the WLAN AP.|
...@@ -443,13 +443,13 @@ Represents IP information. ...@@ -443,13 +443,13 @@ Represents IP information.
| **Name**| **Type**| **Readable/Writable**| **Description**| | **Name**| **Type**| **Readable/Writable**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| ipAddress | number | Read only| IP address. | | ipAddress | number | Read only| IP address|
| gateway | number | Read only| Gateway. | | gateway | number | Read only| Gateway|
| netmask | number | Read only| Subnet mask. | | netmask | number | Read only| Subnet mask|
| primaryDns | number | Read only| IP address of the preferred DNS server. | | primaryDns | number | Read only| IP address of the preferred DNS server|
| secondDns | number | Read only| IP address of the alternate DNS server. | | secondDns | number | Read only| IP address of the alternate DNS server|
| serverIp | number | Read only| IP address of the DHCP server. | | serverIp | number | Read only| IP address of the DHCP server|
| leaseDuration | number | Read only| Lease duration of the IP address. | | leaseDuration | number | Read only| Lease duration of the IP address|
## wifi.getCountryCode<sup>7+</sup> ## wifi.getCountryCode<sup>7+</sup>
...@@ -589,7 +589,7 @@ Represents the P2P device information. ...@@ -589,7 +589,7 @@ Represents the P2P device information.
| deviceAddress | string | Read only| MAC address of the device.| | deviceAddress | string | Read only| MAC address of the device.|
| primaryDeviceType | string | Read only| Type of the primary device.| | primaryDeviceType | string | Read only| Type of the primary device.|
| deviceStatus | [P2pDeviceStatus](#P2pDeviceStatus) | Read only| Device status.| | deviceStatus | [P2pDeviceStatus](#P2pDeviceStatus) | Read only| Device status.|
| groupCapabilitys | number | Read only| Group capabilities.| | groupCapabilities | number | Read only| Group capabilities.|
## P2pDeviceStatus<sup>8+</sup> ## P2pDeviceStatus<sup>8+</sup>
...@@ -1046,7 +1046,7 @@ Registers the hotspot state change events. ...@@ -1046,7 +1046,7 @@ Registers the hotspot state change events.
ohos.permission.GET_WIFI_INFO ohos.permission.GET_WIFI_INFO
- System capability: - System capability:
SystemCapability.Communication.WiFi.AP SystemCapability.Communication.WiFi.AP.Core
- Parameters - Parameters
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
...@@ -1073,7 +1073,7 @@ Unregisters the hotspot state change events. ...@@ -1073,7 +1073,7 @@ Unregisters the hotspot state change events.
ohos.permission.GET_WIFI_INFO ohos.permission.GET_WIFI_INFO
- System capability: - System capability:
SystemCapability.Communication.WiFi.AP SystemCapability.Communication.WiFi.AP.Core
- Parameters - Parameters
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
...@@ -1239,7 +1239,7 @@ Unregisters the P2P peer device state change events. ...@@ -1239,7 +1239,7 @@ Unregisters the P2P peer device state change events.
| **Name**| **Type**| **Mandatory**| **Description**| | **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.| | type | string | Yes| Event type. The value is **p2pPeerDeviceChange**.|
| callback | Callback&lt;[WifiP2pDevice[]](#WifiP2pDevice)&gt; | 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&lt;[WifiP2pDevice[]](#WifiP2pDevice)&gt; | 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.|
## wifi.on('p2pPersistentGroupChange')<sup>8+</sup> ## wifi.on('p2pPersistentGroupChange')<sup>8+</sup>
......
# WLAN # WLAN
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<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.<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
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|
...@@ -140,7 +140,7 @@ setPowerModel(model: PowerModel) : boolean; ...@@ -140,7 +140,7 @@ setPowerModel(model: PowerModel) : boolean;
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
- Parameters - Parameters
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册