Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2d2603cb
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2d2603cb
编写于
9月 01, 2023
作者:
C
cc_ggboy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
账号docs示例代码语言标记更改
Signed-off-by:
N
cc_ggboy
<
chenweimin8@huawei.com
>
上级
b2defeb2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
286 addition
and
286 deletion
+286
-286
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
+119
-119
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md
...ication-dev/reference/apis/js-apis-distributed-account.md
+14
-14
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
+153
-153
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
浏览文件 @
2d2603cb
...
...
@@ -9,7 +9,7 @@
## 导入模块
```
j
s
```
t
s
import
account_appAccount
from
'
@ohos.account.appAccount
'
;
```
...
...
@@ -29,7 +29,7 @@ createAppAccountManager(): AppAccountManager
| AppAccountManager | 应用帐号管理器对象。 |
**示例:**
```
j
s
```
t
s
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
```
...
...
@@ -63,7 +63,7 @@ createAccount(name: string, callback: AsyncCallback<void>): void;
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -102,7 +102,7 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
:
account_appAccount
.
CreateAccountOptions
=
{
...
...
@@ -155,7 +155,7 @@ createAccount(name: string, options?: CreateAccountOptions): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
:
account_appAccount
.
CreateAccountOptions
=
{
...
...
@@ -202,7 +202,7 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
...
...
@@ -267,7 +267,7 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
...
...
@@ -332,7 +332,7 @@ removeAccount(name: string, callback: AsyncCallback<void>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -378,7 +378,7 @@ removeAccount(name: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -420,7 +420,7 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback:
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -469,7 +469,7 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise&l
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -509,7 +509,7 @@ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback<bool
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -557,7 +557,7 @@ checkAppAccess(name: string, bundleName: string): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -599,7 +599,7 @@ setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback<
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -644,7 +644,7 @@ setDataSyncEnabled(name: string, isEnabled: boolean): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -685,7 +685,7 @@ checkDataSyncEnabled(name: string, callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -733,7 +733,7 @@ checkDataSyncEnabled(name: string): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -774,7 +774,7 @@ setCredential(name: string, credentialType: string, credential: string,callback:
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -822,7 +822,7 @@ setCredential(name: string, credentialType: string, credential: string): Promise
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -863,7 +863,7 @@ getCredential(name: string, credentialType: string, callback: AsyncCallback<s
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -911,7 +911,7 @@ getCredential(name: string, credentialType: string): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -953,7 +953,7 @@ setCustomData(name: string, key: string, value: string, callback: AsyncCallback&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1002,7 +1002,7 @@ setCustomData(name: string, key: string, value: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1043,7 +1043,7 @@ getCustomData(name: string, key: string, callback: AsyncCallback<string>):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1091,7 +1091,7 @@ getCustomData(name: string, key: string): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1137,7 +1137,7 @@ getCustomDataSync(name: string, key: string): string;
**示例:**
```
j
s
```
t
s
try
{
let
value
=
appAccountManager
.
getCustomDataSync
(
'
ZhangSan
'
,
'
age
'
);
console
.
info
(
'
getCustomDataSync successfully, vaue:
'
+
value
);
...
...
@@ -1168,7 +1168,7 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1206,7 +1206,7 @@ getAllAccounts(): Promise<Array<AppAccountInfo>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1245,7 +1245,7 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1292,7 +1292,7 @@ getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1333,7 +1333,7 @@ on(type: 'accountChange', owners: Array<string>, callback: Callback<Arr
**示例:**
```
j
s
```
t
s
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]):
void
{
console
.
log
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
}
...
...
@@ -1368,7 +1368,7 @@ off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>>
**示例:**
```
j
s
```
t
s
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]):
void
{
console
.
log
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
}
...
...
@@ -1415,7 +1415,7 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
...
...
@@ -1482,7 +1482,7 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
...
...
@@ -1549,7 +1549,7 @@ getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallb
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1599,7 +1599,7 @@ getAuthToken(name: string, owner: string, authType: string): Promise<string&g
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1641,7 +1641,7 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1690,7 +1690,7 @@ setAuthToken(name: string, authType: string, token: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1733,7 +1733,7 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string, ca
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1784,7 +1784,7 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1829,7 +1829,7 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1882,7 +1882,7 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1924,7 +1924,7 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, cal
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -1974,7 +1974,7 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Pr
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2015,7 +2015,7 @@ getAllAuthTokens(name: string, owner: string, callback: AsyncCallback<Array&l
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2063,7 +2063,7 @@ getAllAuthTokens(name: string, owner: string): Promise<Array<AuthTokenInfo
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2105,7 +2105,7 @@ getAuthList(name: string, authType: string, callback: AsyncCallback<Array<
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2153,7 +2153,7 @@ getAuthList(name: string, authType: string): Promise<Array<string>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2192,7 +2192,7 @@ getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
...
...
@@ -2256,7 +2256,7 @@ getAuthCallback(sessionId: string): Promise<AuthCallback>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
...
...
@@ -2313,7 +2313,7 @@ queryAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorIn
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2360,7 +2360,7 @@ queryAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2405,7 +2405,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
labels
=
[
'
student
'
];
...
...
@@ -2458,7 +2458,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>): Pr
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
labels
=
[
'
student
'
];
...
...
@@ -2501,7 +2501,7 @@ deleteCredential(name: string, credentialType: string, callback: AsyncCallback&l
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2549,7 +2549,7 @@ deleteCredential(name: string, credentialType: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
...
...
@@ -2589,7 +2589,7 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
:
account_appAccount
.
SelectAccountsOptions
=
{
...
...
@@ -2641,7 +2641,7 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<App
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
options
:
account_appAccount
.
SelectAccountsOptions
=
{
...
...
@@ -2687,7 +2687,7 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void;
**示例:**
```
j
s
```
t
s
import
Want
from
'
@ohos.app.ability.Want
'
;
try
{
...
...
@@ -2735,7 +2735,7 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions,
**示例:**
```
j
s
```
t
s
import
Want
from
'
@ohos.app.ability.Want
'
;
let
options
:
account_appAccount
.
VerifyCredentialOptions
=
{
...
...
@@ -2784,7 +2784,7 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
**示例:**
```
j
s
```
t
s
import
Want
from
'
@ohos.app.ability.Want
'
;
try
{
...
...
@@ -2830,7 +2830,7 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac
**示例:**
```
j
s
```
t
s
import
Want
from
'
@ohos.app.ability.Want
'
;
let
options
:
account_appAccount
.
SetPropertiesOptions
=
{
...
...
@@ -2874,7 +2874,7 @@ addAccount(name: string, callback: AsyncCallback<void>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
addAccount
(
'
WangWu
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -2903,7 +2903,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>)
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
addAccount
(
'
LiSi
'
,
'
token101
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -2937,7 +2937,7 @@ addAccount(name: string, extraInfo?: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
addAccount
(
'
LiSi
'
,
'
token101
'
).
then
(()
=>
{
...
...
@@ -2970,7 +2970,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
...
...
@@ -3023,7 +3023,7 @@ deleteAccount(name: string, callback: AsyncCallback<void>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
deleteAccount
(
'
ZhaoLiu
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3057,7 +3057,7 @@ deleteAccount(name: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
deleteAccount
(
'
ZhaoLiu
'
).
then
(()
=>
{
...
...
@@ -3088,7 +3088,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<vo
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
disableAppAccess
(
'
ZhangSan
'
,
'
com.example.accountjsdemo
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3123,7 +3123,7 @@ disableAppAccess(name: string, bundleName: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
disableAppAccess
(
'
ZhangSan
'
,
'
com.example.accountjsdemo
'
).
then
(()
=>
{
...
...
@@ -3155,7 +3155,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<voi
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
enableAppAccess
(
'
ZhangSan
'
,
'
com.example.accountjsdemo
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3190,7 +3190,7 @@ enableAppAccess(name: string, bundleName: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
enableAppAccess
(
'
ZhangSan
'
,
'
com.example.accountjsdemo
'
).
then
(()
=>
{
...
...
@@ -3223,7 +3223,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
checkAppAccountSyncEnable
(
'
ZhangSan
'
,
(
err
:
BusinessError
,
result
:
boolean
)
=>
{
...
...
@@ -3260,7 +3260,7 @@ checkAppAccountSyncEnable(name: string): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
checkAppAccountSyncEnable
(
'
ZhangSan
'
).
then
((
data
:
boolean
)
=>
{
...
...
@@ -3293,7 +3293,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAccountCredential
(
'
ZhangSan
'
,
'
credentialType001
'
,
'
credential001
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3329,7 +3329,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAccountCredential
(
'
ZhangSan
'
,
'
credentialType001
'
,
'
credential001
'
).
then
(()
=>
{
...
...
@@ -3362,7 +3362,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback<
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAccountExtraInfo
(
'
ZhangSan
'
,
'
Tk002
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3398,7 +3398,7 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAccountExtraInfo
(
'
ZhangSan
'
,
'
Tk002
'
).
then
(()
=>
{
...
...
@@ -3432,7 +3432,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAppAccountSyncEnable
(
'
ZhangSan
'
,
true
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3469,7 +3469,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAppAccountSyncEnable
(
'
ZhangSan
'
,
true
).
then
(()
=>
{
...
...
@@ -3503,7 +3503,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAssociatedData
(
'
ZhangSan
'
,
'
k001
'
,
'
v001
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -3540,7 +3540,7 @@ setAssociatedData(name: string, key: string, value: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setAssociatedData
(
'
ZhangSan
'
,
'
k001
'
,
'
v001
'
).
then
(()
=>
{
...
...
@@ -3572,7 +3572,7 @@ getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAllAccessibleAccounts
((
err
:
BusinessError
,
data
:
account_appAccount
.
AppAccountInfo
[])
=>
{
...
...
@@ -3603,7 +3603,7 @@ getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAllAccessibleAccounts
().
then
((
data
:
account_appAccount
.
AppAccountInfo
[])
=>
{
...
...
@@ -3636,7 +3636,7 @@ getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
selfBundle
=
'
com.example.actsgetallaaccounts
'
;
...
...
@@ -3674,7 +3674,7 @@ getAllAccounts(owner: string): Promise<Array<AppAccountInfo>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
selfBundle
=
'
com.example.actsgetallaaccounts
'
;
...
...
@@ -3707,7 +3707,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAccountCredential
(
'
ZhangSan
'
,
'
credentialType001
'
,
(
err
:
BusinessError
,
result
:
string
)
=>
{
...
...
@@ -3743,7 +3743,7 @@ getAccountCredential(name: string, credentialType: string): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAccountCredential
(
'
ZhangSan
'
,
'
credentialType001
'
).
then
((
data
:
string
)
=>
{
...
...
@@ -3774,7 +3774,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAccountExtraInfo
(
'
ZhangSan
'
,
(
err
:
BusinessError
,
result
:
string
)
=>
{
...
...
@@ -3809,7 +3809,7 @@ getAccountExtraInfo(name: string): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAccountExtraInfo
(
'
ZhangSan
'
).
then
((
data
:
string
)
=>
{
...
...
@@ -3841,7 +3841,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback<string&g
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAssociatedData
(
'
ZhangSan
'
,
'
k001
'
,
(
err
:
BusinessError
,
result
:
string
)
=>
{
...
...
@@ -3877,7 +3877,7 @@ getAssociatedData(name: string, key: string): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAssociatedData
(
'
ZhangSan
'
,
'
k001
'
).
then
((
data
:
string
)
=>
{
...
...
@@ -3909,7 +3909,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A
**示例:**
```
j
s
```
t
s
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]):
void
{
console
.
debug
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
}
...
...
@@ -3942,7 +3942,7 @@ off(type: 'change', callback?: Callback<Array<AppAccountInfo>>): voi
**示例:**
```
j
s
```
t
s
function
changeOnCallback
(
data
:
account_appAccount
.
AppAccountInfo
[]):
void
{
console
.
debug
(
'
receive change data:
'
+
JSON
.
stringify
(
data
));
appAccountManager
.
off
(
'
change
'
,
()
=>
{
...
...
@@ -3981,7 +3981,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
import
common
from
'
@ohos.app.ability.common
'
;
...
...
@@ -4036,7 +4036,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getOAuthToken
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
'
getSocialData
'
,
...
...
@@ -4074,7 +4074,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise<string&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getOAuthToken
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
'
getSocialData
'
).
then
((
data
:
string
)
=>
{
...
...
@@ -4107,7 +4107,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setOAuthToken
(
'
LiSi
'
,
'
getSocialData
'
,
'
xxxx
'
,
(
err
:
BusinessError
)
=>
{
...
...
@@ -4143,7 +4143,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setOAuthToken
(
'
LiSi
'
,
'
getSocialData
'
,
'
xxxx
'
).
then
(()
=>
{
...
...
@@ -4177,7 +4177,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
deleteOAuthToken
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
'
getSocialData
'
,
'
xxxxx
'
,
...
...
@@ -4215,7 +4215,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
deleteOAuthToken
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
'
getSocialData
'
,
'
xxxxx
'
).
then
(()
=>
{
...
...
@@ -4249,7 +4249,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setOAuthTokenVisibility
(
'
LiSi
'
,
'
getSocialData
'
,
'
com.example.accountjsdemo
'
,
true
,
...
...
@@ -4287,7 +4287,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
setOAuthTokenVisibility
(
'
LiSi
'
,
'
getSocialData
'
,
'
com.example.accountjsdemo
'
,
true
).
then
(()
=>
{
...
...
@@ -4320,7 +4320,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
checkOAuthTokenVisibility
(
'
LiSi
'
,
'
getSocialData
'
,
'
com.example.accountjsdemo
'
,
...
...
@@ -4358,7 +4358,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
checkOAuthTokenVisibility
(
'
LiSi
'
,
'
getSocialData
'
,
'
com.example.accountjsdemo
'
).
then
((
...
...
@@ -4391,7 +4391,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback<Array&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAllOAuthTokens
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
,
...
...
@@ -4428,7 +4428,7 @@ getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenIn
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAllOAuthTokens
(
'
LiSi
'
,
'
com.example.accountjsdemo
'
).
then
((
...
...
@@ -4461,7 +4461,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback<Array<
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getOAuthList
(
'
LiSi
'
,
'
getSocialData
'
,
(
err
:
BusinessError
,
data
:
string
[])
=>
{
...
...
@@ -4497,7 +4497,7 @@ getOAuthList(name: string, authType: string): Promise<Array<string>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getOAuthList
(
'
LiSi
'
,
'
getSocialData
'
).
then
((
data
:
string
[])
=>
{
...
...
@@ -4528,7 +4528,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
...
...
@@ -4580,7 +4580,7 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
...
...
@@ -4625,7 +4625,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAuthenticatorInfo
(
'
com.example.accountjsdemo
'
,
...
...
@@ -4661,7 +4661,7 @@ getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
appAccountManager
.
getAuthenticatorInfo
(
'
com.example.accountjsdemo
'
).
then
((
...
...
@@ -4869,7 +4869,7 @@ onResult: (code: number, result?: AuthResult) => void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
...
...
@@ -4907,7 +4907,7 @@ onRequestRedirected: (request: Want) => void
**示例:**
```
j
s
```
t
s
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
createAccountImplicitly
(
options
:
account_appAccount
.
CreateAccountImplicitlyOptions
,
callback
:
account_appAccount
.
AuthCallback
)
{
...
...
@@ -4945,7 +4945,7 @@ onRequestContinued?: () => void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
...
...
@@ -4984,7 +4984,7 @@ onResult: (code: number, result: {[key: string]: any}) => void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
...
...
@@ -5017,7 +5017,7 @@ onRequestRedirected: (request: Want) => void
**示例:**
```
j
s
```
t
s
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
addAccountImplicitly
(
authType
:
string
,
callerBundleName
:
string
,
options
:
Record
<
string
,
Object
>
,
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
...
...
@@ -5191,7 +5191,7 @@ getRemoteObject(): rpc.RemoteObject;
**示例:**
```
j
s
```
t
s
class
MyAuthenticator
extends
account_appAccount
.
Authenticator
{
addAccountImplicitly
(
authType
:
string
,
callerBundleName
:
string
,
options
:
Record
<
string
,
Object
>
,
callback
:
account_appAccount
.
AuthenticatorCallback
)
{
...
...
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md
浏览文件 @
2d2603cb
...
...
@@ -8,7 +8,7 @@
## 导入模块
```
j
s
```
t
s
import
account_distributedAccount
from
'
@ohos.account.distributedAccount
'
;
```
...
...
@@ -27,7 +27,7 @@ getDistributedAccountAbility(): DistributedAccountAbility
|
[
DistributedAccountAbility
](
#distributedaccountability
)
| 返回一个实例,实例提供查询和更新分布式帐号登录状态方法。 |
**示例:**
```
j
s
```
t
s
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
```
...
...
@@ -58,7 +58,7 @@ getOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): voi
| 12300001 | System service exception. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -99,7 +99,7 @@ getOsAccountDistributedInfo(): Promise<DistributedInfo>
| 12300001 | System service exception. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -141,7 +141,7 @@ getOsAccountDistributedInfoByLocalId(localId: number, callback: AsyncCallback<
| 12300003 | Account not found. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -185,7 +185,7 @@ getOsAccountDistributedInfoByLocalId(localId: number): Promise<DistributedInf
| 12300003 | Account not found. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -221,7 +221,7 @@ queryOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): v
| callback | AsyncCallback
<
[DistributedInfo](#distributedinfo)
>
| 是 | 回调函数。当获取分布式帐号信息成功,err为undefined,data为获取到的分布式帐号信息对象;否则为错误对象。 |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -256,7 +256,7 @@ queryOsAccountDistributedInfo(): Promise<DistributedInfo>
| Promise
<
[DistributedInfo](#distributedinfo)
>
| Promise对象,返回分布式帐号信息对象。 |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -293,7 +293,7 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallbac
| 12300003 | Account not found. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -343,7 +343,7 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>
| 12300003 | Account not found. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -389,7 +389,7 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
| 12300008 | Restricted OS account. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -443,7 +443,7 @@ setOsAccountDistributedInfoByLocalId(localId: number, distributedInfo: Distribut
| 12300008 | Restricted OS account. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -482,7 +482,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
| callback | AsyncCallback
<
void
>
| 是 | 回调函数。当更新分布式帐号信息成功时,err为undefined,否则为错误对象。 |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
@@ -522,7 +522,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>
| Promise
<
void
>
| Promise对象,无返回结果的Promise对象。 |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
const
accountAbility
=
account_distributedAccount
.
getDistributedAccountAbility
();
...
...
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
浏览文件 @
2d2603cb
...
...
@@ -9,7 +9,7 @@
## 导入模块
```
j
s
```
t
s
import
account_osAccount
from
'
@ohos.account.osAccount
'
;
```
...
...
@@ -28,7 +28,7 @@ getAccountManager(): AccountManager
|
[
AccountManager
](
#accountmanager
)
| 系统帐号管理对象。 |
**示例:**
```
j
s
```
t
s
let
accountManager
=
account_osAccount
.
getAccountManager
();
```
...
...
@@ -78,7 +78,7 @@ activateOsAccount(localId: number, callback: AsyncCallback<void>): void
| 12300009 | Account has been activated. |
**示例:**
激活ID为100的系统帐号
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
localId
:
number
=
100
;
try
{
...
...
@@ -129,7 +129,7 @@ activateOsAccount(localId: number): Promise<void>
| 12300009 | Account has been activated. |
**示例:**
激活ID为100的系统帐号
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -166,7 +166,7 @@ checkMultiOsAccountEnabled(callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -204,7 +204,7 @@ checkMultiOsAccountEnabled(): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
try
{
let
accountManager
=
account_osAccount
.
getAccountManager
();
...
...
@@ -245,7 +245,7 @@ checkOsAccountActivated(localId: number, callback: AsyncCallback<boolean>)
**示例:**
判断ID为100的系统帐号是否处于激活状态
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -294,7 +294,7 @@ checkOsAccountActivated(localId: number): Promise<boolean>
**示例:**
判断ID为100的系统帐号是否处于激活状态
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -337,7 +337,7 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: A
**示例:**
判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -388,7 +388,7 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<
**示例:**
判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -426,7 +426,7 @@ checkOsAccountTestable(callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -464,7 +464,7 @@ checkOsAccountTestable(): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -500,7 +500,7 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -538,7 +538,7 @@ checkOsAccountVerified(): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -579,7 +579,7 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -628,7 +628,7 @@ checkOsAccountVerified(localId: number): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -665,7 +665,7 @@ checkOsAccountVerified(): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -709,7 +709,7 @@ removeOsAccount(localId: number, callback: AsyncCallback<void>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
accountName
:
string
=
'
testAccountName
'
;
...
...
@@ -764,7 +764,7 @@ removeOsAccount(localId: number): Promise<void>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
accountName
:
string
=
'
testAccountName
'
;
...
...
@@ -814,7 +814,7 @@ setOsAccountConstraints(localId: number, constraints: Array<string>, enabl
**示例:**
给ID为100的系统帐号设置禁止使用Wi-Fi的约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -869,7 +869,7 @@ setOsAccountConstraints(localId: number, constraints: Array<string>, enabl
**示例:**
删除ID为100的系统帐号的禁止使用Wi-Fi的约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -915,7 +915,7 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback<
**示例:**
将ID为100的系统帐号的帐号名设置成demoName
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -969,7 +969,7 @@ setOsAccountName(localId: number, localName: string): Promise<void>
**示例:**
将ID为100的系统帐号的帐号名设置成demoName
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -1009,7 +1009,7 @@ getOsAccountCount(callback: AsyncCallback<number>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1049,7 +1049,7 @@ getOsAccountCount(): Promise<number>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1085,7 +1085,7 @@ getOsAccountLocalId(callback: AsyncCallback<number>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1123,7 +1123,7 @@ getOsAccountLocalId(): Promise<number>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1161,7 +1161,7 @@ getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): v
**示例:**
查询值为12345678的uid所属的系统帐号的帐号ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
uid
:
number
=
12345678
;
...
...
@@ -1206,7 +1206,7 @@ getOsAccountLocalIdForUid(uid: number): Promise<number>
**示例:**
查询值为12345678的uid所属的系统帐号ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
uid
:
number
=
12345678
;
...
...
@@ -1286,7 +1286,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
accountManager
=
account_osAccount
.
getAccountManager
();
...
...
@@ -1334,7 +1334,7 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number&g
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
...
...
@@ -1373,7 +1373,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback<number>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1413,7 +1413,7 @@ queryMaxOsAccountNumber(): Promise<number>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1454,7 +1454,7 @@ getOsAccountConstraints(localId: number, callback: AsyncCallback<Array<str
**示例:**
获取ID为100的系统帐号的全部约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -1503,7 +1503,7 @@ getOsAccountConstraints(localId: number): Promise<Array<string>>
**示例:**
获取ID为100的系统帐号的全部约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -1544,7 +1544,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1583,7 +1583,7 @@ queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1619,7 +1619,7 @@ getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1657,7 +1657,7 @@ getActivatedOsAccountLocalIds(): Promise<Array<number>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1703,7 +1703,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1754,7 +1754,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise<OsAccountInf
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1801,7 +1801,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
...
...
@@ -1854,7 +1854,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
:
account_osAccount
.
DomainAccountInfo
=
...
...
@@ -1895,7 +1895,7 @@ getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1932,7 +1932,7 @@ getCurrentOsAccount(): Promise<OsAccountInfo>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -1975,7 +1975,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>
**示例:**
查询ID为100的系统帐号信息
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2023,7 +2023,7 @@ queryOsAccountById(localId: number): Promise<OsAccountInfo>
**示例:**
查询ID为100的系统帐号信息
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2060,7 +2060,7 @@ getOsAccountType(callback: AsyncCallback<OsAccountType>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2095,7 +2095,7 @@ getOsAccountType(): Promise<OsAccountType>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2133,7 +2133,7 @@ queryDistributedVirtualDeviceId(callback: AsyncCallback<string>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2170,7 +2170,7 @@ queryDistributedVirtualDeviceId(): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2213,7 +2213,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>)
**示例:**
获取ID为100的系统帐号的头像
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2261,7 +2261,7 @@ getOsAccountProfilePhoto(localId: number): Promise<string>
**示例:**
获取ID为100的系统帐号的头像
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2307,7 +2307,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
**示例:**
给ID为100的系统帐号设置头像
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2360,7 +2360,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise<void>
**示例:**
给ID为100的系统帐号设置头像
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2404,7 +2404,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback
**示例:**
查询与SN码12345关联的系统帐号的ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
serialNumber
:
number
=
12345
;
...
...
@@ -2448,7 +2448,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>
**示例:**
查询与SN码12345关联的系统帐号的ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
serialNumber
:
number
=
12345
;
...
...
@@ -2488,7 +2488,7 @@ getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<n
**示例:**
获取ID为100的系统帐号关联的SN码
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2532,7 +2532,7 @@ getSerialNumberForOsAccountLocalId(localId: number): Promise<number>
**示例:**
获取ID为100的系统帐号关联的SN码
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -2576,7 +2576,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback<number&g
**示例:**
```
j
s
```
t
s
let
accountManager
=
account_osAccount
.
getAccountManager
();
function
onCallback
(
receiveLocalId
:
number
){
console
.
log
(
'
receive localId:
'
+
receiveLocalId
);
...
...
@@ -2617,7 +2617,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback<number
**示例:**
```
j
s
```
t
s
let
accountManager
=
account_osAccount
.
getAccountManager
();
function
offCallback
(){
console
.
log
(
'
off enter
'
)
...
...
@@ -2655,7 +2655,7 @@ getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
testUid
:
number
=
1000000
;
...
...
@@ -2700,7 +2700,7 @@ getBundleIdForUid(uid: number): Promise<number>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
testUid
:
number
=
1000000
;
...
...
@@ -2782,7 +2782,7 @@ isMainOsAccount(callback: AsyncCallback<boolean>): void;
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2820,7 +2820,7 @@ isMainOsAccount(): Promise<boolean>;
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2863,7 +2863,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback:
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2912,7 +2912,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
try
{
...
...
@@ -2947,7 +2947,7 @@ isMultiOsAccountEnable(callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isMultiOsAccountEnable
((
err
:
BusinessError
,
isEnabled
:
boolean
)
=>
{
...
...
@@ -2979,7 +2979,7 @@ isMultiOsAccountEnable(): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isMultiOsAccountEnable
().
then
((
isEnabled
:
boolean
)
=>
{
...
...
@@ -3013,7 +3013,7 @@ isOsAccountActived(localId: number, callback: AsyncCallback<boolean>): voi
**示例:**
判断ID为100的系统帐号是否处于激活状态
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3054,7 +3054,7 @@ isOsAccountActived(localId: number): Promise<boolean>
**示例:**
判断ID为100的系统帐号是否处于激活状态
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3089,7 +3089,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
**示例:**
判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3132,7 +3132,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise<boo
**示例:**
判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3164,7 +3164,7 @@ isTestOsAccount(callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isTestOsAccount
((
err
:
BusinessError
,
isTestable
:
boolean
)
=>
{
...
...
@@ -3196,7 +3196,7 @@ isTestOsAccount(): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isTestOsAccount
().
then
((
isTestable
:
boolean
)
=>
{
...
...
@@ -3228,7 +3228,7 @@ isOsAccountVerified(callback: AsyncCallback<boolean>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isOsAccountVerified
((
err
:
BusinessError
,
isVerified
:
boolean
)
=>
{
...
...
@@ -3263,7 +3263,7 @@ isOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): vo
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3304,7 +3304,7 @@ isOsAccountVerified(localId?: number): Promise<boolean>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isOsAccountVerified
(
localId
).
then
((
isVerified
:
boolean
)
=>
{
...
...
@@ -3336,7 +3336,7 @@ getCreatedOsAccountsCount(callback: AsyncCallback<number>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getCreatedOsAccountsCount
((
err
:
BusinessError
,
count
:
number
)
=>
{
...
...
@@ -3370,7 +3370,7 @@ getCreatedOsAccountsCount(): Promise<number>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getCreatedOsAccountsCount
().
then
((
count
:
number
)
=>
{
...
...
@@ -3400,7 +3400,7 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getOsAccountLocalIdFromProcess
((
err
:
BusinessError
,
localId
:
number
)
=>
{
...
...
@@ -3432,7 +3432,7 @@ getOsAccountLocalIdFromProcess(): Promise<number>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getOsAccountLocalIdFromProcess
().
then
((
localId
:
number
)
=>
{
...
...
@@ -3463,7 +3463,7 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>):
**示例:**
查询值为12345678的uid所属的系统帐号ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
uid
:
number
=
12345678
;
...
...
@@ -3502,7 +3502,7 @@ getOsAccountLocalIdFromUid(uid: number): Promise<number>
**示例:**
查询值为12345678的uid所属的系统帐号ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
uid
:
number
=
12345678
;
...
...
@@ -3536,7 +3536,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
let
accountManager
=
account_osAccount
.
getAccountManager
();
...
...
@@ -3577,7 +3577,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number&
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
domainInfo
=
{
domain
:
'
testDomain
'
,
accountName
:
'
testAccountName
'
};
...
...
@@ -3611,7 +3611,7 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback<Array<
**示例:**
获取ID为100的系统帐号的全部约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3649,7 +3649,7 @@ getOsAccountAllConstraints(localId: number): Promise<Array<string>>
**示例:**
获取ID为100的系统帐号的全部约束
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -3680,7 +3680,7 @@ queryActivatedOsAccountIds(callback: AsyncCallback<Array<number>>):
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
queryActivatedOsAccountIds
((
err
:
BusinessError
,
idArray
:
number
[])
=>
{
...
...
@@ -3712,7 +3712,7 @@ queryActivatedOsAccountIds(): Promise<Array<number>>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
queryActivatedOsAccountIds
().
then
((
idArray
:
number
[])
=>
{
...
...
@@ -3744,7 +3744,7 @@ queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
queryCurrentOsAccount
((
err
:
BusinessError
,
curAccountInfo
:
account_osAccount
.
OsAccountInfo
)
=>
{
...
...
@@ -3775,7 +3775,7 @@ queryCurrentOsAccount(): Promise<OsAccountInfo>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
queryCurrentOsAccount
().
then
((
accountInfo
:
account_osAccount
.
OsAccountInfo
)
=>
{
...
...
@@ -3805,7 +3805,7 @@ getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getOsAccountTypeFromProcess
((
err
:
BusinessError
,
accountType
:
account_osAccount
.
OsAccountType
)
=>
{
...
...
@@ -3834,7 +3834,7 @@ getOsAccountTypeFromProcess(): Promise<OsAccountType>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getOsAccountTypeFromProcess
().
then
((
accountType
:
account_osAccount
.
OsAccountType
)
=>
{
...
...
@@ -3866,7 +3866,7 @@ getDistributedVirtualDeviceId(callback: AsyncCallback<string>): void
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getDistributedVirtualDeviceId
((
err
:
BusinessError
,
virtualID
:
string
)
=>
{
...
...
@@ -3897,7 +3897,7 @@ getDistributedVirtualDeviceId(): Promise<string>
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
getDistributedVirtualDeviceId
().
then
((
virtualID
:
string
)
=>
{
...
...
@@ -3928,7 +3928,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&
**示例:**
查询与SN码12345关联的系统帐号的ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
serialNumber
:
number
=
12345
;
...
...
@@ -3964,7 +3964,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>
**示例:**
查询与SN码12345关联的系统帐号的ID
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
serialNumber
:
number
=
12345
;
...
...
@@ -3996,7 +3996,7 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<nu
**示例:**
获取ID为100的系统帐号关联的SN码
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -4032,7 +4032,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise<number>
**示例:**
获取ID为100的系统帐号关联的SN码
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
accountManager
=
account_osAccount
.
getAccountManager
();
let
localId
:
number
=
100
;
...
...
@@ -4060,7 +4060,7 @@ constructor()
**系统能力**
:SystemCapability.Account.OsAccount
**示例:**
```
j
s
```
t
s
let
userAuth
=
new
account_osAccount
.
UserAuth
();
```
...
...
@@ -4081,7 +4081,7 @@ getVersion(): number;
| number | 返回版本信息。|
**示例:**
```
j
s
```
t
s
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
version
:
number
=
userAuth
.
getVersion
();
console
.
log
(
'
getVersion version =
'
+
version
);
...
...
@@ -4120,7 +4120,7 @@ getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
| 12300002 | Invalid authType or authTrustLevel. |
**示例:**
```
j
s
```
t
s
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
authType
=
account_osAccount
.
AuthType
.
PIN
;
let
authTrustLevel
=
account_osAccount
.
AuthTrustLevel
.
ATL1
;
...
...
@@ -4159,7 +4159,7 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProp
| 12300002 | Invalid request. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
keys
=
[
...
...
@@ -4213,7 +4213,7 @@ getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>;
| 12300002 | Invalid request. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
keys
=
[
...
...
@@ -4263,7 +4263,7 @@ setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): v
| 12300002 | Invalid request. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
request
:
account_osAccount
.
SetPropertyRequest
=
{
...
...
@@ -4316,7 +4316,7 @@ setProperty(request: SetPropertyRequest): Promise<void>;
| 12300002 | Invalid request. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
request2
:
account_osAccount
.
SetPropertyRequest
=
{
...
...
@@ -4378,7 +4378,7 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel,
| 12300112 | Authentication service is busy. |
**示例:**
```
j
s
```
t
s
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
challenge
=
new
Uint8Array
([
0
]);
let
authType
=
account_osAccount
.
AuthType
.
PIN
;
...
...
@@ -4439,7 +4439,7 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev
| 12300112 | Authentication service is busy. |
**示例:**
```
j
s
```
t
s
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
userID
:
number
=
100
;
let
challenge
=
new
Uint8Array
([
0
]);
...
...
@@ -4483,7 +4483,7 @@ cancelAuth(contextID: Uint8Array): void;
| 12300002 | Invalid contextId. |
**示例:**
```
j
s
```
t
s
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
let
challenge
=
new
Uint8Array
([
0
]);
...
...
@@ -4517,7 +4517,7 @@ constructor()
**系统能力**
:SystemCapability.Account.OsAccount
**示例:**
```
j
s
```
t
s
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
```
...
...
@@ -4548,7 +4548,7 @@ registerInputer(inputer: IInputer): void;
| 12300103 | Inputer already registered. |
**示例:**
```
j
s
```
t
s
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
]);
try
{
...
...
@@ -4576,7 +4576,7 @@ unregisterInputer(): void;
**需要权限:**
ohos.permission.ACCESS_PIN_AUTH
**示例:**
```
j
s
```
t
s
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
pinAuth
.
unregisterInputer
();
```
...
...
@@ -4614,7 +4614,7 @@ static registerInputer(authType: AuthType, inputer: IInputer): void
| 12300106 | Unsupported authType. |
**示例:**
```
j
s
```
t
s
let
authType
=
account_osAccount
.
AuthType
.
DOMAIN
;
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
]);
try
{
...
...
@@ -4654,7 +4654,7 @@ static unregisterInputer(authType: AuthType): void
| 12300002 | Invalid authType. |
**示例:**
```
j
s
```
t
s
let
authType
=
account_osAccount
.
AuthType
.
DOMAIN
;
try
{
account_osAccount
.
InputerManager
.
unregisterInputer
(
authType
);
...
...
@@ -4689,7 +4689,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
| callback |
[
IUserAuthCallback
](
#iuserauthcallback8
)
| 是 | 指示认证结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -4753,7 +4753,7 @@ authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback)
| callback |
[
IUserAuthCallback
](
#iuserauthcallback8
)
| 是 | 指示认证结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -4804,7 +4804,7 @@ authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback:
| callback |
[
IUserAuthCallback
](
#iuserauthcallback8
)
| 是 | 指示认证结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -4854,7 +4854,7 @@ getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallba
| callback | AsyncCallback
<
[DomainAccountInfo](#domainaccountinfo8)
>
| 是 | 指示查询结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
,
BusinessError
}
from
'
@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -4909,7 +4909,7 @@ getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&
| callback | AsyncCallback
<
[AuthStatusInfo](#authstatusinfo10)
>
| 是 | 指示查询结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
,
BusinessError
}
from
'
@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -4961,7 +4961,7 @@ bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: Asy
| callback | AsyncCallback
<
void
>
| 是 | 指示绑定结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -5011,7 +5011,7 @@ unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<v
| callback | AsyncCallback
<
void
>
| 是 | 指示绑定结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -5062,7 +5062,7 @@ isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, cal
| callback | AsyncCallback
<
boolean
>
| 是 | 指示检查结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -5112,7 +5112,7 @@ getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<
| callback | AsyncCallback
<
Uint8Array
>
| 是 | 指示结果回调。|
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
,
BusinessError
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -5173,7 +5173,7 @@ static registerPlugin(plugin: DomainPlugin): void
| 12300201 | The domain plugin has been registered. |
**示例:**
```
j
s
```
t
s
import
{
AsyncCallback
}
from
'
./@ohos.base
'
;
let
plugin
:
account_osAccount
.
DomainPlugin
=
{
auth
:
(
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
,
credential
:
Uint8Array
,
...
...
@@ -5214,7 +5214,7 @@ static unregisterPlugin(): void
**需要权限:**
ohos.permission.MANAGE_LOCAL_ACCOUNTS
**示例:**
```
j
s
```
t
s
try
{
account_osAccount
.
DomainAccountManager
.
unregisterPlugin
();
console
.
log
(
'
unregisterPlugin success.
'
);
...
...
@@ -5260,7 +5260,7 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
| 12300114 | Authentication service exception. |
**示例:**
```
j
s
```
t
s
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
accountName
:
'
zhangsan
'
...
...
@@ -5312,7 +5312,7 @@ authWithPopup(callback: IUserAuthCallback): void
| 12300114 | Authentication service exception. |
**示例:**
```
j
s
```
t
s
try
{
account_osAccount
.
DomainAccountManager
.
authWithPopup
({
onResult
:
(
resultCode
:
number
,
authResult
:
account_osAccount
.
AuthResult
)
=>
{
...
...
@@ -5361,7 +5361,7 @@ authWithPopup(localId: number, callback: IUserAuthCallback): void
| 12300114 | Authentication service exception. |
**示例:**
```
j
s
```
t
s
try
{
account_osAccount
.
DomainAccountManager
.
authWithPopup
(
100
,
{
onResult
:
(
resultCode
:
number
,
authResult
:
account_osAccount
.
AuthResult
)
=>
{
...
...
@@ -5403,7 +5403,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<bool
| 12300111 | Operation timeout. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
...
...
@@ -5456,7 +5456,7 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean>
| 12300111 | Operation timeout. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
...
...
@@ -5502,7 +5502,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call
| 12300003 | Account not found. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
...
...
@@ -5557,7 +5557,7 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro
| 12300003 | Account not found. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
:
account_osAccount
.
DomainAccountInfo
=
{
domain
:
'
CHINA
'
,
...
...
@@ -5605,7 +5605,7 @@ getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback<
| 12300111 | Operation timeout. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
:
account_osAccount
.
GetDomainAccountInfoOptions
=
{
domain
:
'
CHINA
'
,
...
...
@@ -5659,7 +5659,7 @@ getAccountInfo(options: GetDomainAccountInfoOptions): Promise<DomainAccountIn
| 12300111 | Operation timeout. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
domainAccountInfo
:
account_osAccount
.
GetDomainAccountInfoOptions
=
{
domain
:
'
CHINA
'
,
...
...
@@ -5694,7 +5694,7 @@ constructor()
**系统能力**
:SystemCapability.Account.OsAccount
**示例:**
```
j
s
```
t
s
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
```
...
...
@@ -5723,7 +5723,7 @@ openSession(callback: AsyncCallback<Uint8Array>): void;
| 12300001 | System service exception. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
try
{
...
...
@@ -5761,7 +5761,7 @@ openSession(): Promise<Uint8Array>;
| 12300001 | System service exception. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
try
{
...
...
@@ -5807,7 +5807,7 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
| 12300115 | The number of credentials reaches the upper limit. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
pinAuth
:
account_osAccount
.
PINAuth
=
new
account_osAccount
.
PINAuth
();
...
...
@@ -5868,7 +5868,7 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
| 12300111 | Operation timeout. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
userAuth
:
account_osAccount
.
UserAuth
=
new
account_osAccount
.
UserAuth
();
...
...
@@ -5921,7 +5921,7 @@ closeSession(): void;
**需要权限:**
ohos.permission.MANAGE_USER_IDM
**示例:**
```
j
s
```
t
s
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
userIDM
.
closeSession
();
```
...
...
@@ -5952,7 +5952,7 @@ cancel(challenge: Uint8Array): void;
| 12300002 | Invalid challenge. |
**示例:**
```
j
s
```
t
s
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
challenge
:
Uint8Array
=
new
Uint8Array
([
0
]);
try
{
...
...
@@ -5989,7 +5989,7 @@ delUser(token: Uint8Array, callback: IIdmCallback): void;
| 12300101 | Token is invalid. |
**示例:**
```
j
s
```
t
s
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
token
:
Uint8Array
=
new
Uint8Array
([
0
]);
try
{
...
...
@@ -6034,7 +6034,7 @@ delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): vo
| 12300102 | Credential not enrolled. |
**示例:**
```
j
s
```
t
s
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
credentialId
:
Uint8Array
=
new
Uint8Array
([
0
]);
let
token
:
Uint8Array
=
new
Uint8Array
([
0
]);
...
...
@@ -6076,7 +6076,7 @@ getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void;
| 12300102 | Credential not enrolled. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
try
{
...
...
@@ -6117,7 +6117,7 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCred
| 12300102 | Credential not enrolled. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
try
{
...
...
@@ -6164,7 +6164,7 @@ getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>;
| 12300102 | Credential not enrolled. |
**示例:**
```
j
s
```
t
s
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
try
{
...
...
@@ -6208,7 +6208,7 @@ onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
| 12300002 | Invalid pinSubType. |
**示例:**
```
j
s
```
t
s
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
:
Uint8Array
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
:
account_osAccount
.
IInputer
=
{
...
...
@@ -6245,7 +6245,7 @@ onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
| callback |
[
IInputData
](
#iinputdata8
)
| 是 | 指示密码数据回调。|
**示例:**
```
j
s
```
t
s
let
password
:
Uint8Array
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
:
Uint8Array
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
:
account_osAccount
.
IInputer
=
{
...
...
@@ -6286,7 +6286,7 @@ onResult: (result: number, extraInfo: AuthResult) => void;
| extraInfo |
[
AuthResult
](
#authresult8
)
| 是 | 表示不同情况下的具体信息,如果认证通过,则在extrainfo中返回认证令牌,如果身份验证失败,则在extrainfo中返回剩余的身份验证时间,如果身份验证执行器被锁定,冻结时间将在extrainfo中返回。|
**示例:**
```
j
s
```
t
s
let
authCallback
:
account_osAccount
.
IUserAuthCallback
=
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
AuthResult
)
=>
{
console
.
log
(
'
auth result =
'
+
result
);
...
...
@@ -6314,7 +6314,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| extraInfo | any | 是 | 保留参数。 |
**示例:**
```
j
s
```
t
s
let
authCallback
:
account_osAccount
.
IUserAuthCallback
=
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
AuthResult
)
=>
{
console
.
log
(
'
auth result =
'
+
result
)
...
...
@@ -6352,7 +6352,7 @@ onResult: (result: number, extraInfo: RequestResult) => void;
| extraInfo |
[
RequestResult
](
#requestresult8
)
| 是 | 针对不同情况传递具体信息。|
**示例:**
```
j
s
```
t
s
let
idmCallback
:
account_osAccount
.
IIdmCallback
=
{
onResult
:
(
result
:
number
,
extraInfo
:
account_osAccount
.
RequestResult
)
=>
{
console
.
log
(
'
callback result =
'
+
result
)
...
...
@@ -6380,7 +6380,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
| extraInfo | any | 是 | 保留参数。 |
**示例:**
```
j
s
```
t
s
let
idmCallback
:
account_osAccount
.
IIdmCallback
=
{
onResult
:
(
result
:
number
,
extraInfo
:
Object
)
=>
{
console
.
log
(
'
callback result =
'
+
result
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录