未验证 提交 1c8af3f0 编写于 作者: O openharmony_ci 提交者: Gitee

!3462 帐号子系统readme中的示例代码增加代码类型声明

Merge pull request !3462 from 张阿龙/master
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import account_appAccount from '@ohos.account.appAccount'; import account_appAccount from '@ohos.account.appAccount';
``` ```
...@@ -25,7 +25,7 @@ Creates an **AppAccountManager** instance. ...@@ -25,7 +25,7 @@ Creates an **AppAccountManager** instance.
| AppAccountManager | **AppAccountManager** instance created.| | AppAccountManager | **AppAccountManager** instance created.|
**Example** **Example**
``` ```js
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
``` ```
...@@ -50,7 +50,7 @@ Adds an app account to the account management service. This method uses an async ...@@ -50,7 +50,7 @@ Adds an app account to the account management service. This method uses an async
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("WangWu", (err) => { appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log("addAccount err: " + JSON.stringify(err));
...@@ -75,7 +75,7 @@ Adds an app account and its additional information to the account management ser ...@@ -75,7 +75,7 @@ Adds an app account and its additional information to the account management ser
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101", (err) => { appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log("addAccount err: " + JSON.stringify(err));
...@@ -107,7 +107,7 @@ Adds an app account and its additional information to the account management ser ...@@ -107,7 +107,7 @@ Adds an app account and its additional information to the account management ser
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101").then(()=> { appAccountManager.addAccount("LiSi", "token101").then(()=> {
console.log('addAccount Success'); console.log('addAccount Success');
...@@ -135,7 +135,7 @@ Implicitly adds an app account based on the specified account owner, authenticat ...@@ -135,7 +135,7 @@ Implicitly adds an app account based on the specified account owner, authenticat
**Example** **Example**
``` ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
...@@ -174,7 +174,7 @@ Deletes an app account from the account management service. This method uses an ...@@ -174,7 +174,7 @@ Deletes an app account from the account management service. This method uses an
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu", (err) => { appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err)); console.log("deleteAccount err: " + JSON.stringify(err));
...@@ -203,7 +203,7 @@ Deletes an app account from the account management service. This method uses a p ...@@ -203,7 +203,7 @@ Deletes an app account from the account management service. This method uses a p
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu").then(() => { appAccountManager.deleteAccount("ZhaoLiu").then(() => {
console.log('deleteAccount Success'); console.log('deleteAccount Success');
...@@ -230,7 +230,7 @@ Disables an app account from accessing an application with the given bundle name ...@@ -230,7 +230,7 @@ Disables an app account from accessing an application with the given bundle name
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => { appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err)); console.log("disableAppAccess err: " + JSON.stringify(err));
...@@ -260,7 +260,7 @@ Disables an app account from accessing an application with the given bundle name ...@@ -260,7 +260,7 @@ Disables an app account from accessing an application with the given bundle name
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => { appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('disableAppAccess Success'); console.log('disableAppAccess Success');
...@@ -287,7 +287,7 @@ Enables an app account to access an application with the given bundle name. This ...@@ -287,7 +287,7 @@ Enables an app account to access an application with the given bundle name. This
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => { appAccountManager.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err)); console.log("enableAppAccess: " + JSON.stringify(err));
...@@ -317,7 +317,7 @@ Enables an app account to access an application with the given bundle name. This ...@@ -317,7 +317,7 @@ Enables an app account to access an application with the given bundle name. This
**Example** **Example**
``` ```js
app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => { app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('enableAppAccess Success'); console.log('enableAppAccess Success');
}).catch((err) => { }).catch((err) => {
...@@ -344,7 +344,7 @@ Checks whether an app account allows application data synchronization. This meth ...@@ -344,7 +344,7 @@ Checks whether an app account allows application data synchronization. This meth
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => { appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err)); console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
...@@ -376,7 +376,7 @@ Checks whether an app account allows application data synchronization. This meth ...@@ -376,7 +376,7 @@ Checks whether an app account allows application data synchronization. This meth
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => { appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data); console.log('checkAppAccountSyncEnable, result: ' + data);
...@@ -404,7 +404,7 @@ Sets a credential for an app account. This method uses an asynchronous callback ...@@ -404,7 +404,7 @@ Sets a credential for an app account. This method uses an asynchronous callback
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => { appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err)); console.log("setAccountCredential err: " + JSON.stringify(err));
...@@ -435,7 +435,7 @@ Sets a credential for an app account. This method uses a promise to return the r ...@@ -435,7 +435,7 @@ Sets a credential for an app account. This method uses a promise to return the r
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => { appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
console.log('setAccountCredential Success'); console.log('setAccountCredential Success');
...@@ -462,7 +462,7 @@ Sets additional information for an app account. This method uses an asynchronous ...@@ -462,7 +462,7 @@ Sets additional information for an app account. This method uses an asynchronous
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => { appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err)); console.log("setAccountExtraInfo err: " + JSON.stringify(err));
...@@ -492,7 +492,7 @@ Sets additional information for an app account. This method uses a promise to re ...@@ -492,7 +492,7 @@ Sets additional information for an app account. This method uses a promise to re
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => { appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
console.log('setAccountExtraInfo Success'); console.log('setAccountExtraInfo Success');
...@@ -521,7 +521,7 @@ Sets whether to enable application data synchronization for an app account. This ...@@ -521,7 +521,7 @@ Sets whether to enable application data synchronization for an app account. This
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => { appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err)); console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
...@@ -553,7 +553,7 @@ Sets whether to enable application data synchronization for an app account. This ...@@ -553,7 +553,7 @@ Sets whether to enable application data synchronization for an app account. This
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => { appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
console.log('setAppAccountSyncEnable Success'); console.log('setAppAccountSyncEnable Success');
...@@ -581,7 +581,7 @@ Sets data to be associated with an app account. This method uses an asynchronous ...@@ -581,7 +581,7 @@ Sets data to be associated with an app account. This method uses an asynchronous
**Example** **Example**
``` ```js
app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => { app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err)); console.log("setAssociatedData err: " + JSON.stringify(err));
}); });
...@@ -611,7 +611,7 @@ Sets data to be associated with an app account. This method uses a promise to re ...@@ -611,7 +611,7 @@ Sets data to be associated with an app account. This method uses a promise to re
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => { appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
console.log('setAssociatedData Success'); console.log('setAssociatedData Success');
...@@ -638,7 +638,7 @@ Obtains the credential of an app account. This method uses an asynchronous callb ...@@ -638,7 +638,7 @@ Obtains the credential of an app account. This method uses an asynchronous callb
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => { appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err)); console.log("getAccountCredential err: " + JSON.stringify(err));
...@@ -669,7 +669,7 @@ Obtains the credential of an app account. This method uses a promise to return t ...@@ -669,7 +669,7 @@ Obtains the credential of an app account. This method uses a promise to return t
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => { appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
console.log('getAccountCredential, result: ' + data); console.log('getAccountCredential, result: ' + data);
...@@ -695,7 +695,7 @@ Obtains additional information of an app account. This method uses an asynchrono ...@@ -695,7 +695,7 @@ Obtains additional information of an app account. This method uses an asynchrono
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => { appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err)); console.log("getAccountExtraInfo err: " + JSON.stringify(err));
...@@ -725,7 +725,7 @@ Obtains additional information of an app account. This method uses a promise to ...@@ -725,7 +725,7 @@ Obtains additional information of an app account. This method uses a promise to
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => { appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
console.log('getAccountExtraInfo, result: ' + data); console.log('getAccountExtraInfo, result: ' + data);
...@@ -752,7 +752,7 @@ Obtains data associated with an app account. This method uses an asynchronous ca ...@@ -752,7 +752,7 @@ Obtains data associated with an app account. This method uses an asynchronous ca
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => { appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err)); console.log("getAssociatedData err: " + JSON.stringify(err));
...@@ -783,7 +783,7 @@ Obtains data associated with an app account. This method uses a promise to retur ...@@ -783,7 +783,7 @@ Obtains data associated with an app account. This method uses a promise to retur
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => { appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
console.log('getAssociatedData: ' + data); console.log('getAssociatedData: ' + data);
...@@ -810,7 +810,7 @@ Obtains information about all accessible app accounts. This method uses an async ...@@ -810,7 +810,7 @@ Obtains information about all accessible app accounts. This method uses an async
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts((err, data)=>{ appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err)); console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
...@@ -836,7 +836,7 @@ Obtains information about all accessible app accounts. This method uses an async ...@@ -836,7 +836,7 @@ Obtains information about all accessible app accounts. This method uses an async
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts().then((data) => { appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data); console.log('getAllAccessibleAccounts: ' + data);
...@@ -864,7 +864,7 @@ Obtains information about all app accounts of the specified app. This method use ...@@ -864,7 +864,7 @@ Obtains information about all app accounts of the specified app. This method use
**Example** **Example**
``` ```js
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
...@@ -897,7 +897,7 @@ Obtains information about all app accounts of the specified app. This method use ...@@ -897,7 +897,7 @@ Obtains information about all app accounts of the specified app. This method use
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle).then((data) => { appAccountManager.getAllAccounts(selfBundle).then((data) => {
...@@ -925,7 +925,7 @@ Subscribes to the account change event of the specified account owners. This met ...@@ -925,7 +925,7 @@ Subscribes to the account change event of the specified account owners. This met
**Example** **Example**
``` ```js
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug("receive change data:" + JSON.stringify(data));
...@@ -955,7 +955,7 @@ Unsubscribes from the account change event. This method uses an asynchronous cal ...@@ -955,7 +955,7 @@ Unsubscribes from the account change event. This method uses an asynchronous cal
**Example** **Example**
``` ```js
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug("receive change data:" + JSON.stringify(data));
...@@ -991,7 +991,7 @@ Authenticates an app account to obtain the Open Authorization (OAuth) access tok ...@@ -991,7 +991,7 @@ Authenticates an app account to obtain the Open Authorization (OAuth) access tok
**Example** **Example**
``` ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
...@@ -1032,7 +1032,7 @@ Obtains the OAuth access token of an app account based on the specified authenti ...@@ -1032,7 +1032,7 @@ Obtains the OAuth access token of an app account based on the specified authenti
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => { appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err)); console.log('getOAuthToken err: ' + JSON.stringify(err));
...@@ -1064,7 +1064,7 @@ Obtains the OAuth access token of an app account based on the specified authenti ...@@ -1064,7 +1064,7 @@ Obtains the OAuth access token of an app account based on the specified authenti
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => { appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthToken token: ' + data); console.log('getOAuthToken token: ' + data);
...@@ -1092,7 +1092,7 @@ Sets an OAuth access token for an app account. This method uses an asynchronous ...@@ -1092,7 +1092,7 @@ Sets an OAuth access token for an app account. This method uses an asynchronous
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => { appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err)); console.log('setOAuthToken err: ' + JSON.stringify(err));
...@@ -1123,7 +1123,7 @@ Sets an OAuth access token for an app account. This method uses a promise to ret ...@@ -1123,7 +1123,7 @@ Sets an OAuth access token for an app account. This method uses a promise to ret
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => { appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => {
console.log('setOAuthToken successfully'); console.log('setOAuthToken successfully');
...@@ -1152,7 +1152,7 @@ Deletes the specified OAuth access token for an app account. This method uses an ...@@ -1152,7 +1152,7 @@ Deletes the specified OAuth access token for an app account. This method uses an
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => { appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err)); console.log('deleteOAuthToken err: ' + JSON.stringify(err));
...@@ -1184,7 +1184,7 @@ Deletes the specified OAuth access token for an app account. This method uses a ...@@ -1184,7 +1184,7 @@ Deletes the specified OAuth access token for an app account. This method uses a
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => { appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => {
console.log('deleteOAuthToken successfully'); console.log('deleteOAuthToken successfully');
...@@ -1213,7 +1213,7 @@ Sets the visibility of an OAuth access token to the specified app. This method u ...@@ -1213,7 +1213,7 @@ Sets the visibility of an OAuth access token to the specified app. This method u
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => { appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
...@@ -1245,7 +1245,7 @@ Sets the visibility of an OAuth access token to the specified app. This method u ...@@ -1245,7 +1245,7 @@ Sets the visibility of an OAuth access token to the specified app. This method u
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => { appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully'); console.log('setOAuthTokenVisibility successfully');
...@@ -1273,7 +1273,7 @@ Checks whether an OAuth token is visible to the specified app. This method uses ...@@ -1273,7 +1273,7 @@ Checks whether an OAuth token is visible to the specified app. This method uses
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => { appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
...@@ -1305,7 +1305,7 @@ Checks whether an OAuth token is visible to the specified app. This method uses ...@@ -1305,7 +1305,7 @@ Checks whether an OAuth token is visible to the specified app. This method uses
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => { appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data); console.log('checkOAuthTokenVisibility isVisible: ' + data);
...@@ -1332,7 +1332,7 @@ Obtains information about all OAuth access tokens of an app account visible to t ...@@ -1332,7 +1332,7 @@ Obtains information about all OAuth access tokens of an app account visible to t
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => { appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err)); console.log("getAllOAuthTokens err: " + JSON.stringify(err));
...@@ -1363,7 +1363,7 @@ Obtains information about all OAuth access tokens of an app account visible to t ...@@ -1363,7 +1363,7 @@ Obtains information about all OAuth access tokens of an app account visible to t
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => { appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
...@@ -1390,7 +1390,7 @@ Obtains the authorization list of OAuth access tokens of an app account. This me ...@@ -1390,7 +1390,7 @@ Obtains the authorization list of OAuth access tokens of an app account. This me
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => { appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err)); console.log('getOAuthList err: ' + JSON.stringify(err));
...@@ -1421,7 +1421,7 @@ Obtains the authorization list of OAuth access tokens of an app account. This me ...@@ -1421,7 +1421,7 @@ Obtains the authorization list of OAuth access tokens of an app account. This me
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => { appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data)); console.log('getOAuthList data: ' + JSON.stringify(data));
...@@ -1447,7 +1447,7 @@ Obtains the authenticator callback for a session. This method uses an asynchrono ...@@ -1447,7 +1447,7 @@ Obtains the authenticator callback for a session. This method uses an asynchrono
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => { featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
...@@ -1487,7 +1487,7 @@ Obtains the authenticator callback for a session. This method uses a promise to ...@@ -1487,7 +1487,7 @@ Obtains the authenticator callback for a session. This method uses a promise to
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => { featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
...@@ -1522,7 +1522,7 @@ Obtains authenticator information of an app account. This method uses an asynchr ...@@ -1522,7 +1522,7 @@ Obtains authenticator information of an app account. This method uses an asynchr
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => { appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err)); console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
...@@ -1552,7 +1552,7 @@ Obtains authenticator information of an app account. This method uses a promise ...@@ -1552,7 +1552,7 @@ Obtains authenticator information of an app account. This method uses a promise
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => { appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data)); console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
...@@ -1663,7 +1663,7 @@ Called back to send the authentication result. ...@@ -1663,7 +1663,7 @@ Called back to send the authentication result.
**Example** **Example**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234"; var sessionId = "1234";
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
...@@ -1692,7 +1692,7 @@ Called back to redirect an authentication request. ...@@ -1692,7 +1692,7 @@ Called back to redirect an authentication request.
**Example** **Example**
``` ```js
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) { addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({ callback.onRequestRedirected({
...@@ -1749,7 +1749,7 @@ Authenticates an app account to obtain the OAuth access token. This method uses ...@@ -1749,7 +1749,7 @@ Authenticates an app account to obtain the OAuth access token. This method uses
**Example** **Example**
``` ```js
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) { addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({ callback.onRequestRedirected({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import account_distributedAccount from '@ohos.account.distributedAccount'; import account_distributedAccount from '@ohos.account.distributedAccount';
``` ```
...@@ -28,7 +28,7 @@ Obtains a **DistributedAccountAbility** instance. ...@@ -28,7 +28,7 @@ Obtains a **DistributedAccountAbility** instance.
| [DistributedAccountAbility](#distributedaccountability) | **DistributedAccountAbility** instance obtained. This instance provides methods for querying and updating the login state of a distributed account.| | [DistributedAccountAbility](#distributedaccountability) | **DistributedAccountAbility** instance obtained. This instance provides methods for querying and updating the login state of a distributed account.|
- Example - Example
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
``` ```
...@@ -50,7 +50,7 @@ Obtains distributed account information. This method uses an asynchronous callba ...@@ -50,7 +50,7 @@ Obtains distributed account information. This method uses an asynchronous callba
| callback | AsyncCallback<[DistributedInfo](#distributedinfo)> | Yes| Callback invoked to return the distributed account information obtained.| | callback | AsyncCallback<[DistributedInfo](#distributedinfo)> | Yes| Callback invoked to return the distributed account information obtained.|
- Example - Example
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => { accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err)); console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
...@@ -73,7 +73,7 @@ Obtains distributed account information. This method uses a promise to return th ...@@ -73,7 +73,7 @@ Obtains distributed account information. This method uses a promise to return th
| Promise<[DistributedInfo](#distributedinfo)> | Promise used to return the distributed account information obtained.| | Promise<[DistributedInfo](#distributedinfo)> | Promise used to return the distributed account information obtained.|
- Example - Example
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo().then((data) => { accountAbility.queryOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name); console.log('Query account info name: ' + data.name);
...@@ -98,7 +98,7 @@ Updates distributed account information. This method uses an asynchronous callba ...@@ -98,7 +98,7 @@ Updates distributed account information. This method uses an asynchronous callba
| callback | AsyncCallback<void> | Yes| Callback invoked when the distributed account information is updated.| | callback | AsyncCallback<void> | Yes| Callback invoked when the distributed account information is updated.|
- Example - Example
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => { accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
...@@ -125,7 +125,7 @@ Updates distributed account information. This method uses a promise to return th ...@@ -125,7 +125,7 @@ Updates distributed account information. This method uses a promise to return th
| Promise<void> | Promise used to return the result.| | Promise<void> | Promise used to return the result.|
- Example - Example
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => { accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import account_osAccount from '@ohos.account.osAccount'; import account_osAccount from '@ohos.account.osAccount';
``` ```
...@@ -24,7 +24,7 @@ Obtains an **AccountManager** instance. ...@@ -24,7 +24,7 @@ Obtains an **AccountManager** instance.
| [AccountManager](#accountmanager) | Obtains an **AccountManager** instance.| | [AccountManager](#accountmanager) | Obtains an **AccountManager** instance.|
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
``` ```
...@@ -64,7 +64,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -64,7 +64,7 @@ This is a system API and cannot be called by third-party applications.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**: Activate OS account 100. **Example**: Activate OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.activateOsAccount(localId, (err)=>{ accountManager.activateOsAccount(localId, (err)=>{
...@@ -97,7 +97,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -97,7 +97,7 @@ This is a system API and cannot be called by third-party applications.
| Promise<void> | Promise used to return the result.| | Promise<void> | Promise used to return the result.|
**Example**: Activate OS account 100. **Example**: Activate OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.activateOsAccount(localId).then(() => { accountManager.activateOsAccount(localId).then(() => {
...@@ -123,7 +123,7 @@ Checks whether multiple OS accounts are supported. This method uses an asynchron ...@@ -123,7 +123,7 @@ Checks whether multiple OS accounts are supported. This method uses an asynchron
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable((err, isEnabled) => { accountManager.isMultiOsAccountEnable((err, isEnabled) => {
console.log("isMultiOsAccountEnable err: " + JSON.stringify(err)); console.log("isMultiOsAccountEnable err: " + JSON.stringify(err));
...@@ -147,7 +147,7 @@ Checks whether multiple OS accounts are supported. This method uses a promise to ...@@ -147,7 +147,7 @@ Checks whether multiple OS accounts are supported. This method uses a promise to
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable().then((isEnabled) => { accountManager.isMultiOsAccountEnable().then((isEnabled) => {
console.log('isMultiOsAccountEnable, isEnabled: ' + isEnabled); console.log('isMultiOsAccountEnable, isEnabled: ' + isEnabled);
...@@ -175,7 +175,7 @@ Checks whether an OS account is activated. This method uses an asynchronous call ...@@ -175,7 +175,7 @@ Checks whether an OS account is activated. This method uses an asynchronous call
**Example**: Check whether OS account 100 is activated. **Example**: Check whether OS account 100 is activated.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var osLocalId = 100; var osLocalId = 100;
accountManager.isOsAccountActived(osLocalId, (err, isActive)=>{ accountManager.isOsAccountActived(osLocalId, (err, isActive)=>{
...@@ -208,7 +208,7 @@ Checks whether an OS account is activated. This method uses a promise to return ...@@ -208,7 +208,7 @@ Checks whether an OS account is activated. This method uses a promise to return
**Example**: Check whether OS account 100 is activated. **Example**: Check whether OS account 100 is activated.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var osLocalId = 100; var osLocalId = 100;
accountManager.isOsAccountActived(osLocalId).then((isActive) => { accountManager.isOsAccountActived(osLocalId).then((isActive) => {
...@@ -236,9 +236,9 @@ Checks whether the specified constraint is enabled for an OS account. This metho ...@@ -236,9 +236,9 @@ Checks whether the specified constraint is enabled for an OS account. This metho
| constraint | string | Yes | [Constraint](#constraints) specified. | | constraint | string | Yes | [Constraint](#constraints) specified. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the constraint is enabled for the OS account, **true** will be returned. Otherwise, **false** will be returned.| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the constraint is enabled for the OS account, **true** will be returned. Otherwise, **false** will be returned.|
** Example**: Check whether OS account 100 is forbidden to use Wi-Fi. **Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi", (err, isConstraintEnabled)=>{ accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi", (err, isConstraintEnabled)=>{
...@@ -270,9 +270,9 @@ Checks whether the specified constraint is enabled for an OS account. This metho ...@@ -270,9 +270,9 @@ Checks whether the specified constraint is enabled for an OS account. This metho
| :--------------------- | :----------------------------------------------------------- | | :--------------------- | :----------------------------------------------------------- |
| Promise<boolean> | Promise used to return the result. If the constraint is enabled for the OS account, **true** will be returned. Otherwise, **false** will be returned.| | Promise<boolean> | Promise used to return the result. If the constraint is enabled for the OS account, **true** will be returned. Otherwise, **false** will be returned.|
** Example**: Check whether OS account 100 is forbidden to use Wi-Fi. **Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi").then((isConstraintEnabled) => { accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi").then((isConstraintEnabled) => {
...@@ -298,7 +298,7 @@ Checks whether this OS account is a test account. This method uses an asynchrono ...@@ -298,7 +298,7 @@ Checks whether this OS account is a test account. This method uses an asynchrono
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount((err, isTest) => { accountManager.isTestOsAccount((err, isTest) => {
console.log("isTestOsAccount err: " + JSON.stringify(err)); console.log("isTestOsAccount err: " + JSON.stringify(err));
...@@ -322,7 +322,7 @@ Checks whether this OS account is a test account. This method uses a promise to ...@@ -322,7 +322,7 @@ Checks whether this OS account is a test account. This method uses a promise to
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount().then((isTest) => { accountManager.isTestOsAccount().then((isTest) => {
console.log('isTestOsAccount, isTest: ' + isTest); console.log('isTestOsAccount, isTest: ' + isTest);
...@@ -347,7 +347,7 @@ Checks whether this OS account has been verified. This method uses an asynchrono ...@@ -347,7 +347,7 @@ Checks whether this OS account has been verified. This method uses an asynchrono
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => { accountManager.isOsAccountVerified((err, isVerified) => {
console.log("isOsAccountVerified err: " + JSON.stringify(err)); console.log("isOsAccountVerified err: " + JSON.stringify(err));
...@@ -374,7 +374,7 @@ Checks whether an OS account has been verified. This method uses an asynchronous ...@@ -374,7 +374,7 @@ Checks whether an OS account has been verified. This method uses an asynchronous
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => { accountManager.isOsAccountVerified((err, isVerified) => {
console.log("isOsAccountVerified err: " + JSON.stringify(err)); console.log("isOsAccountVerified err: " + JSON.stringify(err));
...@@ -406,7 +406,7 @@ Checks whether an OS account has been verified. This method uses a promise to re ...@@ -406,7 +406,7 @@ Checks whether an OS account has been verified. This method uses a promise to re
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified().then((isVerified) => { accountManager.isOsAccountVerified().then((isVerified) => {
console.log('isOsAccountVerified, isVerified: ' + isVerified); console.log('isOsAccountVerified, isVerified: ' + isVerified);
...@@ -436,7 +436,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -436,7 +436,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var createIocalId; var createIocalId;
osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
...@@ -473,7 +473,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -473,7 +473,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var createIocalId; var createIocalId;
osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
...@@ -508,9 +508,9 @@ This is a system API and cannot be called by third-party applications. ...@@ -508,9 +508,9 @@ This is a system API and cannot be called by third-party applications.
| enable | boolean | Yes | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints. | | enable | boolean | Yes | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. |
** Example**: Disable Wi-Fi for OS account 100. **Example**: Disable Wi-Fi for OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.setOsAccountConstraints(localId, ["constraint.wifi"], true, (err)=>{ accountManager.setOsAccountConstraints(localId, ["constraint.wifi"], true, (err)=>{
...@@ -546,7 +546,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -546,7 +546,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Remote the constraint on the use of Wi-Fi for OS account 100. **Example**: Remote the constraint on the use of Wi-Fi for OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.setOsAccountConstraints(localId, ["constraint.location.set"], false).then(() => { accountManager.setOsAccountConstraints(localId, ["constraint.location.set"], false).then(() => {
...@@ -578,7 +578,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -578,7 +578,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Set the name of OS account 100 to **demoName**. **Example**: Set the name of OS account 100 to **demoName**.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var newName = "demoName"; var newName = "demoName";
...@@ -614,7 +614,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -614,7 +614,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Set the name of OS account 100 to **demoName**. **Example**: Set the name of OS account 100 to **demoName**.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var nameLimit = "demoName"; var nameLimit = "demoName";
...@@ -643,7 +643,7 @@ Obtains the number of OS accounts created. This method uses an asynchronous call ...@@ -643,7 +643,7 @@ Obtains the number of OS accounts created. This method uses an asynchronous call
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount((err, accountCnt)=>{ accountManager.getCreatedOsAccountsCount((err, accountCnt)=>{
console.log("obtains the number of all os accounts created err:" + JSON.stringify(err)); console.log("obtains the number of all os accounts created err:" + JSON.stringify(err));
...@@ -669,7 +669,7 @@ Obtains the number of OS accounts created. This method uses a promise to return ...@@ -669,7 +669,7 @@ Obtains the number of OS accounts created. This method uses a promise to return
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount().then((accountCnt) => { accountManager.getCreatedOsAccountsCount().then((accountCnt) => {
console.log('getCreatedOsAccountsCount, accountCnt: ' + accountCnt); console.log('getCreatedOsAccountsCount, accountCnt: ' + accountCnt);
...@@ -694,7 +694,7 @@ Obtains the ID of the OS account to which the current process belongs. This meth ...@@ -694,7 +694,7 @@ Obtains the ID of the OS account to which the current process belongs. This meth
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess((err, accountID) => { accountManager.getOsAccountLocalIdFromProcess((err, accountID) => {
console.log("getOsAccountLocalIdFromProcess err: " + JSON.stringify(err)); console.log("getOsAccountLocalIdFromProcess err: " + JSON.stringify(err));
...@@ -718,7 +718,7 @@ Obtains the ID of the OS account to which the current process belongs. This meth ...@@ -718,7 +718,7 @@ Obtains the ID of the OS account to which the current process belongs. This meth
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess().then((accountID) => { accountManager.getOsAccountLocalIdFromProcess().then((accountID) => {
console.log('getOsAccountLocalIdFromProcess, accountID: ' + accountID); console.log('getOsAccountLocalIdFromProcess, accountID: ' + accountID);
...@@ -744,7 +744,7 @@ Obtains the OS account ID based on the process UID. This method uses an asynchro ...@@ -744,7 +744,7 @@ Obtains the OS account ID based on the process UID. This method uses an asynchro
**Example**: Obtain the ID of the OS account whose process UID is **12345678**. **Example**: Obtain the ID of the OS account whose process UID is **12345678**.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
let uid = 12345678; let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid, (err, accountID) => { accountManager.getOsAccountLocalIdFromUid(uid, (err, accountID) => {
...@@ -775,7 +775,7 @@ Obtains the OS account ID based on the process UID. This method uses a promise t ...@@ -775,7 +775,7 @@ Obtains the OS account ID based on the process UID. This method uses a promise t
**Example**: Obtain the ID of the OS account whose process UID is **12345678**. **Example**: Obtain the ID of the OS account whose process UID is **12345678**.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
let uid = 12345678; let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid).then((accountID) => { accountManager.getOsAccountLocalIdFromUid(uid).then((accountID) => {
...@@ -804,7 +804,7 @@ Obtains the OS account ID based on domain account information. This method uses ...@@ -804,7 +804,7 @@ Obtains the OS account ID based on domain account information. This method uses
**Example** **Example**
``` ```js
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, accountID) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, accountID) => {
...@@ -837,7 +837,7 @@ Obtains the OS account ID based on domain account information. This method uses ...@@ -837,7 +837,7 @@ Obtains the OS account ID based on domain account information. This method uses
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((accountID) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((accountID) => {
...@@ -865,7 +865,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -865,7 +865,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryMaxOsAccountNumber((err, maxCnt)=>{ accountManager.queryMaxOsAccountNumber((err, maxCnt)=>{
console.log("queryMaxOsAccountNumber err:" + JSON.stringify(err)); console.log("queryMaxOsAccountNumber err:" + JSON.stringify(err));
...@@ -891,7 +891,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -891,7 +891,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryMaxOsAccountNumber().then((maxCnt) => { accountManager.queryMaxOsAccountNumber().then((maxCnt) => {
console.log('queryMaxOsAccountNumber, maxCnt: ' + maxCnt); console.log('queryMaxOsAccountNumber, maxCnt: ' + maxCnt);
...@@ -917,9 +917,9 @@ Obtains all constraints enabled for an OS account. This method uses an asynchron ...@@ -917,9 +917,9 @@ Obtains all constraints enabled for an OS account. This method uses an asynchron
| localId | number | Yes | ID of the target OS account. | | localId | number | Yes | ID of the target OS account. |
| callback | AsyncCallback<Array<string>> | Yes | Callback used to return all [constraints](#constraints) obtained.| | callback | AsyncCallback<Array<string>> | Yes | Callback used to return all [constraints](#constraints) obtained.|
** Example**: Obtain all constraints of OS account 100. **Example**: Obtain all constraints of OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountAllConstraints(localId, (err, constraints)=>{ accountManager.getOsAccountAllConstraints(localId, (err, constraints)=>{
...@@ -950,9 +950,9 @@ Obtains all constraints enabled for an OS account. This method uses a promise to ...@@ -950,9 +950,9 @@ Obtains all constraints enabled for an OS account. This method uses a promise to
| :--------------------------------- | :----------------------------------------------------------- | | :--------------------------------- | :----------------------------------------------------------- |
| Promise<Array<string>> | Promise used to return the [constraints](#constraints) obtained.| | Promise<Array<string>> | Promise used to return the [constraints](#constraints) obtained.|
** Example**: Obtain all constraints of OS account 100. **Example**: Obtain all constraints of OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountAllConstraints(localId).then((constraints) => { accountManager.getOsAccountAllConstraints(localId).then((constraints) => {
...@@ -980,7 +980,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -980,7 +980,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryAllCreatedOsAccounts((err, accountArr)=>{ accountManager.queryAllCreatedOsAccounts((err, accountArr)=>{
console.log("queryAllCreatedOsAccounts err:" + JSON.stringify(err)); console.log("queryAllCreatedOsAccounts err:" + JSON.stringify(err));
...@@ -1006,7 +1006,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1006,7 +1006,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryAllCreatedOsAccounts().then((accountArr) => { accountManager.queryAllCreatedOsAccounts().then((accountArr) => {
console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr)); console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr));
...@@ -1031,7 +1031,7 @@ Obtains information about all activated OS accounts. This method uses an asynchr ...@@ -1031,7 +1031,7 @@ Obtains information about all activated OS accounts. This method uses an asynchr
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds((err, idArray)=>{ accountManager.queryActivatedOsAccountIds((err, idArray)=>{
console.log("queryActivatedOsAccountIds err:" + JSON.stringify(err)); console.log("queryActivatedOsAccountIds err:" + JSON.stringify(err));
...@@ -1058,7 +1058,7 @@ Obtains information about all activated OS accounts. This method uses a promise ...@@ -1058,7 +1058,7 @@ Obtains information about all activated OS accounts. This method uses a promise
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds().then((idArray) => { accountManager.queryActivatedOsAccountIds().then((idArray) => {
console.log('queryActivatedOsAccountIds, idArray: ' + idArray); console.log('queryActivatedOsAccountIds, idArray: ' + idArray);
...@@ -1089,7 +1089,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1089,7 +1089,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.createOsAccount("testName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ accountManager.createOsAccount("testName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
console.log("createOsAccount err:" + JSON.stringify(err)); console.log("createOsAccount err:" + JSON.stringify(err));
...@@ -1124,7 +1124,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1124,7 +1124,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL).then((accountInfo) => { accountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL).then((accountInfo) => {
console.log("createOsAccount, accountInfo: " + JSON.stringify(accountInfo)); console.log("createOsAccount, accountInfo: " + JSON.stringify(accountInfo));
...@@ -1155,7 +1155,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1155,7 +1155,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo, (err, osAccountInfo)=>{ accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo, (err, osAccountInfo)=>{
...@@ -1191,7 +1191,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1191,7 +1191,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => { accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => {
...@@ -1219,7 +1219,7 @@ Obtains information about the OS account to which the current process belongs. T ...@@ -1219,7 +1219,7 @@ Obtains information about the OS account to which the current process belongs. T
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount((err, curAccountInfo)=>{ accountManager.queryCurrentOsAccount((err, curAccountInfo)=>{
console.log("queryCurrentOsAccount err:" + JSON.stringify(err)); console.log("queryCurrentOsAccount err:" + JSON.stringify(err));
...@@ -1245,7 +1245,7 @@ Obtains information about the OS account to which the current process belongs. T ...@@ -1245,7 +1245,7 @@ Obtains information about the OS account to which the current process belongs. T
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount().then((accountInfo) => { accountManager.queryCurrentOsAccount().then((accountInfo) => {
console.log("queryCurrentOsAccount, accountInfo: " + JSON.stringify(accountInfo)); console.log("queryCurrentOsAccount, accountInfo: " + JSON.stringify(accountInfo));
...@@ -1275,7 +1275,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1275,7 +1275,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Query information about OS account 100. **Example**: Query information about OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.queryOsAccountById(localId, (err, accountInfo)=>{ accountManager.queryOsAccountById(localId, (err, accountInfo)=>{
...@@ -1310,7 +1310,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1310,7 +1310,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Query information about OS account 100. **Example**: Query information about OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.queryOsAccountById(localId).then((accountInfo) => { accountManager.queryOsAccountById(localId).then((accountInfo) => {
...@@ -1336,7 +1336,7 @@ Obtains the type of the OS account to which the current process belongs. This me ...@@ -1336,7 +1336,7 @@ Obtains the type of the OS account to which the current process belongs. This me
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess((err, accountType) => { accountManager.getOsAccountTypeFromProcess((err, accountType) => {
console.log("getOsAccountTypeFromProcess err: " + JSON.stringify(err)); console.log("getOsAccountTypeFromProcess err: " + JSON.stringify(err));
...@@ -1360,7 +1360,7 @@ Obtains the type of the OS account to which the current process belongs. This me ...@@ -1360,7 +1360,7 @@ Obtains the type of the OS account to which the current process belongs. This me
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess().then((accountType) => { accountManager.getOsAccountTypeFromProcess().then((accountType) => {
console.log('getOsAccountTypeFromProcess, accountType: ' + accountType); console.log('getOsAccountTypeFromProcess, accountType: ' + accountType);
...@@ -1387,7 +1387,7 @@ Obtains the ID of this distributed virtual device. This method uses an asynchron ...@@ -1387,7 +1387,7 @@ Obtains the ID of this distributed virtual device. This method uses an asynchron
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId((err, virtualID) => { accountManager.getDistributedVirtualDeviceId((err, virtualID) => {
console.log("getDistributedVirtualDeviceId err: " + JSON.stringify(err)); console.log("getDistributedVirtualDeviceId err: " + JSON.stringify(err));
...@@ -1413,7 +1413,7 @@ Obtains the ID of this distributed virtual device. This method uses a promise to ...@@ -1413,7 +1413,7 @@ Obtains the ID of this distributed virtual device. This method uses a promise to
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId().then((virtualID) => { accountManager.getDistributedVirtualDeviceId().then((virtualID) => {
console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID); console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID);
...@@ -1443,7 +1443,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1443,7 +1443,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Obtain the profile photo of OS account 100. **Example**: Obtain the profile photo of OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountProfilePhoto(localId, (err, photo)=>{ accountManager.getOsAccountProfilePhoto(localId, (err, photo)=>{
...@@ -1478,7 +1478,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1478,7 +1478,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Obtain the profile photo of OS account 100. **Example**: Obtain the profile photo of OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountProfilePhoto(localId).then((photo) => { accountManager.getOsAccountProfilePhoto(localId).then((photo) => {
...@@ -1510,7 +1510,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1510,7 +1510,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Set a profile photo for OS account 100. **Example**: Set a profile photo for OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+ var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
...@@ -1549,7 +1549,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1549,7 +1549,7 @@ This is a system API and cannot be called by third-party applications.
**Example**: Set a profile photo for OS account 100. **Example**: Set a profile photo for OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+ var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
...@@ -1580,7 +1580,7 @@ Obtains the OS account ID based on the SN. This method uses an asynchronous call ...@@ -1580,7 +1580,7 @@ Obtains the OS account ID based on the SN. This method uses an asynchronous call
**Example**: Obtain the ID of the OS account whose SN is **12345**. **Example**: Obtain the ID of the OS account whose SN is **12345**.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var serialNumber = 12345; var serialNumber = 12345;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{
...@@ -1611,7 +1611,7 @@ Obtains the OS account ID based on the SN. This method uses a promise to return ...@@ -1611,7 +1611,7 @@ Obtains the OS account ID based on the SN. This method uses a promise to return
**Example**: Obtain the ID of the OS account whose SN is **12345**. **Example**: Obtain the ID of the OS account whose SN is **12345**.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var serialNumber = 12345; var serialNumber = 12345;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => { accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => {
...@@ -1638,7 +1638,7 @@ Obtains the SN of an OS account based on the account ID. This method uses an asy ...@@ -1638,7 +1638,7 @@ Obtains the SN of an OS account based on the account ID. This method uses an asy
**Example**: Obtain the SN of OS account 100. **Example**: Obtain the SN of OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ accountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
...@@ -1669,7 +1669,7 @@ Obtains the SN of an OS account based on the account ID. This method uses a prom ...@@ -1669,7 +1669,7 @@ Obtains the SN of an OS account based on the account ID. This method uses a prom
**Example**: Obtain the SN of OS account 100. **Example**: Obtain the SN of OS account 100.
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => { accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => {
...@@ -1701,7 +1701,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1701,7 +1701,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
function onCallback(receiveLocalId){ function onCallback(receiveLocalId){
console.log("receive localId:" + receiveLocalId); console.log("receive localId:" + receiveLocalId);
...@@ -1731,7 +1731,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -1731,7 +1731,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
function offCallback(){ function offCallback(){
console.log("off enter") console.log("off enter")
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## 导入模块 ## 导入模块
``` ```js
import account_appAccount from '@ohos.account.appAccount'; import account_appAccount from '@ohos.account.appAccount';
``` ```
...@@ -25,7 +25,7 @@ createAppAccountManager(): AppAccountManager ...@@ -25,7 +25,7 @@ createAppAccountManager(): AppAccountManager
| AppAccountManager | 获取应用帐号模块的实例。 | | AppAccountManager | 获取应用帐号模块的实例。 |
**示例:** **示例:**
``` ```js
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
``` ```
...@@ -50,7 +50,7 @@ addAccount(name: string, callback: AsyncCallback<void>): void ...@@ -50,7 +50,7 @@ addAccount(name: string, callback: AsyncCallback<void>): void
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("WangWu", (err) => { appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log("addAccount err: " + JSON.stringify(err));
...@@ -75,7 +75,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>) ...@@ -75,7 +75,7 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>)
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101", (err) => { appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log("addAccount err: " + JSON.stringify(err));
...@@ -107,7 +107,7 @@ addAccount(name: string, extraInfo?: string): Promise<void> ...@@ -107,7 +107,7 @@ addAccount(name: string, extraInfo?: string): Promise<void>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101").then(()=> { appAccountManager.addAccount("LiSi", "token101").then(()=> {
console.log('addAccount Success'); console.log('addAccount Success');
...@@ -135,7 +135,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -135,7 +135,7 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
**示例:** **示例:**
``` ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
...@@ -174,7 +174,7 @@ deleteAccount(name: string, callback: AsyncCallback<void>): void ...@@ -174,7 +174,7 @@ deleteAccount(name: string, callback: AsyncCallback<void>): void
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu", (err) => { appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err)); console.log("deleteAccount err: " + JSON.stringify(err));
...@@ -203,7 +203,7 @@ deleteAccount(name: string): Promise<void> ...@@ -203,7 +203,7 @@ deleteAccount(name: string): Promise<void>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu").then(() => { appAccountManager.deleteAccount("ZhaoLiu").then(() => {
console.log('deleteAccount Success'); console.log('deleteAccount Success');
...@@ -230,7 +230,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<vo ...@@ -230,7 +230,7 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<vo
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => { appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err)); console.log("disableAppAccess err: " + JSON.stringify(err));
...@@ -260,7 +260,7 @@ disableAppAccess(name: string, bundleName: string): Promise<void> ...@@ -260,7 +260,7 @@ disableAppAccess(name: string, bundleName: string): Promise<void>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => { appAccountManager.disableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('disableAppAccess Success'); console.log('disableAppAccess Success');
...@@ -287,7 +287,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<voi ...@@ -287,7 +287,7 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<voi
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => { appAccountManager.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err)); console.log("enableAppAccess: " + JSON.stringify(err));
...@@ -317,7 +317,7 @@ enableAppAccess(name: string, bundleName: string): Promise<void> ...@@ -317,7 +317,7 @@ enableAppAccess(name: string, bundleName: string): Promise<void>
**示例:** **示例:**
``` ```js
app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => { app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
console.log('enableAppAccess Success'); console.log('enableAppAccess Success');
}).catch((err) => { }).catch((err) => {
...@@ -344,7 +344,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>): ...@@ -344,7 +344,7 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>):
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => { appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err)); console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
...@@ -376,7 +376,7 @@ checkAppAccountSyncEnable(name: string): Promise<boolean> ...@@ -376,7 +376,7 @@ checkAppAccountSyncEnable(name: string): Promise<boolean>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => { appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data); console.log('checkAppAccountSyncEnable, result: ' + data);
...@@ -404,7 +404,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca ...@@ -404,7 +404,7 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => { appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err)); console.log("setAccountCredential err: " + JSON.stringify(err));
...@@ -435,7 +435,7 @@ setAccountCredential(name: string, credentialType: string, credential: string): ...@@ -435,7 +435,7 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => { appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
console.log('setAccountCredential Success'); console.log('setAccountCredential Success');
...@@ -462,7 +462,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback< ...@@ -462,7 +462,7 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback<
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => { appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err)); console.log("setAccountExtraInfo err: " + JSON.stringify(err));
...@@ -492,7 +492,7 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise<void> ...@@ -492,7 +492,7 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise<void>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => { appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
console.log('setAccountExtraInfo Success'); console.log('setAccountExtraInfo Success');
...@@ -521,7 +521,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback ...@@ -521,7 +521,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => { appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err)); console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
...@@ -553,7 +553,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void> ...@@ -553,7 +553,7 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => { appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
console.log('setAppAccountSyncEnable Success'); console.log('setAppAccountSyncEnable Success');
...@@ -581,7 +581,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb ...@@ -581,7 +581,7 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**示例:** **示例:**
``` ```js
app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => { app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err)); console.log("setAssociatedData err: " + JSON.stringify(err));
}); });
...@@ -611,7 +611,7 @@ setAssociatedData(name: string, key: string, value: string): Promise<void> ...@@ -611,7 +611,7 @@ setAssociatedData(name: string, key: string, value: string): Promise<void>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => { appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
console.log('setAssociatedData Success'); console.log('setAssociatedData Success');
...@@ -638,7 +638,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba ...@@ -638,7 +638,7 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => { appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err)); console.log("getAccountCredential err: " + JSON.stringify(err));
...@@ -669,7 +669,7 @@ getAccountCredential(name: string, credentialType: string): Promise<string&gt ...@@ -669,7 +669,7 @@ getAccountCredential(name: string, credentialType: string): Promise<string&gt
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => { appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
console.log('getAccountCredential, result: ' + data); console.log('getAccountCredential, result: ' + data);
...@@ -695,7 +695,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void ...@@ -695,7 +695,7 @@ getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => { appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err)); console.log("getAccountExtraInfo err: " + JSON.stringify(err));
...@@ -725,7 +725,7 @@ getAccountExtraInfo(name: string): Promise<string> ...@@ -725,7 +725,7 @@ getAccountExtraInfo(name: string): Promise<string>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => { appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
console.log('getAccountExtraInfo, result: ' + data); console.log('getAccountExtraInfo, result: ' + data);
...@@ -752,7 +752,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback<string&g ...@@ -752,7 +752,7 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback<string&g
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => { appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err)); console.log("getAssociatedData err: " + JSON.stringify(err));
...@@ -783,7 +783,7 @@ getAssociatedData(name: string, key: string): Promise<string> ...@@ -783,7 +783,7 @@ getAssociatedData(name: string, key: string): Promise<string>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => { appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
console.log('getAssociatedData: ' + data); console.log('getAssociatedData: ' + data);
...@@ -810,7 +810,7 @@ getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>& ...@@ -810,7 +810,7 @@ getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>&
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts((err, data)=>{ appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err)); console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
...@@ -836,7 +836,7 @@ getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>> ...@@ -836,7 +836,7 @@ getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts().then((data) => { appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data); console.log('getAllAccessibleAccounts: ' + data);
...@@ -864,7 +864,7 @@ getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo ...@@ -864,7 +864,7 @@ getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo
**示例:** **示例:**
``` ```js
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
...@@ -897,7 +897,7 @@ getAllAccounts(owner: string): Promise<Array<AppAccountInfo>> ...@@ -897,7 +897,7 @@ getAllAccounts(owner: string): Promise<Array<AppAccountInfo>>
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle).then((data) => { appAccountManager.getAllAccounts(selfBundle).then((data) => {
...@@ -925,7 +925,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A ...@@ -925,7 +925,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A
**示例:** **示例:**
``` ```js
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug("receive change data:" + JSON.stringify(data));
...@@ -955,7 +955,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void ...@@ -955,7 +955,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
**示例:** **示例:**
``` ```js
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug("receive change data:" + JSON.stringify(data));
...@@ -991,7 +991,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri ...@@ -991,7 +991,7 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
**示例:** **示例:**
``` ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
function onResultCallback(code, result) { function onResultCallback(code, result) {
...@@ -1032,7 +1032,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall ...@@ -1032,7 +1032,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => { appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err)); console.log('getOAuthToken err: ' + JSON.stringify(err));
...@@ -1064,7 +1064,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string& ...@@ -1064,7 +1064,7 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => { appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthToken token: ' + data); console.log('getOAuthToken token: ' + data);
...@@ -1092,7 +1092,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall ...@@ -1092,7 +1092,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => { appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err)); console.log('setOAuthToken err: ' + JSON.stringify(err));
...@@ -1123,7 +1123,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt ...@@ -1123,7 +1123,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => { appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => {
console.log('setOAuthToken successfully'); console.log('setOAuthToken successfully');
...@@ -1152,7 +1152,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c ...@@ -1152,7 +1152,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => { appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err)); console.log('deleteOAuthToken err: ' + JSON.stringify(err));
...@@ -1184,7 +1184,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string): ...@@ -1184,7 +1184,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => { appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => {
console.log('deleteOAuthToken successfully'); console.log('deleteOAuthToken successfully');
...@@ -1213,7 +1213,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1213,7 +1213,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => { appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
...@@ -1245,7 +1245,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1245,7 +1245,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => { appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully'); console.log('setOAuthTokenVisibility successfully');
...@@ -1273,7 +1273,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca ...@@ -1273,7 +1273,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => { appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
...@@ -1305,7 +1305,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P ...@@ -1305,7 +1305,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => { appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data); console.log('checkOAuthTokenVisibility isVisible: ' + data);
...@@ -1332,7 +1332,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array& ...@@ -1332,7 +1332,7 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => { appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err)); console.log("getAllOAuthTokens err: " + JSON.stringify(err));
...@@ -1363,7 +1363,7 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn ...@@ -1363,7 +1363,7 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => { appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
...@@ -1390,7 +1390,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt ...@@ -1390,7 +1390,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => { appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err)); console.log('getOAuthList err: ' + JSON.stringify(err));
...@@ -1421,7 +1421,7 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt; ...@@ -1421,7 +1421,7 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => { appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data)); console.log('getOAuthList data: ' + JSON.stringify(data));
...@@ -1447,7 +1447,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic ...@@ -1447,7 +1447,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => { featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
...@@ -1487,7 +1487,7 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt ...@@ -1487,7 +1487,7 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => { featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
...@@ -1522,7 +1522,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo ...@@ -1522,7 +1522,7 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => { appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err)); console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
...@@ -1552,7 +1552,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -1552,7 +1552,7 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => { appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data)); console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
...@@ -1663,7 +1663,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void ...@@ -1663,7 +1663,7 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void
**示例:** **示例:**
``` ```js
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234"; var sessionId = "1234";
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
...@@ -1692,7 +1692,7 @@ onRequestRedirected: (request: Want) =&gt; void ...@@ -1692,7 +1692,7 @@ onRequestRedirected: (request: Want) =&gt; void
**示例:** **示例:**
``` ```js
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) { addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({ callback.onRequestRedirected({
...@@ -1749,7 +1749,7 @@ authenticate(name: string, authType: string, callerBundleName: string, options: ...@@ -1749,7 +1749,7 @@ authenticate(name: string, authType: string, callerBundleName: string, options:
**示例:** **示例:**
``` ```js
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) { addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({ callback.onRequestRedirected({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## 导入模块 ## 导入模块
``` ```js
import account_distributedAccount from '@ohos.account.distributedAccount'; import account_distributedAccount from '@ohos.account.distributedAccount';
``` ```
...@@ -28,7 +28,7 @@ getDistributedAccountAbility(): DistributedAccountAbility ...@@ -28,7 +28,7 @@ getDistributedAccountAbility(): DistributedAccountAbility
| [DistributedAccountAbility](#distributedaccountability) | 返回一个实例,实例提供查询和更新分布式帐号登录状态方法。 | | [DistributedAccountAbility](#distributedaccountability) | 返回一个实例,实例提供查询和更新分布式帐号登录状态方法。 |
- 示例: - 示例:
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
``` ```
...@@ -50,7 +50,7 @@ queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): v ...@@ -50,7 +50,7 @@ queryOsAccountDistributedInfo(callback: AsyncCallback&lt;DistributedInfo&gt;): v
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | 是 | 获取分布式帐号信息的回调。 | | callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | 是 | 获取分布式帐号信息的回调。 |
- 示例: - 示例:
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo((err, data) => { accountAbility.queryOsAccountDistributedInfo((err, data) => {
console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err)); console.log("queryOsAccountDistributedInfo err: " + JSON.stringify(err));
...@@ -73,7 +73,7 @@ queryOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt; ...@@ -73,7 +73,7 @@ queryOsAccountDistributedInfo(): Promise&lt;DistributedInfo&gt;
| Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;[DistributedInfo](#distributedinfo)&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: - 示例:
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
accountAbility.queryOsAccountDistributedInfo().then((data) => { accountAbility.queryOsAccountDistributedInfo().then((data) => {
console.log('Query account info name: ' + data.name); console.log('Query account info name: ' + data.name);
...@@ -98,7 +98,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall ...@@ -98,7 +98,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall
| callback | AsyncCallback&lt;void&gt; | 是 | 更新分布式帐号信息的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 更新分布式帐号信息的回调。 |
- 示例: - 示例:
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => { accountAbility.updateOsAccountDistributedInfo(accountInfo, (err) => {
...@@ -125,7 +125,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt ...@@ -125,7 +125,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise&lt;void&gt
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: - 示例:
``` ```js
const accountAbility = account_distributedAccount.getDistributedAccountAbility(); const accountAbility = account_distributedAccount.getDistributedAccountAbility();
let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'}; let accountInfo = {id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN'};
accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => { accountAbility.updateOsAccountDistributedInfo(accountInfo).then(() => {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## 导入模块 ## 导入模块
``` ```js
import account_osAccount from '@ohos.account.osAccount'; import account_osAccount from '@ohos.account.osAccount';
``` ```
...@@ -24,7 +24,7 @@ getAccountManager(): AccountManager ...@@ -24,7 +24,7 @@ getAccountManager(): AccountManager
| [AccountManager](#accountmanager) | 获取系统帐号能力的实例。 | | [AccountManager](#accountmanager) | 获取系统帐号能力的实例。 |
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
``` ```
...@@ -64,7 +64,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -64,7 +64,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
**示例:**激活ID为100的系统帐号 **示例:**激活ID为100的系统帐号
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.activateOsAccount(localId, (err)=>{ accountManager.activateOsAccount(localId, (err)=>{
...@@ -97,7 +97,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt; ...@@ -97,7 +97,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt;
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**激活ID为100的系统帐号 **示例:**激活ID为100的系统帐号
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.activateOsAccount(localId).then(() => { accountManager.activateOsAccount(localId).then(() => {
...@@ -123,7 +123,7 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -123,7 +123,7 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable((err, isEnabled) => { accountManager.isMultiOsAccountEnable((err, isEnabled) => {
console.log("isMultiOsAccountEnable err: " + JSON.stringify(err)); console.log("isMultiOsAccountEnable err: " + JSON.stringify(err));
...@@ -147,7 +147,7 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt; ...@@ -147,7 +147,7 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable().then((isEnabled) => { accountManager.isMultiOsAccountEnable().then((isEnabled) => {
console.log('isMultiOsAccountEnable, isEnabled: ' + isEnabled); console.log('isMultiOsAccountEnable, isEnabled: ' + isEnabled);
...@@ -175,7 +175,7 @@ isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): voi ...@@ -175,7 +175,7 @@ isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): voi
**示例:**判断ID为100的系统帐号是否处于激活状态 **示例:**判断ID为100的系统帐号是否处于激活状态
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var osLocalId = 100; var osLocalId = 100;
accountManager.isOsAccountActived(osLocalId, (err, isActive)=>{ accountManager.isOsAccountActived(osLocalId, (err, isActive)=>{
...@@ -208,7 +208,7 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt; ...@@ -208,7 +208,7 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt;
**示例:**判断ID为100的系统帐号是否处于激活状态 **示例:**判断ID为100的系统帐号是否处于激活状态
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var osLocalId = 100; var osLocalId = 100;
accountManager.isOsAccountActived(osLocalId).then((isActive) => { accountManager.isOsAccountActived(osLocalId).then((isActive) => {
...@@ -238,7 +238,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async ...@@ -238,7 +238,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
**示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束 **示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi", (err, isConstraintEnabled)=>{ accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi", (err, isConstraintEnabled)=>{
...@@ -272,7 +272,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boo ...@@ -272,7 +272,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boo
**示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束 **示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi").then((isConstraintEnabled) => { accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi").then((isConstraintEnabled) => {
...@@ -298,7 +298,7 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -298,7 +298,7 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount((err, isTest) => { accountManager.isTestOsAccount((err, isTest) => {
console.log("isTestOsAccount err: " + JSON.stringify(err)); console.log("isTestOsAccount err: " + JSON.stringify(err));
...@@ -322,7 +322,7 @@ isTestOsAccount(): Promise&lt;boolean&gt; ...@@ -322,7 +322,7 @@ isTestOsAccount(): Promise&lt;boolean&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount().then((isTest) => { accountManager.isTestOsAccount().then((isTest) => {
console.log('isTestOsAccount, isTest: ' + isTest); console.log('isTestOsAccount, isTest: ' + isTest);
...@@ -347,7 +347,7 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -347,7 +347,7 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => { accountManager.isOsAccountVerified((err, isVerified) => {
console.log("isOsAccountVerified err: " + JSON.stringify(err)); console.log("isOsAccountVerified err: " + JSON.stringify(err));
...@@ -374,7 +374,7 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo ...@@ -374,7 +374,7 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => { accountManager.isOsAccountVerified((err, isVerified) => {
console.log("isOsAccountVerified err: " + JSON.stringify(err)); console.log("isOsAccountVerified err: " + JSON.stringify(err));
...@@ -406,7 +406,7 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt; ...@@ -406,7 +406,7 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified().then((isVerified) => { accountManager.isOsAccountVerified().then((isVerified) => {
console.log('isOsAccountVerified, isVerified: ' + isVerified); console.log('isOsAccountVerified, isVerified: ' + isVerified);
...@@ -436,7 +436,7 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -436,7 +436,7 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var createIocalId; var createIocalId;
osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
...@@ -473,7 +473,7 @@ removeOsAccount(localId: number): Promise&lt;void&gt; ...@@ -473,7 +473,7 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var createIocalId; var createIocalId;
osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
...@@ -510,7 +510,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl ...@@ -510,7 +510,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
**示例:**给ID为100的系统帐号设置禁止使用wifi的约束 **示例:**给ID为100的系统帐号设置禁止使用wifi的约束
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.setOsAccountConstraints(localId, ["constraint.wifi"], true, (err)=>{ accountManager.setOsAccountConstraints(localId, ["constraint.wifi"], true, (err)=>{
...@@ -546,7 +546,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl ...@@ -546,7 +546,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
**示例:**删除ID为100的系统帐号的禁止使用wifi的约束 **示例:**删除ID为100的系统帐号的禁止使用wifi的约束
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.setOsAccountConstraints(localId, ["constraint.location.set"], false).then(() => { accountManager.setOsAccountConstraints(localId, ["constraint.location.set"], false).then(() => {
...@@ -578,7 +578,7 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt; ...@@ -578,7 +578,7 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;
**示例:**将ID为100的系统帐号的帐号名设置成demoName **示例:**将ID为100的系统帐号的帐号名设置成demoName
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var newName = "demoName"; var newName = "demoName";
...@@ -614,7 +614,7 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt; ...@@ -614,7 +614,7 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
**示例:**将ID为100的系统帐号的帐号名设置成demoName **示例:**将ID为100的系统帐号的帐号名设置成demoName
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var nameLimit = "demoName"; var nameLimit = "demoName";
...@@ -643,7 +643,7 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void ...@@ -643,7 +643,7 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount((err, accountCnt)=>{ accountManager.getCreatedOsAccountsCount((err, accountCnt)=>{
console.log("obtains the number of all os accounts created err:" + JSON.stringify(err)); console.log("obtains the number of all os accounts created err:" + JSON.stringify(err));
...@@ -669,7 +669,7 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt; ...@@ -669,7 +669,7 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount().then((accountCnt) => { accountManager.getCreatedOsAccountsCount().then((accountCnt) => {
console.log('getCreatedOsAccountsCount, accountCnt: ' + accountCnt); console.log('getCreatedOsAccountsCount, accountCnt: ' + accountCnt);
...@@ -694,7 +694,7 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void ...@@ -694,7 +694,7 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess((err, accountID) => { accountManager.getOsAccountLocalIdFromProcess((err, accountID) => {
console.log("getOsAccountLocalIdFromProcess err: " + JSON.stringify(err)); console.log("getOsAccountLocalIdFromProcess err: " + JSON.stringify(err));
...@@ -718,7 +718,7 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt; ...@@ -718,7 +718,7 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess().then((accountID) => { accountManager.getOsAccountLocalIdFromProcess().then((accountID) => {
console.log('getOsAccountLocalIdFromProcess, accountID: ' + accountID); console.log('getOsAccountLocalIdFromProcess, accountID: ' + accountID);
...@@ -744,7 +744,7 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;): ...@@ -744,7 +744,7 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;):
**示例:**查询值为12345678的uid所属的系统帐号的帐号ID **示例:**查询值为12345678的uid所属的系统帐号的帐号ID
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
let uid = 12345678; let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid, (err, accountID) => { accountManager.getOsAccountLocalIdFromUid(uid, (err, accountID) => {
...@@ -775,7 +775,7 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt; ...@@ -775,7 +775,7 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
**示例:**查询值为12345678的uid所属的系统帐号的帐号ID **示例:**查询值为12345678的uid所属的系统帐号的帐号ID
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
let uid = 12345678; let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid).then((accountID) => { accountManager.getOsAccountLocalIdFromUid(uid).then((accountID) => {
...@@ -804,7 +804,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall ...@@ -804,7 +804,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
**示例:** **示例:**
``` ```js
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, accountID) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, accountID) => {
...@@ -837,7 +837,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number& ...@@ -837,7 +837,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((accountID) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((accountID) => {
...@@ -865,7 +865,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void ...@@ -865,7 +865,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryMaxOsAccountNumber((err, maxCnt)=>{ accountManager.queryMaxOsAccountNumber((err, maxCnt)=>{
console.log("queryMaxOsAccountNumber err:" + JSON.stringify(err)); console.log("queryMaxOsAccountNumber err:" + JSON.stringify(err));
...@@ -891,7 +891,7 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt; ...@@ -891,7 +891,7 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryMaxOsAccountNumber().then((maxCnt) => { accountManager.queryMaxOsAccountNumber().then((maxCnt) => {
console.log('queryMaxOsAccountNumber, maxCnt: ' + maxCnt); console.log('queryMaxOsAccountNumber, maxCnt: ' + maxCnt);
...@@ -919,7 +919,7 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt; ...@@ -919,7 +919,7 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;
**示例:**获取ID为100的系统帐号的全部约束 **示例:**获取ID为100的系统帐号的全部约束
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountAllConstraints(localId, (err, constraints)=>{ accountManager.getOsAccountAllConstraints(localId, (err, constraints)=>{
...@@ -952,7 +952,7 @@ getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt; ...@@ -952,7 +952,7 @@ getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
**示例:**获取ID为100的系统帐号的全部约束 **示例:**获取ID为100的系统帐号的全部约束
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountAllConstraints(localId).then((constraints) => { accountManager.getOsAccountAllConstraints(localId).then((constraints) => {
...@@ -980,7 +980,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;& ...@@ -980,7 +980,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryAllCreatedOsAccounts((err, accountArr)=>{ accountManager.queryAllCreatedOsAccounts((err, accountArr)=>{
console.log("queryAllCreatedOsAccounts err:" + JSON.stringify(err)); console.log("queryAllCreatedOsAccounts err:" + JSON.stringify(err));
...@@ -1006,7 +1006,7 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt; ...@@ -1006,7 +1006,7 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryAllCreatedOsAccounts().then((accountArr) => { accountManager.queryAllCreatedOsAccounts().then((accountArr) => {
console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr)); console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr));
...@@ -1031,7 +1031,7 @@ queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): ...@@ -1031,7 +1031,7 @@ queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;):
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds((err, idArray)=>{ accountManager.queryActivatedOsAccountIds((err, idArray)=>{
console.log("queryActivatedOsAccountIds err:" + JSON.stringify(err)); console.log("queryActivatedOsAccountIds err:" + JSON.stringify(err));
...@@ -1058,7 +1058,7 @@ queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt; ...@@ -1058,7 +1058,7 @@ queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryActivatedOsAccountIds().then((idArray) => { accountManager.queryActivatedOsAccountIds().then((idArray) => {
console.log('queryActivatedOsAccountIds, idArray: ' + idArray); console.log('queryActivatedOsAccountIds, idArray: ' + idArray);
...@@ -1089,7 +1089,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback& ...@@ -1089,7 +1089,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.createOsAccount("testName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ accountManager.createOsAccount("testName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
console.log("createOsAccount err:" + JSON.stringify(err)); console.log("createOsAccount err:" + JSON.stringify(err));
...@@ -1124,7 +1124,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf ...@@ -1124,7 +1124,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL).then((accountInfo) => { accountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL).then((accountInfo) => {
console.log("createOsAccount, accountInfo: " + JSON.stringify(accountInfo)); console.log("createOsAccount, accountInfo: " + JSON.stringify(accountInfo));
...@@ -1155,7 +1155,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal ...@@ -1155,7 +1155,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo, (err, osAccountInfo)=>{ accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo, (err, osAccountInfo)=>{
...@@ -1191,7 +1191,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr ...@@ -1191,7 +1191,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => { accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => {
...@@ -1219,7 +1219,7 @@ queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void ...@@ -1219,7 +1219,7 @@ queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount((err, curAccountInfo)=>{ accountManager.queryCurrentOsAccount((err, curAccountInfo)=>{
console.log("queryCurrentOsAccount err:" + JSON.stringify(err)); console.log("queryCurrentOsAccount err:" + JSON.stringify(err));
...@@ -1245,7 +1245,7 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt; ...@@ -1245,7 +1245,7 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.queryCurrentOsAccount().then((accountInfo) => { accountManager.queryCurrentOsAccount().then((accountInfo) => {
console.log("queryCurrentOsAccount, accountInfo: " + JSON.stringify(accountInfo)); console.log("queryCurrentOsAccount, accountInfo: " + JSON.stringify(accountInfo));
...@@ -1275,7 +1275,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt; ...@@ -1275,7 +1275,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;
**示例:**查询ID为100的系统帐号信息 **示例:**查询ID为100的系统帐号信息
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.queryOsAccountById(localId, (err, accountInfo)=>{ accountManager.queryOsAccountById(localId, (err, accountInfo)=>{
...@@ -1310,7 +1310,7 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt; ...@@ -1310,7 +1310,7 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
**示例:**查询ID为100的系统帐号信息 **示例:**查询ID为100的系统帐号信息
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.queryOsAccountById(localId).then((accountInfo) => { accountManager.queryOsAccountById(localId).then((accountInfo) => {
...@@ -1336,7 +1336,7 @@ getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void ...@@ -1336,7 +1336,7 @@ getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess((err, accountType) => { accountManager.getOsAccountTypeFromProcess((err, accountType) => {
console.log("getOsAccountTypeFromProcess err: " + JSON.stringify(err)); console.log("getOsAccountTypeFromProcess err: " + JSON.stringify(err));
...@@ -1360,7 +1360,7 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt; ...@@ -1360,7 +1360,7 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountTypeFromProcess().then((accountType) => { accountManager.getOsAccountTypeFromProcess().then((accountType) => {
console.log('getOsAccountTypeFromProcess, accountType: ' + accountType); console.log('getOsAccountTypeFromProcess, accountType: ' + accountType);
...@@ -1387,7 +1387,7 @@ getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void ...@@ -1387,7 +1387,7 @@ getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId((err, virtualID) => { accountManager.getDistributedVirtualDeviceId((err, virtualID) => {
console.log("getDistributedVirtualDeviceId err: " + JSON.stringify(err)); console.log("getDistributedVirtualDeviceId err: " + JSON.stringify(err));
...@@ -1413,7 +1413,7 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt; ...@@ -1413,7 +1413,7 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt;
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
accountManager.getDistributedVirtualDeviceId().then((virtualID) => { accountManager.getDistributedVirtualDeviceId().then((virtualID) => {
console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID); console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID);
...@@ -1443,7 +1443,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;) ...@@ -1443,7 +1443,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;)
**示例:**获取ID为100的系统帐号的头像 **示例:**获取ID为100的系统帐号的头像
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountProfilePhoto(localId, (err, photo)=>{ accountManager.getOsAccountProfilePhoto(localId, (err, photo)=>{
...@@ -1478,7 +1478,7 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt; ...@@ -1478,7 +1478,7 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
**示例:**获取ID为100的系统帐号的头像 **示例:**获取ID为100的系统帐号的头像
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getOsAccountProfilePhoto(localId).then((photo) => { accountManager.getOsAccountProfilePhoto(localId).then((photo) => {
...@@ -1510,7 +1510,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback ...@@ -1510,7 +1510,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
**示例:**给ID为100的系统帐号设置头像 **示例:**给ID为100的系统帐号设置头像
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+ var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
...@@ -1549,7 +1549,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt; ...@@ -1549,7 +1549,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
**示例:**给ID为100的系统帐号设置头像 **示例:**给ID为100的系统帐号设置头像
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+ var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
...@@ -1580,7 +1580,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback& ...@@ -1580,7 +1580,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&
**示例:**查询与SN码12345关联的系统帐号的ID **示例:**查询与SN码12345关联的系统帐号的ID
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var serialNumber = 12345; var serialNumber = 12345;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{
...@@ -1611,7 +1611,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt; ...@@ -1611,7 +1611,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
**示例:**查询与SN码12345关联的系统帐号的ID **示例:**查询与SN码12345关联的系统帐号的ID
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var serialNumber = 12345; var serialNumber = 12345;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => { accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => {
...@@ -1638,7 +1638,7 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;nu ...@@ -1638,7 +1638,7 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;nu
**示例:**获取ID为100的系统帐号关联的SN码 **示例:**获取ID为100的系统帐号关联的SN码
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ accountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
...@@ -1669,7 +1669,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt; ...@@ -1669,7 +1669,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
**示例:**获取ID为100的系统帐号关联的SN码 **示例:**获取ID为100的系统帐号关联的SN码
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => { accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => {
...@@ -1701,7 +1701,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g ...@@ -1701,7 +1701,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
function onCallback(receiveLocalId){ function onCallback(receiveLocalId){
console.log("receive localId:" + receiveLocalId); console.log("receive localId:" + receiveLocalId);
...@@ -1731,7 +1731,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number ...@@ -1731,7 +1731,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
**示例:** **示例:**
``` ```js
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
function offCallback(){ function offCallback(){
console.log("off enter") console.log("off enter")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册