提交 2629ab0c 编写于 作者: C chennian

doc排查

Signed-off-by: Nchennian <chennian1@huawei.com>
上级 dd30afa9
...@@ -73,7 +73,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; ...@@ -73,7 +73,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
try { try {
atManager.checkAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS").then((data) => { atManager.checkAccessToken(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS').then((data) => {
console.log(`checkAccessToken success, data->${JSON.stringify(data)}`); console.log(`checkAccessToken success, data->${JSON.stringify(data)}`);
}).catch((err) => { }).catch((err) => {
console.log(`checkAccessToken fail, err->${JSON.stringify(err)}`); console.log(`checkAccessToken fail, err->${JSON.stringify(err)}`);
...@@ -117,7 +117,7 @@ verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus ...@@ -117,7 +117,7 @@ verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus
```js ```js
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let data = atManager.verifyAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); let data = atManager.verifyAccessTokenSync(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
console.log(`data->${JSON.stringify(data)}`); console.log(`data->${JSON.stringify(data)}`);
``` ```
...@@ -168,7 +168,7 @@ let atManager = abilityAccessCtrl.createAtManager(); ...@@ -168,7 +168,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1; let permissionFlags = 1;
try { try {
atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => { atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags).then(() => {
console.log('grantUserGrantedPermission success'); console.log('grantUserGrantedPermission success');
}).catch((err) => { }).catch((err) => {
console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`); console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`);
...@@ -220,7 +220,7 @@ let atManager = abilityAccessCtrl.createAtManager(); ...@@ -220,7 +220,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1; let permissionFlags = 1;
try { try {
atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => { atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags, (err, data) => {
if (err) { if (err) {
console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`); console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`);
} else { } else {
...@@ -279,7 +279,7 @@ let atManager = abilityAccessCtrl.createAtManager(); ...@@ -279,7 +279,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1; let permissionFlags = 1;
try { try {
atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => { atManager.revokeUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags).then(() => {
console.log('revokeUserGrantedPermission success'); console.log('revokeUserGrantedPermission success');
}).catch((err) => { }).catch((err) => {
console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`); console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`);
...@@ -331,7 +331,7 @@ let atManager = abilityAccessCtrl.createAtManager(); ...@@ -331,7 +331,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1; let permissionFlags = 1;
try { try {
atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => { atManager.revokeUserGrantedPermission(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS', permissionFlags, (err, data) => {
if (err) { if (err) {
console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`); console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`);
} else { } else {
...@@ -388,7 +388,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; ...@@ -388,7 +388,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
try { try {
atManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS").then((data) => { atManager.getPermissionFlags(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS').then((data) => {
console.log(`getPermissionFlags success, data->${JSON.stringify(data)}`); console.log(`getPermissionFlags success, data->${JSON.stringify(data)}`);
}).catch((err) => { }).catch((err) => {
console.log(`getPermissionFlags fail, err->${JSON.stringify(err)}`); console.log(`getPermissionFlags fail, err->${JSON.stringify(err)}`);
...@@ -466,10 +466,10 @@ import bundleManager from '@ohos.bundle.bundleManager'; ...@@ -466,10 +466,10 @@ import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100); let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId]; let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"]; let permissionList: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try { try {
atManager.on('permissionStateChange', tokenIDList, permissionList, (data) => { atManager.on('permissionStateChange', tokenIDList, permissionList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data)); console.debug('receive permission state change, data:' + JSON.stringify(data));
}); });
} catch(err) { } catch(err) {
console.log(`catch err->${JSON.stringify(err)}`); console.log(`catch err->${JSON.stringify(err)}`);
...@@ -504,7 +504,7 @@ off(type: 'permissionStateChange', tokenIDList: Array&lt;number&gt;, permissionL ...@@ -504,7 +504,7 @@ off(type: 'permissionStateChange', tokenIDList: Array&lt;number&gt;, permissionL
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. | | 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. |
| 12100004 | The interface is not used together with "on". | | 12100004 | The interface is not used together with 'on'. |
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
| 12100008 | Out of memory. | | 12100008 | Out of memory. |
...@@ -517,7 +517,7 @@ import bundleManager from '@ohos.bundle.bundleManager'; ...@@ -517,7 +517,7 @@ import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100); let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId]; let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"]; let permissionList: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try { try {
atManager.off('permissionStateChange', tokenIDList, permissionList); atManager.off('permissionStateChange', tokenIDList, permissionList);
} catch(err) { } catch(err) {
...@@ -557,7 +557,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; ...@@ -557,7 +557,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let promise = atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); let promise = atManager.verifyAccessToken(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
promise.then(data => { promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`); console.log(`promise: data->${JSON.stringify(data)}`);
}); });
...@@ -598,10 +598,10 @@ requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permission ...@@ -598,10 +598,10 @@ requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permission
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
try { try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"], (err, data)=>{ atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA'], (err, data)=>{
console.info("data:" + JSON.stringify(data)); console.info('data:' + JSON.stringify(data));
console.info("data permissions:" + data.permissions); console.info('data permissions:' + data.permissions);
console.info("data authResults:" + data.authResults); console.info('data authResults:' + data.authResults);
}); });
} catch(err) { } catch(err) {
console.log(`catch err->${JSON.stringify(err)}`); console.log(`catch err->${JSON.stringify(err)}`);
...@@ -649,12 +649,12 @@ requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permission ...@@ -649,12 +649,12 @@ requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permission
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
try { try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"]).then((data) => { atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA']).then((data) => {
console.info("data:" + JSON.stringify(data)); console.info('data:' + JSON.stringify(data));
console.info("data permissions:" + data.permissions); console.info('data permissions:' + data.permissions);
console.info("data authResults:" + data.authResults); console.info('data authResults:' + data.authResults);
}).catch((err) => { }).catch((err) => {
console.info("data:" + JSON.stringify(err)); console.info('data:' + JSON.stringify(err));
}) })
} catch(err) { } catch(err) {
console.log(`catch err->${JSON.stringify(err)}`); console.log(`catch err->${JSON.stringify(err)}`);
...@@ -693,7 +693,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; ...@@ -693,7 +693,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let promise = atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); let promise = atManager.verifyAccessToken(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
promise.then(data => { promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`); console.log(`promise: data->${JSON.stringify(data)}`);
}); });
...@@ -733,7 +733,7 @@ checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus; ...@@ -733,7 +733,7 @@ checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
```js ```js
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let data = atManager.checkAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); let data = atManager.checkAccessTokenSync(tokenID, 'ohos.permission.GRANT_SENSITIVE_PERMISSIONS');
console.log(`data->${JSON.stringify(data)}`); console.log(`data->${JSON.stringify(data)}`);
``` ```
......
...@@ -65,11 +65,11 @@ createAccount(name: string, callback: AsyncCallback&lt;void&gt;): void; ...@@ -65,11 +65,11 @@ createAccount(name: string, callback: AsyncCallback&lt;void&gt;): void;
```js ```js
try { try {
appAccountManager.createAccount("WangWu", (err) => { appAccountManager.createAccount('WangWu', (err) => {
console.log("createAccount err: " + JSON.stringify(err)); console.log('createAccount err: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("createAccount err: " + JSON.stringify(err)); console.log('createAccount err: ' + JSON.stringify(err));
} }
``` ```
...@@ -103,19 +103,19 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba ...@@ -103,19 +103,19 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba
```js ```js
let options = { let options = {
customData: { customData: {
"age": "10" 'age': '10'
} }
} }
try { try {
appAccountManager.createAccount("LiSi", options, (err) => { appAccountManager.createAccount('LiSi', options, (err) => {
if (err) { if (err) {
console.log("createAccount failed, error: " + JSON.stringify(err)); console.log('createAccount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("createAccount successfully"); console.log('createAccount successfully');
} }
}); });
} catch(err) { } catch(err) {
console.log("createAccount exception: " + JSON.stringify(err)); console.log('createAccount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -154,17 +154,17 @@ createAccount(name: string, options?: CreateAccountOptions): Promise&lt;void&gt; ...@@ -154,17 +154,17 @@ createAccount(name: string, options?: CreateAccountOptions): Promise&lt;void&gt;
```js ```js
let options = { let options = {
customData: { customData: {
"age": "10" 'age': '10'
} }
} }
try { try {
appAccountManager.createAccount("LiSi", options).then(() => { appAccountManager.createAccount('LiSi', options).then(() => {
console.log("createAccount successfully"); console.log('createAccount successfully');
}).catch((err) => { }).catch((err) => {
console.log("createAccount failed, error: " + JSON.stringify(err)); console.log('createAccount failed, error: ' + JSON.stringify(err));
}); });
} catch(err) { } catch(err) {
console.log("createAccount exception: " + JSON.stringify(err)); console.log('createAccount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -198,8 +198,8 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void ...@@ -198,8 +198,8 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
```js ```js
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log('resultCode: ' + code);
console.log("result: " + JSON.stringify(result)); console.log('result: ' + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
...@@ -210,19 +210,19 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void ...@@ -210,19 +210,19 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
this.context.startAbility(wantInfo).then(() => { this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully"); console.log('startAbility successfully');
}).catch((err) => { }).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log('startAbility err: ' + JSON.stringify(err));
}) })
} }
try { try {
appAccountManager.createAccountImplicitly("com.example.accountjsdemo", { appAccountManager.createAccountImplicitly('com.example.accountjsdemo', {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
}); });
} catch (err) { } catch (err) {
console.log("createAccountImplicitly exception: " + JSON.stringify(err)); console.log('createAccountImplicitly exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -257,8 +257,8 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, ...@@ -257,8 +257,8 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
```js ```js
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log('resultCode: ' + code);
console.log("result: " + JSON.stringify(result)); console.log('result: ' + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
...@@ -269,23 +269,23 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, ...@@ -269,23 +269,23 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
this.context.startAbility(wantInfo).then(() => { this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully"); console.log('startAbility successfully');
}).catch((err) => { }).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log('startAbility err: ' + JSON.stringify(err));
}) })
} }
let options = { let options = {
authType: "getSocialData", authType: 'getSocialData',
requiredLabels: [ "student" ] requiredLabels: [ 'student' ]
}; };
try { try {
appAccountManager.createAccountImplicitly("com.example.accountjsdemo", options, { appAccountManager.createAccountImplicitly('com.example.accountjsdemo', options, {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
}); });
} catch (err) { } catch (err) {
console.log("createAccountImplicitly exception: " + JSON.stringify(err)); console.log('createAccountImplicitly exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -316,15 +316,15 @@ removeAccount(name: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -316,15 +316,15 @@ removeAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
```js ```js
try { try {
appAccountManager.removeAccount("ZhaoLiu", (err) => { appAccountManager.removeAccount('ZhaoLiu', (err) => {
if (err) { if (err) {
console.log("removeAccount failed, error: " + JSON.stringify(err)); console.log('removeAccount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("removeAccount successfully"); console.log('removeAccount successfully');
} }
}); });
} catch(err) { } catch(err) {
console.log("removeAccount exception: " + JSON.stringify(err)); console.log('removeAccount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -360,13 +360,13 @@ removeAccount(name: string): Promise&lt;void&gt; ...@@ -360,13 +360,13 @@ removeAccount(name: string): Promise&lt;void&gt;
```js ```js
try { try {
appAccountManager.removeAccount("Lisi").then(() => { appAccountManager.removeAccount('Lisi').then(() => {
console.log("removeAccount successfully"); console.log('removeAccount successfully');
}).catch((err) => { }).catch((err) => {
console.log("removeAccount failed, error: " + JSON.stringify(err)); console.log('removeAccount failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("removeAccount exception: " + JSON.stringify(err)); console.log('removeAccount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -400,15 +400,15 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: ...@@ -400,15 +400,15 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback:
```js ```js
try { try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true, (err) => { appAccountManager.setAppAccess('ZhangSan', 'com.example.accountjsdemo', true, (err) => {
if (err) { if (err) {
console.log("setAppAccess failed: " + JSON.stringify(err)); console.log('setAppAccess failed: ' + JSON.stringify(err));
} else { } else {
console.log("setAppAccess successfully"); console.log('setAppAccess successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("setAppAccess exception: " + JSON.stringify(err)); console.log('setAppAccess exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -447,13 +447,13 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise&l ...@@ -447,13 +447,13 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise&l
```js ```js
try { try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true).then(() => { appAccountManager.setAppAccess('ZhangSan', 'com.example.accountjsdemo', true).then(() => {
console.log("setAppAccess successfully"); console.log('setAppAccess successfully');
}).catch((err) => { }).catch((err) => {
console.log("setAppAccess failed: " + JSON.stringify(err)); console.log('setAppAccess failed: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setAppAccess exception: " + JSON.stringify(err)); console.log('setAppAccess exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -485,15 +485,15 @@ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;bool ...@@ -485,15 +485,15 @@ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;bool
```js ```js
try { try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo", (err, isAccessible) => { appAccountManager.checkAppAccess('ZhangSan', 'com.example.accountjsdemo', (err, isAccessible) => {
if (err) { if (err) {
console.log("checkAppAccess failed, error: " + JSON.stringify(err)); console.log('checkAppAccess failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkAppAccess successfully"); console.log('checkAppAccess successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("checkAppAccess exception: " + JSON.stringify(err)); console.log('checkAppAccess exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -530,13 +530,13 @@ checkAppAccess(name: string, bundleName: string): Promise&lt;boolean&gt; ...@@ -530,13 +530,13 @@ checkAppAccess(name: string, bundleName: string): Promise&lt;boolean&gt;
```js ```js
try { try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo").then((isAccessible) => { appAccountManager.checkAppAccess('ZhangSan', 'com.example.accountjsdemo').then((isAccessible) => {
console.log("checkAppAccess successfully, isAccessible: " + isAccessible); console.log('checkAppAccess successfully, isAccessible: ' + isAccessible);
}).catch((err) => { }).catch((err) => {
console.log("checkAppAccess failed, error: " + JSON.stringify(err)); console.log('checkAppAccess failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("checkAppAccess exception: " + JSON.stringify(err)); console.log('checkAppAccess exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -570,11 +570,11 @@ setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback&lt; ...@@ -570,11 +570,11 @@ setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback&lt;
```js ```js
try { try {
appAccountManager.setDataSyncEnabled("ZhangSan", true, (err) => { appAccountManager.setDataSyncEnabled('ZhangSan', true, (err) => {
console.log("setDataSyncEnabled err: " + JSON.stringify(err)); console.log('setDataSyncEnabled err: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setDataSyncEnabled err: " + JSON.stringify(err)); console.log('setDataSyncEnabled err: ' + JSON.stringify(err));
} }
``` ```
...@@ -613,13 +613,13 @@ setDataSyncEnabled(name: string, isEnabled: boolean): Promise&lt;void&gt; ...@@ -613,13 +613,13 @@ setDataSyncEnabled(name: string, isEnabled: boolean): Promise&lt;void&gt;
```js ```js
try { try {
appAccountManager .setDataSyncEnabled("ZhangSan", true).then(() => { appAccountManager .setDataSyncEnabled('ZhangSan', true).then(() => {
console.log('setDataSyncEnabled Success'); console.log('setDataSyncEnabled Success');
}).catch((err) => { }).catch((err) => {
console.log("setDataSyncEnabled err: " + JSON.stringify(err)); console.log('setDataSyncEnabled err: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setDataSyncEnabled err: " + JSON.stringify(err)); console.log('setDataSyncEnabled err: ' + JSON.stringify(err));
} }
``` ```
...@@ -652,15 +652,15 @@ checkDataSyncEnabled(name: string, callback: AsyncCallback&lt;boolean&gt;): void ...@@ -652,15 +652,15 @@ checkDataSyncEnabled(name: string, callback: AsyncCallback&lt;boolean&gt;): void
```js ```js
try { try {
appAccountManager.checkDataSyncEnabled("ZhangSan", (err, isEnabled) => { appAccountManager.checkDataSyncEnabled('ZhangSan', (err, isEnabled) => {
if (err) { if (err) {
console.log("checkDataSyncEnabled failed, err: " + JSON.stringify(err)); console.log('checkDataSyncEnabled failed, err: ' + JSON.stringify(err));
} else { } else {
console.log('checkDataSyncEnabled successfully, isEnabled: ' + isEnabled); console.log('checkDataSyncEnabled successfully, isEnabled: ' + isEnabled);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkDataSyncEnabled err: " + JSON.stringify(err)); console.log('checkDataSyncEnabled err: ' + JSON.stringify(err));
} }
``` ```
...@@ -698,13 +698,13 @@ checkDataSyncEnabled(name: string): Promise&lt;boolean&gt; ...@@ -698,13 +698,13 @@ checkDataSyncEnabled(name: string): Promise&lt;boolean&gt;
```js ```js
try { try {
appAccountManager.checkDataSyncEnabled("ZhangSan").then((isEnabled) => { appAccountManager.checkDataSyncEnabled('ZhangSan').then((isEnabled) => {
console.log("checkDataSyncEnabled successfully, isEnabled: " + isEnabled); console.log('checkDataSyncEnabled successfully, isEnabled: ' + isEnabled);
}).catch((err) => { }).catch((err) => {
console.log("checkDataSyncEnabled failed, err: " + JSON.stringify(err)); console.log('checkDataSyncEnabled failed, err: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("checkDataSyncEnabled err: " + JSON.stringify(err)); console.log('checkDataSyncEnabled err: ' + JSON.stringify(err));
} }
``` ```
...@@ -737,15 +737,15 @@ setCredential(name: string, credentialType: string, credential: string,callback: ...@@ -737,15 +737,15 @@ setCredential(name: string, credentialType: string, credential: string,callback:
```js ```js
try { try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx", (err) => { appAccountManager.setCredential('ZhangSan', 'PIN_SIX', 'xxxxxx', (err) => {
if (err) { if (err) {
console.log("setCredential failed, error: " + JSON.stringify(err)); console.log('setCredential failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("setCredential successfully"); console.log('setCredential successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("setCredential exception: " + JSON.stringify(err)); console.log('setCredential exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -783,13 +783,13 @@ setCredential(name: string, credentialType: string, credential: string): Promise ...@@ -783,13 +783,13 @@ setCredential(name: string, credentialType: string, credential: string): Promise
```js ```js
try { try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx").then(() => { appAccountManager.setCredential('ZhangSan', 'PIN_SIX', 'xxxxxx').then(() => {
console.log("setCredential successfully"); console.log('setCredential successfully');
}).catch((err) => { }).catch((err) => {
console.log("setCredential failed, error: " + JSON.stringify(err)); console.log('setCredential failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setCredential exception: " + JSON.stringify(err)); console.log('setCredential exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -822,15 +822,15 @@ getCredential(name: string, credentialType: string, callback: AsyncCallback&lt;s ...@@ -822,15 +822,15 @@ getCredential(name: string, credentialType: string, callback: AsyncCallback&lt;s
```js ```js
try { try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX", (err, result) => { appAccountManager.getCredential('ZhangSan', 'PIN_SIX', (err, result) => {
if (err) { if (err) {
console.log("getCredential failed, error: " + JSON.stringify(err)); console.log('getCredential failed, error: ' + JSON.stringify(err));
} else { } else {
console.log('getCredential successfully, result: ' + result); console.log('getCredential successfully, result: ' + result);
} }
}); });
} catch (err) { } catch (err) {
console.log("getCredential err: " + JSON.stringify(err)); console.log('getCredential err: ' + JSON.stringify(err));
} }
``` ```
...@@ -868,13 +868,13 @@ getCredential(name: string, credentialType: string): Promise&lt;string&gt; ...@@ -868,13 +868,13 @@ getCredential(name: string, credentialType: string): Promise&lt;string&gt;
```js ```js
try { try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX").then((credential) => { appAccountManager.getCredential('ZhangSan', 'PIN_SIX').then((credential) => {
console.log("getCredential successfully, credential: " + credential); console.log('getCredential successfully, credential: ' + credential);
}).catch((err) => { }).catch((err) => {
console.log("getCredential failed, error: " + JSON.stringify(err)); console.log('getCredential failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getCredential exception: " + JSON.stringify(err)); console.log('getCredential exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -908,15 +908,15 @@ setCustomData(name: string, key: string, value: string, callback: AsyncCallback& ...@@ -908,15 +908,15 @@ setCustomData(name: string, key: string, value: string, callback: AsyncCallback&
```js ```js
try { try {
appAccountManager.setCustomData("ZhangSan", "age", "12", (err) => { appAccountManager.setCustomData('ZhangSan', 'age', '12', (err) => {
if (err) { if (err) {
console.log("setCustomData failed, error: " + JSON.stringify(err)); console.log('setCustomData failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("setCustomData successfully"); console.log('setCustomData successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("setCustomData exception: " + JSON.stringify(err)); console.log('setCustomData exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -955,13 +955,13 @@ setCustomData(name: string, key: string, value: string): Promise&lt;void&gt; ...@@ -955,13 +955,13 @@ setCustomData(name: string, key: string, value: string): Promise&lt;void&gt;
```js ```js
try { try {
appAccountManager.setCustomData("ZhangSan", "age", "12").then(() => { appAccountManager.setCustomData('ZhangSan', 'age', '12').then(() => {
console.log("setCustomData successfully"); console.log('setCustomData successfully');
}).catch((err) => { }).catch((err) => {
console.log("setCustomData failed, error: " + JSON.stringify(err)); console.log('setCustomData failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setCustomData exception: " + JSON.stringify(err)); console.log('setCustomData exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -994,15 +994,15 @@ getCustomData(name: string, key: string, callback: AsyncCallback&lt;string&gt;): ...@@ -994,15 +994,15 @@ getCustomData(name: string, key: string, callback: AsyncCallback&lt;string&gt;):
```js ```js
try { try {
appAccountManager.getCustomData("ZhangSan", "age", (err, data) => { appAccountManager.getCustomData('ZhangSan', 'age', (err, data) => {
if (err) { if (err) {
console.log('getCustomData failed, error: ' + err); console.log('getCustomData failed, error: ' + err);
} else { } else {
console.log("getCustomData successfully, data: " + data); console.log('getCustomData successfully, data: ' + data);
} }
}); });
} catch (err) { } catch (err) {
console.log("getCustomData exception: " + JSON.stringify(err)); console.log('getCustomData exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1040,13 +1040,13 @@ getCustomData(name: string, key: string): Promise&lt;string&gt; ...@@ -1040,13 +1040,13 @@ getCustomData(name: string, key: string): Promise&lt;string&gt;
```js ```js
try { try {
appAccountManager.getCustomData("ZhangSan", "age").then((data) => { appAccountManager.getCustomData('ZhangSan', 'age').then((data) => {
console.log("getCustomData successfully, data: " + data); console.log('getCustomData successfully, data: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getCustomData failed, error: " + JSON.stringify(err)); console.log('getCustomData failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getCustomData exception: " + JSON.stringify(err)); console.log('getCustomData exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1084,10 +1084,10 @@ getCustomDataSync(name: string, key: string): string; ...@@ -1084,10 +1084,10 @@ getCustomDataSync(name: string, key: string): string;
```js ```js
try { try {
let value = appAccountManager.getCustomDataSync("ZhangSan", "age"); let value = appAccountManager.getCustomDataSync('ZhangSan', 'age');
console.info("getCustomDataSync successfully, vaue:" + value); console.info('getCustomDataSync successfully, vaue: ' + value);
} catch (err) { } catch (err) {
console.error("getCustomDataSync failed, error: " + JSON.stringify(err)); console.error('getCustomDataSync failed, error: ' + JSON.stringify(err));
} }
``` ```
...@@ -1117,13 +1117,13 @@ getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void ...@@ -1117,13 +1117,13 @@ getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
try { try {
appAccountManager.getAllAccounts((err, data) => { appAccountManager.getAllAccounts((err, data) => {
if (err) { if (err) {
console.debug("getAllAccounts failed, error:" + JSON.stringify(err)); console.debug('getAllAccounts failed, error: ' + JSON.stringify(err));
} else { } else {
console.debug("getAllAccounts successfully"); console.debug('getAllAccounts successfully');
} }
}); });
} catch (err) { } catch (err) {
console.debug("getAllAccounts exception: " + JSON.stringify(err)); console.debug('getAllAccounts exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1152,12 +1152,12 @@ getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -1152,12 +1152,12 @@ getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
```js ```js
try { try {
appAccountManager.getAllAccounts().then((data) => { appAccountManager.getAllAccounts().then((data) => {
console.debug("getAllAccounts successfully"); console.debug('getAllAccounts successfully');
}).catch((err) => { }).catch((err) => {
console.debug("getAllAccounts failed, error:" + JSON.stringify(err)); console.debug('getAllAccounts failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.debug("getAllAccounts exception: " + JSON.stringify(err)); console.debug('getAllAccounts exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1188,15 +1188,15 @@ getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccount ...@@ -1188,15 +1188,15 @@ getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccount
```js ```js
try { try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2", (err, data) => { appAccountManager.getAccountsByOwner('com.example.accountjsdemo2', (err, data) => {
if (err) { if (err) {
console.debug("getAccountsByOwner failed, error:" + JSON.stringify(err)); console.debug('getAccountsByOwner failed, error:' + JSON.stringify(err));
} else { } else {
console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data)); console.debug('getAccountsByOwner successfully, data:' + JSON.stringify(data));
} }
}); });
} catch (err) { } catch (err) {
console.debug("getAccountsByOwner exception:" + JSON.stringify(err)); console.debug('getAccountsByOwner exception:' + JSON.stringify(err));
} }
``` ```
...@@ -1232,13 +1232,13 @@ getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -1232,13 +1232,13 @@ getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
```js ```js
try { try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2").then((data) => { appAccountManager.getAccountsByOwner('com.example.accountjsdemo2').then((data) => {
console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data)); console.debug('getAccountsByOwner successfully, data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.debug("getAccountsByOwner failed, error:" + JSON.stringify(err)); console.debug('getAccountsByOwner failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.debug("getAccountsByOwner exception:" + JSON.stringify(err)); console.debug('getAccountsByOwner exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1270,12 +1270,12 @@ on(type: 'accountChange', owners: Array&lt;string&gt;, callback: Callback&lt;Arr ...@@ -1270,12 +1270,12 @@ on(type: 'accountChange', owners: Array&lt;string&gt;, callback: Callback&lt;Arr
```js ```js
function changeOnCallback(data){ function changeOnCallback(data){
console.log("receive change data:" + JSON.stringify(data)); console.log('receive change data:' + JSON.stringify(data));
} }
try{ try{
appAccountManager.on("accountChange", ["com.example.actsaccounttest"], changeOnCallback); appAccountManager.on('accountChange', ['com.example.actsaccounttest'], changeOnCallback);
} catch(err) { } catch(err) {
console.error("on accountChange failed, error:" + JSON.stringify(err)); console.error('on accountChange failed, error:' + JSON.stringify(err));
} }
``` ```
...@@ -1305,18 +1305,18 @@ off(type: 'accountChange', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt ...@@ -1305,18 +1305,18 @@ off(type: 'accountChange', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt
```js ```js
function changeOnCallback(data) { function changeOnCallback(data) {
console.log("receive change data:" + JSON.stringify(data)); console.log('receive change data:' + JSON.stringify(data));
} }
try{ try{
appAccountManager.on("accountChange", ["com.example.actsaccounttest"], changeOnCallback); appAccountManager.on('accountChange', ['com.example.actsaccounttest'], changeOnCallback);
} catch(err) { } catch(err) {
console.error("on accountChange failed, error:" + JSON.stringify(err)); console.error('on accountChange failed, error:' + JSON.stringify(err));
} }
try{ try{
appAccountManager.off('accountChange', changeOnCallback); appAccountManager.off('accountChange', changeOnCallback);
} }
catch(err){ catch(err){
console.error("off accountChange failed, error:" + JSON.stringify(err)); console.error('off accountChange failed, error:' + JSON.stringify(err));
} }
``` ```
...@@ -1354,8 +1354,8 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi ...@@ -1354,8 +1354,8 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
function onResultCallback(code, authResult) { function onResultCallback(code, authResult) {
console.log("resultCode: " + code); console.log('resultCode: ' + code);
console.log("authResult: " + JSON.stringify(authResult)); console.log('authResult: ' + JSON.stringify(authResult));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
...@@ -1366,19 +1366,19 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi ...@@ -1366,19 +1366,19 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
this.context.startAbility(wantInfo).then(() => { this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully"); console.log('startAbility successfully');
}).catch((err) => { }).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log('startAbility err: ' + JSON.stringify(err));
}) })
} }
try { try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", { appAccountManager.auth('LiSi', 'com.example.accountjsdemo', 'getSocialData', {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
}); });
} catch (err) { } catch (err) {
console.log("auth exception: " + JSON.stringify(err)); console.log('auth exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1417,8 +1417,8 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj ...@@ -1417,8 +1417,8 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
function onResultCallback(code, authResult) { function onResultCallback(code, authResult) {
console.log("resultCode: " + code); console.log('resultCode: ' + code);
console.log("authResult: " + JSON.stringify(authResult)); console.log('authResult: ' + JSON.stringify(authResult));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
...@@ -1429,22 +1429,22 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj ...@@ -1429,22 +1429,22 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
this.context.startAbility(wantInfo).then(() => { this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully"); console.log('startAbility successfully');
}).catch((err) => { }).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log('startAbility err: ' + JSON.stringify(err));
}) })
} }
let options = { let options = {
"password": "xxxx", 'password': 'xxxx',
}; };
try { try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", options, { appAccountManager.auth('LiSi', 'com.example.accountjsdemo', 'getSocialData', options, {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
}); });
} catch (err) { } catch (err) {
console.log("auth exception: " + JSON.stringify(err)); console.log('auth exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1478,15 +1478,15 @@ getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallb ...@@ -1478,15 +1478,15 @@ getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallb
```js ```js
try { try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, token) => { appAccountManager.getAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', (err, token) => {
if (err) { if (err) {
console.log("getAuthToken failed, error: " + JSON.stringify(err)); console.log('getAuthToken failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getAuthToken successfully, token: " + token); console.log('getAuthToken successfully, token: ' + token);
} }
}); });
} catch (err) { } catch (err) {
console.log("getAuthToken exception: " + JSON.stringify(err)); console.log('getAuthToken exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1525,13 +1525,13 @@ getAuthToken(name: string, owner: string, authType: string): Promise&lt;string&g ...@@ -1525,13 +1525,13 @@ getAuthToken(name: string, owner: string, authType: string): Promise&lt;string&g
```js ```js
try { try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((token) => { appAccountManager.getAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData').then((token) => {
console.log("getAuthToken successfully, token: " + token); console.log('getAuthToken successfully, token: ' + token);
}).catch((err) => { }).catch((err) => {
console.log("getAuthToken failed, error: " + JSON.stringify(err)); console.log('getAuthToken failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getAuthToken exception: " + JSON.stringify(err)); console.log('getAuthToken exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1565,11 +1565,11 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb ...@@ -1565,11 +1565,11 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb
```js ```js
try { try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx", (err) => { appAccountManager.setAuthToken('LiSi', 'getSocialData', 'xxxx', (err) => {
if (err) { if (err) {
console.log("setAuthToken failed, error: " + JSON.stringify(err)); console.log('setAuthToken failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("setAuthToken successfully"); console.log('setAuthToken successfully');
} }
}); });
} catch (err) { } catch (err) {
...@@ -1612,13 +1612,13 @@ setAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt; ...@@ -1612,13 +1612,13 @@ setAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt;
```js ```js
try { try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx").then(() => { appAccountManager.setAuthToken('LiSi', 'getSocialData', 'xxxx').then(() => {
console.log("setAuthToken successfully"); console.log('setAuthToken successfully');
}).catch((err) => { }).catch((err) => {
console.log("setAuthToken failed, error: " + JSON.stringify(err)); console.log('setAuthToken failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setAuthToken exception: " + JSON.stringify(err)); console.log('setAuthToken exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1653,11 +1653,11 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string, ca ...@@ -1653,11 +1653,11 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string, ca
```js ```js
try { try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => { appAccountManager.deleteAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx', (err) => {
if (err) { if (err) {
console.log('deleteAuthToken failed, error: ' + JSON.stringify(err)); console.log('deleteAuthToken failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("deleteAuthToken successfully"); console.log('deleteAuthToken successfully');
} }
}); });
} catch (err) { } catch (err) {
...@@ -1701,8 +1701,8 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P ...@@ -1701,8 +1701,8 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P
```js ```js
try { try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => { appAccountManager.deleteAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx').then(() => {
console.log("deleteAuthToken successfully"); console.log('deleteAuthToken successfully');
}).catch((err) => { }).catch((err) => {
console.log('deleteAuthToken failed, error: ' + JSON.stringify(err)); console.log('deleteAuthToken failed, error: ' + JSON.stringify(err));
}); });
...@@ -1744,15 +1744,15 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis ...@@ -1744,15 +1744,15 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
```js ```js
try { try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => { appAccountManager.setAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true, (err) => {
if (err) { if (err) {
console.log("setAuthTokenVisibility failed, error: " + JSON.stringify(err)); console.log('setAuthTokenVisibility failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("setAuthTokenVisibility successfully"); console.log('setAuthTokenVisibility successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("setAuthTokenVisibility exception: " + JSON.stringify(err)); console.log('setAuthTokenVisibility exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1794,13 +1794,13 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis ...@@ -1794,13 +1794,13 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
```js ```js
try { try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => { appAccountManager.setAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true).then(() => {
console.log("setAuthTokenVisibility successfully"); console.log('setAuthTokenVisibility successfully');
}).catch((err) => { }).catch((err) => {
console.log("setAuthTokenVisibility failed, error: " + JSON.stringify(err)); console.log('setAuthTokenVisibility failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("setAuthTokenVisibility exception: " + JSON.stringify(err)); console.log('setAuthTokenVisibility exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1834,15 +1834,15 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, cal ...@@ -1834,15 +1834,15 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, cal
```js ```js
try { try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, isVisible) => { appAccountManager.checkAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', (err, isVisible) => {
if (err) { if (err) {
console.log("checkAuthTokenVisibility failed, error: " + JSON.stringify(err)); console.log('checkAuthTokenVisibility failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible); console.log('checkAuthTokenVisibility successfully, isVisible: ' + isVisible);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkAuthTokenVisibility exception: " + JSON.stringify(err)); console.log('checkAuthTokenVisibility exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1881,13 +1881,13 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Pr ...@@ -1881,13 +1881,13 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Pr
```js ```js
try { try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((isVisible) => { appAccountManager.checkAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo').then((isVisible) => {
console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible); console.log('checkAuthTokenVisibility successfully, isVisible: ' + isVisible);
}).catch((err) => { }).catch((err) => {
console.log("checkAuthTokenVisibility failed, error: " + JSON.stringify(err)); console.log('checkAuthTokenVisibility failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("checkAuthTokenVisibility exception: " + JSON.stringify(err)); console.log('checkAuthTokenVisibility exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1919,15 +1919,15 @@ getAllAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&l ...@@ -1919,15 +1919,15 @@ getAllAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&l
```js ```js
try { try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo", (err, tokenArr) => { appAccountManager.getAllAuthTokens('LiSi', 'com.example.accountjsdemo', (err, tokenArr) => {
if (err) { if (err) {
console.log("getAllAuthTokens failed, error: " + JSON.stringify(err)); console.log('getAllAuthTokens failed, error: ' + JSON.stringify(err));
} else { } else {
console.log('getAllAuthTokens successfully, tokenArr: ' + tokenArr); console.log('getAllAuthTokens successfully, tokenArr: ' + tokenArr);
} }
}); });
} catch (err) { } catch (err) {
console.log("getAllAuthTokens exception: " + JSON.stringify(err)); console.log('getAllAuthTokens exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1964,13 +1964,13 @@ getAllAuthTokens(name: string, owner: string): Promise&lt;Array&lt;AuthTokenInfo ...@@ -1964,13 +1964,13 @@ getAllAuthTokens(name: string, owner: string): Promise&lt;Array&lt;AuthTokenInfo
```js ```js
try { try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo").then((tokenArr) => { appAccountManager.getAllAuthTokens('LiSi', 'com.example.accountjsdemo').then((tokenArr) => {
console.log('getAllAuthTokens successfully, tokenArr: ' + JSON.stringify(tokenArr)); console.log('getAllAuthTokens successfully, tokenArr: ' + JSON.stringify(tokenArr));
}).catch((err) => { }).catch((err) => {
console.log("getAllAuthTokens failed, error: " + JSON.stringify(err)); console.log('getAllAuthTokens failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getAllAuthTokens exception: " + JSON.stringify(err)); console.log('getAllAuthTokens exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2003,11 +2003,11 @@ getAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt; ...@@ -2003,11 +2003,11 @@ getAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt;
```js ```js
try { try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData", (err, authList) => { appAccountManager.getAuthList('LiSi', 'getSocialData', (err, authList) => {
if (err) { if (err) {
console.log("getAuthList failed, error: " + JSON.stringify(err)); console.log('getAuthList failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getAuthList successfully, authList: " + authList); console.log('getAuthList successfully, authList: ' + authList);
} }
}); });
} catch (err) { } catch (err) {
...@@ -2049,13 +2049,13 @@ getAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt; ...@@ -2049,13 +2049,13 @@ getAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
```js ```js
try { try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData").then((authList) => { appAccountManager.getAuthList('LiSi', 'getSocialData').then((authList) => {
console.log("getAuthList successfully, authList: " + authList); console.log('getAuthList successfully, authList: ' + authList);
}).catch((err) => { }).catch((err) => {
console.log("getAuthList failed, error: " + JSON.stringify(err)); console.log('getAuthList failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getAuthList exception: " + JSON.stringify(err)); console.log('getAuthList exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2093,23 +2093,23 @@ getAuthCallback(sessionId: string, callback: AsyncCallback&lt;AuthCallback&gt;): ...@@ -2093,23 +2093,23 @@ getAuthCallback(sessionId: string, callback: AsyncCallback&lt;AuthCallback&gt;):
try { try {
appAccountManager.getAuthCallback(sessionId, (err, callback) => { appAccountManager.getAuthCallback(sessionId, (err, callback) => {
if (err != null) { if (err != null) {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log('getAuthCallback err: ' + JSON.stringify(err));
return; return;
} }
var result = { var result = {
accountInfo: { accountInfo: {
name: "Lisi", name: 'Lisi',
owner: "com.example.accountjsdemo", owner: 'com.example.accountjsdemo',
}, },
tokenInfo: { tokenInfo: {
token: "xxxxxx", token: 'xxxxxx',
authType: "getSocialData" authType: 'getSocialData'
} }
}; };
callback.onResult(0, result); callback.onResult(0, result);
}); });
} catch (err) { } catch (err) {
console.log("getAuthCallback exception: " + JSON.stringify(err)); console.log('getAuthCallback exception: ' + JSON.stringify(err));
} }
} }
} }
...@@ -2155,20 +2155,20 @@ getAuthCallback(sessionId: string): Promise&lt;AuthCallback&gt; ...@@ -2155,20 +2155,20 @@ getAuthCallback(sessionId: string): Promise&lt;AuthCallback&gt;
appAccountManager.getAuthCallback(sessionId).then((callback) => { appAccountManager.getAuthCallback(sessionId).then((callback) => {
var result = { var result = {
accountInfo: { accountInfo: {
name: "Lisi", name: 'Lisi',
owner: "com.example.accountjsdemo", owner: 'com.example.accountjsdemo',
}, },
tokenInfo: { tokenInfo: {
token: "xxxxxx", token: 'xxxxxx',
authType: "getSocialData" authType: 'getSocialData'
} }
}; };
callback.onResult(0, result); callback.onResult(0, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log('getAuthCallback err: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getAuthCallback exception: " + JSON.stringify(err)); console.log('getAuthCallback exception: ' + JSON.stringify(err));
} }
} }
} }
...@@ -2201,15 +2201,15 @@ queryAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorIn ...@@ -2201,15 +2201,15 @@ queryAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorIn
```js ```js
try { try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo", (err, info) => { appAccountManager.queryAuthenticatorInfo('com.example.accountjsdemo', (err, info) => {
if (err) { if (err) {
console.log("queryAuthenticatorInfo failed, error: " + JSON.stringify(err)); console.log('queryAuthenticatorInfo failed, error: ' + JSON.stringify(err));
} else { } else {
console.log('queryAuthenticatorInfo successfully, info: ' + JSON.stringify(info)); console.log('queryAuthenticatorInfo successfully, info: ' + JSON.stringify(info));
} }
}); });
} catch (err) { } catch (err) {
console.log("queryAuthenticatorInfo exception: " + JSON.stringify(err)); console.log('queryAuthenticatorInfo exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2245,13 +2245,13 @@ queryAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -2245,13 +2245,13 @@ queryAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
```js ```js
try { try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo").then((info) => { appAccountManager.queryAuthenticatorInfo('com.example.accountjsdemo').then((info) => {
console.log("queryAuthenticatorInfo successfully, info: " + JSON.stringify(info)); console.log('queryAuthenticatorInfo successfully, info: ' + JSON.stringify(info));
}).catch((err) => { }).catch((err) => {
console.log("queryAuthenticatorInfo failed, error: " + JSON.stringify(err)); console.log('queryAuthenticatorInfo failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("queryAuthenticatorInfo exception: " + JSON.stringify(err)); console.log('queryAuthenticatorInfo exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2286,17 +2286,17 @@ checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;, cal ...@@ -2286,17 +2286,17 @@ checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;, cal
**示例:** **示例:**
```js ```js
let labels = ["student"]; let labels = ['student'];
try { try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels, (err, hasAllLabels) => { appAccountManager.checkAccountLabels('zhangsan', 'com.example.accountjsdemo', labels, (err, hasAllLabels) => {
if (err) { if (err) {
console.log("checkAccountLabels failed, error: " + JSON.stringify(err)); console.log('checkAccountLabels failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkAccountLabels successfully, hasAllLabels: " + hasAllLabels); console.log('checkAccountLabels successfully, hasAllLabels: ' + hasAllLabels);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkAccountLabels exception: " + JSON.stringify(err)); console.log('checkAccountLabels exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2336,15 +2336,15 @@ checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;): Pr ...@@ -2336,15 +2336,15 @@ checkAccountLabels(name: string, owner: string, labels: Array&lt;string&gt;): Pr
**示例:** **示例:**
```js ```js
let labels = ["student"]; let labels = ['student'];
try { try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels).then((hasAllLabels) => { appAccountManager.checkAccountLabels('zhangsan', 'com.example.accountjsdemo', labels).then((hasAllLabels) => {
console.log('checkAccountLabels successfully: ' + hasAllLabels); console.log('checkAccountLabels successfully: ' + hasAllLabels);
}).catch((err) => { }).catch((err) => {
console.log("checkAccountLabels failed, error: " + JSON.stringify(err)); console.log('checkAccountLabels failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("checkAccountLabels exception: " + JSON.stringify(err)); console.log('checkAccountLabels exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2377,15 +2377,15 @@ deleteCredential(name: string, credentialType: string, callback: AsyncCallback&l ...@@ -2377,15 +2377,15 @@ deleteCredential(name: string, credentialType: string, callback: AsyncCallback&l
```js ```js
try { try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX", (err) => { appAccountManager.deleteCredential('zhangsan', 'PIN_SIX', (err) => {
if (err) { if (err) {
console.log("deleteCredential failed, error: " + JSON.stringify(err)); console.log('deleteCredential failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("deleteCredential successfully"); console.log('deleteCredential successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("deleteCredential exception: " + JSON.stringify(err)); console.log('deleteCredential exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2423,13 +2423,13 @@ deleteCredential(name: string, credentialType: string): Promise&lt;void&gt; ...@@ -2423,13 +2423,13 @@ deleteCredential(name: string, credentialType: string): Promise&lt;void&gt;
```js ```js
try { try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX").then(() => { appAccountManager.deleteCredential('zhangsan', 'PIN_SIX').then(() => {
console.log("deleteCredential successfully"); console.log('deleteCredential successfully');
}).catch((err) => { }).catch((err) => {
console.log("deleteCredential failed, error: " + JSON.stringify(err)); console.log('deleteCredential failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("deleteCredential exception: " + JSON.stringify(err)); console.log('deleteCredential exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2461,19 +2461,19 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback& ...@@ -2461,19 +2461,19 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback&
```js ```js
let options = { let options = {
allowedOwners: [ "com.example.accountjsdemo" ], allowedOwners: [ 'com.example.accountjsdemo' ],
requiredLabels: [ "student" ] requiredLabels: [ 'student' ]
}; };
try { try {
appAccountManager.selectAccountsByOptions(options, (err, accountArr) => { appAccountManager.selectAccountsByOptions(options, (err, accountArr) => {
if (err) { if (err) {
console.log("selectAccountsByOptions failed, error: " + JSON.stringify(err)); console.log('selectAccountsByOptions failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("selectAccountsByOptions successfully, accountArr: " + JSON.stringify(accountArr)); console.log('selectAccountsByOptions successfully, accountArr: ' + JSON.stringify(accountArr));
} }
}); });
} catch (err) { } catch (err) {
console.log("selectAccountsByOptions exception: " + JSON.stringify(err)); console.log('selectAccountsByOptions exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2510,16 +2510,16 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise&lt;Array&lt;App ...@@ -2510,16 +2510,16 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise&lt;Array&lt;App
```js ```js
let options = { let options = {
allowedOwners: ["com.example.accountjsdemo"] allowedOwners: ['com.example.accountjsdemo']
}; };
try { try {
appAccountManager.selectAccountsByOptions(options).then((accountArr) => { appAccountManager.selectAccountsByOptions(options).then((accountArr) => {
console.log("selectAccountsByOptions successfully, accountArr: " + JSON.stringify(accountArr)); console.log('selectAccountsByOptions successfully, accountArr: ' + JSON.stringify(accountArr));
}).catch((err) => { }).catch((err) => {
console.log("selectAccountsByOptions failed, error: " + JSON.stringify(err)); console.log('selectAccountsByOptions failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("selectAccountsByOptions exception: " + JSON.stringify(err)); console.log('selectAccountsByOptions exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -2554,17 +2554,17 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void; ...@@ -2554,17 +2554,17 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void;
```js ```js
try { try {
appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", { appAccountManager.verifyCredential('zhangsan', 'com.example.accountjsdemo', {
onResult: (resultCode, result) => { onResult: (resultCode, result) => {
console.log("verifyCredential onResult, resultCode:" + JSON.stringify(resultCode)); console.log('verifyCredential onResult, resultCode: ' + JSON.stringify(resultCode));
console.log("verifyCredential onResult, result:" + JSON.stringify(result)); console.log('verifyCredential onResult, result: ' + JSON.stringify(result));
}, },
onRequestRedirected: (request) => { onRequestRedirected: (request) => {
console.log("verifyCredential onRequestRedirected, request:" + JSON.stringify(request)); console.log('verifyCredential onRequestRedirected, request: ' + JSON.stringify(request));
} }
}); });
} catch (err) { } catch (err) {
console.log("verifyCredential err: " + JSON.stringify(err)); console.log('verifyCredential err: ' + JSON.stringify(err));
} }
``` ```
...@@ -2600,21 +2600,21 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, ...@@ -2600,21 +2600,21 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions,
```js ```js
let options = { let options = {
credentialType: "pin", credentialType: 'pin',
credential: "123456" credential: '123456'
}; };
try { try {
appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", options, { appAccountManager.verifyCredential('zhangsan', 'com.example.accountjsdemo', options, {
onResult: (resultCode, result) => { onResult: (resultCode, result) => {
console.log("verifyCredential onResult, resultCode:" + JSON.stringify(resultCode)); console.log('verifyCredential onResult, resultCode: ' + JSON.stringify(resultCode));
console.log("verifyCredential onResult, result:" + JSON.stringify(result)); console.log('verifyCredential onResult, result: ' + JSON.stringify(result));
}, },
onRequestRedirected: (request) => { onRequestRedirected: (request) => {
console.log("verifyCredential onRequestRedirected, request:" + JSON.stringify(request)); console.log('verifyCredential onRequestRedirected, request: ' + JSON.stringify(request));
} }
}); });
} catch (err) { } catch (err) {
console.log("verifyCredential err: " + JSON.stringify(err)); console.log('verifyCredential err: ' + JSON.stringify(err));
} }
``` ```
...@@ -2647,17 +2647,17 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void; ...@@ -2647,17 +2647,17 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
```js ```js
try { try {
appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", { appAccountManager.setAuthenticatorProperties('com.example.accountjsdemo', {
onResult: (resultCode, result) => { onResult: (resultCode, result) => {
console.log("setAuthenticatorProperties onResult, resultCode:" + JSON.stringify(resultCode)); console.log('setAuthenticatorProperties onResult, resultCode: ' + JSON.stringify(resultCode));
console.log("setAuthenticatorProperties onResult, result:" + JSON.stringify(result)); console.log('setAuthenticatorProperties onResult, result: ' + JSON.stringify(result));
}, },
onRequestRedirected: (request) => { onRequestRedirected: (request) => {
console.log("setAuthenticatorProperties onRequestRedirected, request:" + JSON.stringify(request)); console.log('setAuthenticatorProperties onRequestRedirected, request: ' + JSON.stringify(request));
} }
}); });
} catch (err) { } catch (err) {
console.log("setAuthenticatorProperties err: " + JSON.stringify(err)); console.log('setAuthenticatorProperties err: ' + JSON.stringify(err));
} }
``` ```
...@@ -2691,20 +2691,20 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac ...@@ -2691,20 +2691,20 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac
```js ```js
let options = { let options = {
properties: {"prop1": "value1"} properties: {'prop1': 'value1'}
}; };
try { try {
appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", options, { appAccountManager.setAuthenticatorProperties('com.example.accountjsdemo', options, {
onResult: (resultCode, result) => { onResult: (resultCode, result) => {
console.log("setAuthenticatorProperties onResult, resultCode:" + JSON.stringify(resultCode)); console.log('setAuthenticatorProperties onResult, resultCode: ' + JSON.stringify(resultCode));
console.log("setAuthenticatorProperties onResult, result:" + JSON.stringify(result)); console.log('setAuthenticatorProperties onResult, result: ' + JSON.stringify(result));
}, },
onRequestRedirected: (request) => { onRequestRedirected: (request) => {
console.log("setAuthenticatorProperties onRequestRedirected, request:" + JSON.stringify(request)); console.log('setAuthenticatorProperties onRequestRedirected, request: ' + JSON.stringify(request));
} }
}); });
} catch (err) { } catch (err) {
console.log("setAuthenticatorProperties err: " + JSON.stringify(err)); console.log('setAuthenticatorProperties err: ' + JSON.stringify(err));
} }
``` ```
...@@ -2732,8 +2732,8 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -2732,8 +2732,8 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
appAccountManager.addAccount("WangWu", (err) => { appAccountManager.addAccount('WangWu', (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log('addAccount err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2759,8 +2759,8 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;) ...@@ -2759,8 +2759,8 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
**示例:** **示例:**
```js ```js
appAccountManager.addAccount("LiSi", "token101", (err) => { appAccountManager.addAccount('LiSi', 'token101', (err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log('addAccount err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2791,10 +2791,10 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt; ...@@ -2791,10 +2791,10 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager.addAccount("LiSi", "token101").then(()=> { appAccountManager.addAccount('LiSi', 'token101').then(()=> {
console.log('addAccount Success'); console.log('addAccount Success');
}).catch((err) => { }).catch((err) => {
console.log("addAccount err: " + JSON.stringify(err)); console.log('addAccount err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2825,8 +2825,8 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -2825,8 +2825,8 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log('resultCode: ' + code);
console.log("result: " + JSON.stringify(result)); console.log('result: ' + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
...@@ -2837,13 +2837,13 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -2837,13 +2837,13 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
this.context.startAbility(wantInfo).then(() => { this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully"); console.log('startAbility successfully');
}).catch((err) => { }).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log('startAbility err: ' + JSON.stringify(err));
}) })
} }
appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.addAccountImplicitly('com.example.accountjsdemo', 'getSocialData', {}, {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
}); });
...@@ -2871,8 +2871,8 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -2871,8 +2871,8 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:** **示例:**
```js ```js
appAccountManager.deleteAccount("ZhaoLiu", (err) => { appAccountManager.deleteAccount('ZhaoLiu', (err) => {
console.log("deleteAccount err: " + JSON.stringify(err)); console.log('deleteAccount err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2903,10 +2903,10 @@ deleteAccount(name: string): Promise&lt;void&gt; ...@@ -2903,10 +2903,10 @@ deleteAccount(name: string): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager.deleteAccount("ZhaoLiu").then(() => { appAccountManager.deleteAccount('ZhaoLiu').then(() => {
console.log('deleteAccount Success'); console.log('deleteAccount Success');
}).catch((err) => { }).catch((err) => {
console.log("deleteAccount err: " + JSON.stringify(err)); console.log('deleteAccount err: ' + JSON.stringify(err));
}); });
``` ```
### disableAppAccess<sup>(deprecated)</sup> ### disableAppAccess<sup>(deprecated)</sup>
...@@ -2932,8 +2932,8 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo ...@@ -2932,8 +2932,8 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
**示例:** **示例:**
```js ```js
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => { appAccountManager.disableAppAccess('ZhangSan', 'com.example.accountjsdemo', (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err)); console.log('disableAppAccess err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2965,10 +2965,10 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt; ...@@ -2965,10 +2965,10 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => { appAccountManager.disableAppAccess('ZhangSan', 'com.example.accountjsdemo').then(() => {
console.log('disableAppAccess Success'); console.log('disableAppAccess Success');
}).catch((err) => { }).catch((err) => {
console.log("disableAppAccess err: " + JSON.stringify(err)); console.log('disableAppAccess err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2995,8 +2995,8 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi ...@@ -2995,8 +2995,8 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi
**示例:** **示例:**
```js ```js
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => { appAccountManager.enableAppAccess('ZhangSan', 'com.example.accountjsdemo', (err) => {
console.log("enableAppAccess: " + JSON.stringify(err)); console.log('enableAppAccess: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3028,10 +3028,10 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt; ...@@ -3028,10 +3028,10 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => { appAccountManager.enableAppAccess('ZhangSan', 'com.example.accountjsdemo').then(() => {
console.log('enableAppAccess Success'); console.log('enableAppAccess Success');
}).catch((err) => { }).catch((err) => {
console.log("enableAppAccess err: " + JSON.stringify(err)); console.log('enableAppAccess err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3059,8 +3059,8 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;): ...@@ -3059,8 +3059,8 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;):
**示例:** **示例:**
```js ```js
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => { appAccountManager.checkAppAccountSyncEnable('ZhangSan', (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err)); console.log('checkAppAccountSyncEnable err: ' + JSON.stringify(err));
console.log('checkAppAccountSyncEnable result: ' + result); console.log('checkAppAccountSyncEnable result: ' + result);
}); });
``` ```
...@@ -3094,10 +3094,10 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt; ...@@ -3094,10 +3094,10 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => { appAccountManager.checkAppAccountSyncEnable('ZhangSan').then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data); console.log('checkAppAccountSyncEnable, result: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err)); console.log('checkAppAccountSyncEnable err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3125,8 +3125,8 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca ...@@ -3125,8 +3125,8 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
**示例:** **示例:**
```js ```js
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));
}); });
``` ```
...@@ -3159,10 +3159,10 @@ setAccountCredential(name: string, credentialType: string, credential: string): ...@@ -3159,10 +3159,10 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**示例:** **示例:**
```js ```js
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => { appAccountManager.setAccountCredential('ZhangSan', 'credentialType001', 'credential001').then(() => {
console.log('setAccountCredential Success'); console.log('setAccountCredential Success');
}).catch((err) => { }).catch((err) => {
console.log("setAccountCredential err: " + JSON.stringify(err)); console.log('setAccountCredential err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3190,8 +3190,8 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt; ...@@ -3190,8 +3190,8 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;
**示例:** **示例:**
```js ```js
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => { appAccountManager.setAccountExtraInfo('ZhangSan', 'Tk002', (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err)); console.log('setAccountExtraInfo err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3224,10 +3224,10 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt; ...@@ -3224,10 +3224,10 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => { appAccountManager.setAccountExtraInfo('ZhangSan', 'Tk002').then(() => {
console.log('setAccountExtraInfo Success'); console.log('setAccountExtraInfo Success');
}).catch((err) => { }).catch((err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err)); console.log('setAccountExtraInfo err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3256,8 +3256,8 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback ...@@ -3256,8 +3256,8 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
**示例:** **示例:**
```js ```js
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => { appAccountManager.setAppAccountSyncEnable('ZhangSan', true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err)); console.log('setAppAccountSyncEnable err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3291,10 +3291,10 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt; ...@@ -3291,10 +3291,10 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => { appAccountManager .setAppAccountSyncEnable('ZhangSan', true).then(() => {
console.log('setAppAccountSyncEnable Success'); console.log('setAppAccountSyncEnable Success');
}).catch((err) => { }).catch((err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err)); console.log('setAppAccountSyncEnable err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3323,8 +3323,8 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb ...@@ -3323,8 +3323,8 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
**示例:** **示例:**
```js ```js
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001", (err) => { appAccountManager.setAssociatedData('ZhangSan', 'k001', 'v001', (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err)); console.log('setAssociatedData err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3358,10 +3358,10 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt; ...@@ -3358,10 +3358,10 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**示例:** **示例:**
```js ```js
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => { appAccountManager.setAssociatedData('ZhangSan', 'k001', 'v001').then(() => {
console.log('setAssociatedData Success'); console.log('setAssociatedData Success');
}).catch((err) => { }).catch((err) => {
console.log("setAssociatedData err: " + JSON.stringify(err)); console.log('setAssociatedData err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3389,8 +3389,8 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;& ...@@ -3389,8 +3389,8 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&
```js ```js
appAccountManager.getAllAccessibleAccounts((err, data)=>{ appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err)); console.debug('getAllAccessibleAccounts err: ' + JSON.stringify(err));
console.debug("getAllAccessibleAccounts data:" + JSON.stringify(data)); console.debug('getAllAccessibleAccounts data: ' + JSON.stringify(data));
}); });
``` ```
...@@ -3420,7 +3420,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -3420,7 +3420,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
appAccountManager.getAllAccessibleAccounts().then((data) => { appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data); console.log('getAllAccessibleAccounts: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getAllAccessibleAccounts err: " + JSON.stringify(err)); console.log('getAllAccessibleAccounts err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3448,10 +3448,10 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo ...@@ -3448,10 +3448,10 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo
**示例:** **示例:**
```js ```js
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = 'com.example.actsgetallaaccounts';
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
console.debug("getAllAccounts err:" + JSON.stringify(err)); console.debug('getAllAccounts err: ' + JSON.stringify(err));
console.debug("getAllAccounts data:" + JSON.stringify(data)); console.debug('getAllAccounts data:' + JSON.stringify(data));
}); });
``` ```
...@@ -3484,11 +3484,11 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt; ...@@ -3484,11 +3484,11 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:** **示例:**
```js ```js
const selfBundle = "com.example.actsgetallaaccounts"; const selfBundle = 'com.example.actsgetallaaccounts';
appAccountManager.getAllAccounts(selfBundle).then((data) => { appAccountManager.getAllAccounts(selfBundle).then((data) => {
console.log('getAllAccounts: ' + data); console.log('getAllAccounts: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getAllAccounts err: " + JSON.stringify(err)); console.log('getAllAccounts err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3515,8 +3515,8 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba ...@@ -3515,8 +3515,8 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
**示例:** **示例:**
```js ```js
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));
console.log('getAccountCredential result: ' + result); console.log('getAccountCredential result: ' + result);
}); });
``` ```
...@@ -3549,10 +3549,10 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt ...@@ -3549,10 +3549,10 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
**示例:** **示例:**
```js ```js
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => { appAccountManager.getAccountCredential('ZhangSan', 'credentialType001').then((data) => {
console.log('getAccountCredential, result: ' + data); console.log('getAccountCredential, result: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getAccountCredential err: " + JSON.stringify(err)); console.log('getAccountCredential err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3578,8 +3578,8 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void ...@@ -3578,8 +3578,8 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void
**示例:** **示例:**
```js ```js
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => { appAccountManager.getAccountExtraInfo('ZhangSan', (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err)); console.log('getAccountExtraInfo err: ' + JSON.stringify(err));
console.log('getAccountExtraInfo result: ' + result); console.log('getAccountExtraInfo result: ' + result);
}); });
``` ```
...@@ -3611,10 +3611,10 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt; ...@@ -3611,10 +3611,10 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;
**示例:** **示例:**
```js ```js
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => { appAccountManager.getAccountExtraInfo('ZhangSan').then((data) => {
console.log('getAccountExtraInfo, result: ' + data); console.log('getAccountExtraInfo, result: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err)); console.log('getAccountExtraInfo err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3641,8 +3641,8 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g ...@@ -3641,8 +3641,8 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g
**示例:** **示例:**
```js ```js
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));
console.log('getAssociatedData result: ' + result); console.log('getAssociatedData result: ' + result);
}); });
``` ```
...@@ -3675,10 +3675,10 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt; ...@@ -3675,10 +3675,10 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
**示例:** **示例:**
```js ```js
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => { appAccountManager.getAssociatedData('ZhangSan', 'k001').then((data) => {
console.log('getAssociatedData: ' + data); console.log('getAssociatedData: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getAssociatedData err: " + JSON.stringify(err)); console.log('getAssociatedData err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3706,13 +3706,13 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A ...@@ -3706,13 +3706,13 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
```js ```js
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug('receive change data:' + JSON.stringify(data));
} }
try{ try{
appAccountManager.on('change', ["com.example.actsaccounttest"], changeOnCallback); appAccountManager.on('change', ['com.example.actsaccounttest'], changeOnCallback);
} }
catch(err){ catch(err){
console.error("on accountOnOffDemo err:" + JSON.stringify(err)); console.error('on accountOnOffDemo err:' + JSON.stringify(err));
} }
``` ```
...@@ -3739,16 +3739,16 @@ off(type: 'change', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): voi ...@@ -3739,16 +3739,16 @@ off(type: 'change', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): voi
```js ```js
function changeOnCallback(data){ function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data)); console.debug('receive change data: ' + JSON.stringify(data));
appAccountManager.off('change', function(){ appAccountManager.off('change', function(){
console.debug("off finish"); console.debug('off finish');
}) })
} }
try{ try{
appAccountManager.on('change', ["com.example.actsaccounttest"], changeOnCallback); appAccountManager.on('change', ['com.example.actsaccounttest'], changeOnCallback);
} }
catch(err){ catch(err){
console.error("on accountOnOffDemo err:" + JSON.stringify(err)); console.error('on accountOnOffDemo err: ' + JSON.stringify(err));
} }
``` ```
...@@ -3778,8 +3778,8 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri ...@@ -3778,8 +3778,8 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
```js ```js
function onResultCallback(code, result) { function onResultCallback(code, result) {
console.log("resultCode: " + code); console.log('resultCode: ' + code);
console.log("result: " + JSON.stringify(result)); console.log('result: ' + JSON.stringify(result));
} }
function onRequestRedirectedCallback(request) { function onRequestRedirectedCallback(request) {
...@@ -3790,13 +3790,13 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri ...@@ -3790,13 +3790,13 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
this.context.startAbility(wantInfo).then(() => { this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully"); console.log('startAbility successfully');
}).catch((err) => { }).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err)); console.log('startAbility err: ' + JSON.stringify(err));
}) })
} }
appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { appAccountManager.authenticate('LiSi', 'com.example.accountjsdemo', 'getSocialData', {}, {
onResult: onResultCallback, onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback onRequestRedirected: onRequestRedirectedCallback
}); });
...@@ -3826,7 +3826,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall ...@@ -3826,7 +3826,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**示例:** **示例:**
```js ```js
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, data) => { appAccountManager.getOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err)); console.log('getOAuthToken err: ' + JSON.stringify(err));
console.log('getOAuthToken token: ' + data); console.log('getOAuthToken token: ' + data);
}); });
...@@ -3861,10 +3861,10 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string& ...@@ -3861,10 +3861,10 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**示例:** **示例:**
```js ```js
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((data) => { appAccountManager.getOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData').then((data) => {
console.log('getOAuthToken token: ' + data); console.log('getOAuthToken token: ' + data);
}).catch((err) => { }).catch((err) => {
console.log("getOAuthToken err: " + JSON.stringify(err)); console.log('getOAuthToken err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3892,7 +3892,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall ...@@ -3892,7 +3892,7 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
**示例:** **示例:**
```js ```js
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx", (err) => { appAccountManager.setOAuthToken('LiSi', 'getSocialData', 'xxxx', (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err)); console.log('setOAuthToken err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3926,7 +3926,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt ...@@ -3926,7 +3926,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**示例:** **示例:**
```js ```js
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx").then(() => { appAccountManager.setOAuthToken('LiSi', 'getSocialData', 'xxxx').then(() => {
console.log('setOAuthToken successfully'); console.log('setOAuthToken successfully');
}).catch((err) => { }).catch((err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err)); console.log('setOAuthToken err: ' + JSON.stringify(err));
...@@ -3958,7 +3958,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c ...@@ -3958,7 +3958,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**示例:** **示例:**
```js ```js
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => { appAccountManager.deleteOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx', (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err)); console.log('deleteOAuthToken err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3993,10 +3993,10 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string): ...@@ -3993,10 +3993,10 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**示例:** **示例:**
```js ```js
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => { appAccountManager.deleteOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx').then(() => {
console.log('deleteOAuthToken successfully'); console.log('deleteOAuthToken successfully');
}).catch((err) => { }).catch((err) => {
console.log("deleteOAuthToken err: " + JSON.stringify(err)); console.log('deleteOAuthToken err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4025,7 +4025,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -4025,7 +4025,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:** **示例:**
```js ```js
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => { appAccountManager.setOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4060,7 +4060,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -4060,7 +4060,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:** **示例:**
```js ```js
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => { appAccountManager.setOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true).then(() => {
console.log('setOAuthTokenVisibility successfully'); console.log('setOAuthTokenVisibility successfully');
}).catch((err) => { }).catch((err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
...@@ -4091,7 +4091,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca ...@@ -4091,7 +4091,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**示例:** **示例:**
```js ```js
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, data) => { appAccountManager.checkOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
console.log('checkOAuthTokenVisibility isVisible: ' + data); console.log('checkOAuthTokenVisibility isVisible: ' + data);
}); });
...@@ -4126,7 +4126,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P ...@@ -4126,7 +4126,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**示例:** **示例:**
```js ```js
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((data) => { appAccountManager.checkOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo').then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data); console.log('checkOAuthTokenVisibility isVisible: ' + data);
}).catch((err) => { }).catch((err) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
...@@ -4156,8 +4156,8 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array& ...@@ -4156,8 +4156,8 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**示例:** **示例:**
```js ```js
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo", (err, data) => { appAccountManager.getAllOAuthTokens('LiSi', 'com.example.accountjsdemo', (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err)); console.log('getAllOAuthTokens err: ' + JSON.stringify(err));
console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
}); });
``` ```
...@@ -4190,10 +4190,10 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn ...@@ -4190,10 +4190,10 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**示例:** **示例:**
```js ```js
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo").then((data) => { appAccountManager.getAllOAuthTokens('LiSi', 'com.example.accountjsdemo').then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err)); console.log('getAllOAuthTokens err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4220,7 +4220,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt ...@@ -4220,7 +4220,7 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
**示例:** **示例:**
```js ```js
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData", (err, data) => { appAccountManager.getOAuthList('LiSi', 'getSocialData', (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err)); console.log('getOAuthList err: ' + JSON.stringify(err));
console.log('getOAuthList data: ' + JSON.stringify(data)); console.log('getOAuthList data: ' + JSON.stringify(data));
}); });
...@@ -4254,10 +4254,10 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt; ...@@ -4254,10 +4254,10 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**示例:** **示例:**
```js ```js
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData").then((data) => { appAccountManager.getOAuthList('LiSi', 'getSocialData').then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data)); console.log('getOAuthList data: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.log("getOAuthList err: " + JSON.stringify(err)); console.log('getOAuthList err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4290,13 +4290,13 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic ...@@ -4290,13 +4290,13 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
if (err.code != account_appAccount.ResultCode.SUCCESS) { if (err.code != account_appAccount.ResultCode.SUCCESS) {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log('getAuthenticatorCallback err: ' + JSON.stringify(err));
return; return;
} }
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", var result = {[account_appAccount.Constants.KEY_NAME]: 'LiSi',
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", [account_appAccount.Constants.KEY_OWNER]: 'com.example.accountjsdemo',
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_AUTH_TYPE]: 'getSocialData',
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}); });
} }
...@@ -4336,13 +4336,13 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt ...@@ -4336,13 +4336,13 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
onCreate(want, param) { onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", var result = {[account_appAccount.Constants.KEY_NAME]: 'LiSi',
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", [account_appAccount.Constants.KEY_OWNER]: 'com.example.accountjsdemo',
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_AUTH_TYPE]: 'getSocialData',
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log('getAuthenticatorCallback err: ' + JSON.stringify(err));
}); });
} }
} }
...@@ -4370,8 +4370,8 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo ...@@ -4370,8 +4370,8 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
**示例:** **示例:**
```js ```js
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo", (err, data) => { appAccountManager.getAuthenticatorInfo('com.example.accountjsdemo', (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err)); console.log('getAuthenticatorInfo err: ' + JSON.stringify(err));
console.log('getAuthenticatorInfo data: ' + JSON.stringify(data)); console.log('getAuthenticatorInfo data: ' + JSON.stringify(data));
}); });
``` ```
...@@ -4403,10 +4403,10 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -4403,10 +4403,10 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**示例:** **示例:**
```js ```js
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo").then((data) => { appAccountManager.getAuthenticatorInfo('com.example.accountjsdemo').then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data)); console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err)); console.log('getAuthenticatorInfo err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4537,23 +4537,23 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt; ...@@ -4537,23 +4537,23 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
| 名称 | 值 | 说明 | | 名称 | 值 | 说明 |
| -------------------------------- | ---------------------- | ----------------------- | | -------------------------------- | ---------------------- | ----------------------- |
| ACTION_ADD_ACCOUNT_IMPLICITLY<sup>(deprecated)</sup> | "addAccountImplicitly" | 表示操作,隐式添加帐号。 | | ACTION_ADD_ACCOUNT_IMPLICITLY<sup>(deprecated)</sup> | 'addAccountImplicitly' | 表示操作,隐式添加帐号。 |
| ACTION_AUTHENTICATE<sup>(deprecated)</sup> | "authenticate" | 表示操作,鉴权。 | | ACTION_AUTHENTICATE<sup>(deprecated)</sup> | 'authenticate' | 表示操作,鉴权。 |
| ACTION_CREATE_ACCOUNT_IMPLICITLY<sup>9+</sup> | "createAccountImplicitly" | 表示操作,隐式创建帐号。 | | ACTION_CREATE_ACCOUNT_IMPLICITLY<sup>9+</sup> | 'createAccountImplicitly' | 表示操作,隐式创建帐号。 |
| ACTION_AUTH<sup>9+</sup> | "auth" | 表示操作,鉴权。 | | ACTION_AUTH<sup>9+</sup> | 'auth' | 表示操作,鉴权。 |
| ACTION_VERIFY_CREDENTIAL<sup>9+</sup> | "verifyCredential" | 表示操作,验证凭据。 | | ACTION_VERIFY_CREDENTIAL<sup>9+</sup> | 'verifyCredential' | 表示操作,验证凭据。 |
| ACTION_SET_AUTHENTICATOR_PROPERTIES<sup>9+</sup> | "setAuthenticatorProperties" | 表示操作,设置认证器属性。 | | ACTION_SET_AUTHENTICATOR_PROPERTIES<sup>9+</sup> | 'setAuthenticatorProperties' | 表示操作,设置认证器属性。 |
| KEY_NAME | "name" | 表示键名,应用帐号的名称。 | | KEY_NAME | 'name' | 表示键名,应用帐号的名称。 |
| KEY_OWNER | "owner" | 表示键名,应用帐号所有者。| | KEY_OWNER | 'owner' | 表示键名,应用帐号所有者。|
| KEY_TOKEN | "token" | 表示键名,令牌。 | | KEY_TOKEN | 'token' | 表示键名,令牌。 |
| KEY_ACTION | "action" | 表示键名,操作。 | | KEY_ACTION | 'action' | 表示键名,操作。 |
| KEY_AUTH_TYPE | "authType" | 表示键名,鉴权类型。 | | KEY_AUTH_TYPE | 'authType' | 表示键名,鉴权类型。 |
| KEY_SESSION_ID | "sessionId" | 表示键名,会话标识。 | | KEY_SESSION_ID | 'sessionId' | 表示键名,会话标识。 |
| KEY_CALLER_PID | "callerPid" | 表示键名,调用方PID。 | | KEY_CALLER_PID | 'callerPid' | 表示键名,调用方PID。 |
| KEY_CALLER_UID | "callerUid" | 表示键名,调用方UID。 | | KEY_CALLER_UID | 'callerUid' | 表示键名,调用方UID。 |
| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | 表示键名,调用方包名。 | | KEY_CALLER_BUNDLE_NAME | 'callerBundleName' | 表示键名,调用方包名。 |
| KEY_REQUIRED_LABELS<sup>9+</sup> | "requiredLabels" | 表示键名,必需的标签。 | | KEY_REQUIRED_LABELS<sup>9+</sup> | 'requiredLabels' | 表示键名,必需的标签。 |
| KEY_BOOLEAN_RESULT<sup>9+</sup> | "booleanResult" | 表示键名,布尔返回值。 | | KEY_BOOLEAN_RESULT<sup>9+</sup> | 'booleanResult' | 表示键名,布尔返回值。 |
## ResultCode<sup>(deprecated)</sup> ## ResultCode<sup>(deprecated)</sup>
...@@ -4609,21 +4609,21 @@ onResult: (code: number, result?: AuthResult) =&gt; void ...@@ -4609,21 +4609,21 @@ onResult: (code: number, result?: AuthResult) =&gt; void
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager(); let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234"; var sessionId = '1234';
appAccountManager.getAuthCallback(sessionId).then((callback) => { appAccountManager.getAuthCallback(sessionId).then((callback) => {
var result = { var result = {
accountInfo: { accountInfo: {
name: "Lisi", name: 'Lisi',
owner: "com.example.accountjsdemo", owner: 'com.example.accountjsdemo',
}, },
tokenInfo: { tokenInfo: {
token: "xxxxxx", token: 'xxxxxx',
authType: "getSocialData" authType: 'getSocialData'
} }
}; };
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log('getAuthCallback err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4647,20 +4647,20 @@ onRequestRedirected: (request: Want) =&gt; void ...@@ -4647,20 +4647,20 @@ onRequestRedirected: (request: Want) =&gt; void
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
createAccountImplicitly(options, callback) { createAccountImplicitly(options, callback) {
callback.onRequestRedirected({ callback.onRequestRedirected({
bundleName: "com.example.accountjsdemo", bundleName: 'com.example.accountjsdemo',
abilityName: "com.example.accountjsdemo.LoginAbility", abilityName: 'com.example.accountjsdemo.LoginAbility',
}); });
} }
auth(name, authType, options, callback) { auth(name, authType, options, callback) {
var result = { var result = {
accountInfo: { accountInfo: {
name: "Lisi", name: 'Lisi',
owner: "com.example.accountjsdemo", owner: 'com.example.accountjsdemo',
}, },
tokenInfo: { tokenInfo: {
token: "xxxxxx", token: 'xxxxxx',
authType: "getSocialData" authType: 'getSocialData'
} }
}; };
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
...@@ -4680,11 +4680,11 @@ onRequestContinued?: () =&gt; void ...@@ -4680,11 +4680,11 @@ onRequestContinued?: () =&gt; void
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager(); let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234"; var sessionId = '1234';
appAccountManager.getAuthCallback(sessionId).then((callback) => { appAccountManager.getAuthCallback(sessionId).then((callback) => {
callback.onRequestContinued(); callback.onRequestContinued();
}).catch((err) => { }).catch((err) => {
console.log("getAuthCallback err: " + JSON.stringify(err)); console.log('getAuthCallback err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4715,15 +4715,15 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void ...@@ -4715,15 +4715,15 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager(); let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234"; var sessionId = '1234';
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", var result = {[account_appAccount.Constants.KEY_NAME]: 'LiSi',
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", [account_appAccount.Constants.KEY_OWNER]: 'com.example.accountjsdemo',
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_AUTH_TYPE]: 'getSocialData',
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).catch((err) => { }).catch((err) => {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log('getAuthenticatorCallback err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4747,15 +4747,15 @@ onRequestRedirected: (request: Want) =&gt; void ...@@ -4747,15 +4747,15 @@ onRequestRedirected: (request: Want) =&gt; void
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({
bundleName: "com.example.accountjsdemo", bundleName: 'com.example.accountjsdemo',
abilityName: "com.example.accountjsdemo.LoginAbility", abilityName: 'com.example.accountjsdemo.LoginAbility',
}); });
} }
authenticate(name, authType, callerBundleName, options, callback) { authenticate(name, authType, callerBundleName, options, callback) {
var result = {[account_appAccount.Constants.KEY_NAME]: name, var result = {[account_appAccount.Constants.KEY_NAME]: name,
[account_appAccount.Constants.KEY_AUTH_TYPE]: authType, [account_appAccount.Constants.KEY_AUTH_TYPE]: authType,
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
} }
} }
...@@ -4773,11 +4773,11 @@ onRequestContinued?: () =&gt; void ...@@ -4773,11 +4773,11 @@ onRequestContinued?: () =&gt; void
```js ```js
let appAccountManager = account_appAccount.createAppAccountManager(); let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234"; var sessionId = '1234';
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
callback.onRequestContinued(); callback.onRequestContinued();
}).catch((err) => { }).catch((err) => {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); console.log('getAuthenticatorCallback err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -4937,22 +4937,22 @@ getRemoteObject(): rpc.RemoteObject; ...@@ -4937,22 +4937,22 @@ getRemoteObject(): rpc.RemoteObject;
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({
bundleName: "com.example.accountjsdemo", bundleName: 'com.example.accountjsdemo',
abilityName: "com.example.accountjsdemo.LoginAbility", abilityName: 'com.example.accountjsdemo.LoginAbility',
}); });
} }
authenticate(name, authType, callerBundleName, options, callback) { authenticate(name, authType, callerBundleName, options, callback) {
var result = {[account_appAccount.Constants.KEY_NAME]: name, var result = {[account_appAccount.Constants.KEY_NAME]: name,
[account_appAccount.Constants.KEY_AUTH_TYPE]: authType, [account_appAccount.Constants.KEY_AUTH_TYPE]: authType,
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; [account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result); callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
} }
verifyCredential(name, options, callback) { verifyCredential(name, options, callback) {
callback.onRequestRedirected({ callback.onRequestRedirected({
bundleName: "com.example.accountjsdemo", bundleName: 'com.example.accountjsdemo',
abilityName: "com.example.accountjsdemo.VerifyAbility", abilityName: 'com.example.accountjsdemo.VerifyAbility',
parameters: { parameters: {
name: name name: name
} }
......
...@@ -86,7 +86,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -86,7 +86,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
if (err) { if (err) {
console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`); console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.log("activateOsAccount successfully"); console.log('activateOsAccount successfully');
} }
}); });
} catch (err) { } catch (err) {
...@@ -139,7 +139,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt; ...@@ -139,7 +139,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt;
console.log('activateOsAccount failed, err:' + JSON.stringify(err)); console.log('activateOsAccount failed, err:' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('activateOsAccount exception:' + JSON.stringify(e)); console.log('activateOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -172,7 +172,7 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -172,7 +172,7 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void
if (err) { if (err) {
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`); console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.log("checkMultiOsAccountEnabled successfully, isEnabled: " + isEnabled); console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled);
} }
}); });
} catch (err) { } catch (err) {
...@@ -254,7 +254,7 @@ checkOsAccountActivated(localId: number, callback: AsyncCallback&lt;boolean&gt;) ...@@ -254,7 +254,7 @@ checkOsAccountActivated(localId: number, callback: AsyncCallback&lt;boolean&gt;)
} }
}); });
} catch (err) { } catch (err) {
console.log('checkOsAccountActivated exception:' + JSON.stringify(err)); console.log('checkOsAccountActivated exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -300,7 +300,7 @@ checkOsAccountActivated(localId: number): Promise&lt;boolean&gt; ...@@ -300,7 +300,7 @@ checkOsAccountActivated(localId: number): Promise&lt;boolean&gt;
console.log('checkOsAccountActivated failed, error: ' + JSON.stringify(err)); console.log('checkOsAccountActivated failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('checkOsAccountActivated exception:' + JSON.stringify(err)); console.log('checkOsAccountActivated exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -335,17 +335,17 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: A ...@@ -335,17 +335,17 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: A
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let localId = 100; let localId = 100;
let constraint = "constraint.wifi"; let constraint = 'constraint.wifi';
try { try {
accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err, isEnabled)=>{ accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err, isEnabled)=>{
if (err) { if (err) {
console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); console.log('checkOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); console.log('checkOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); console.log('checkOsAccountConstraintEnabled exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -385,15 +385,15 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise&lt ...@@ -385,15 +385,15 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise&lt
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let localId = 100; let localId = 100;
let constraint = "constraint.wifi"; let constraint = 'constraint.wifi';
try { try {
accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled) => { accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled) => {
console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); console.log('checkOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
}).catch((err) => { }).catch((err) => {
console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); console.log('checkOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); console.log('checkOsAccountConstraintEnabled exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -424,13 +424,13 @@ checkOsAccountTestable(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -424,13 +424,13 @@ checkOsAccountTestable(callback: AsyncCallback&lt;boolean&gt;): void
try { try {
accountManager.checkOsAccountTestable((err, isTestable) => { accountManager.checkOsAccountTestable((err, isTestable) => {
if (err) { if (err) {
console.log("checkOsAccountTestable failed, error: " + JSON.stringify(err)); console.log('checkOsAccountTestable failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkOsAccountTestable successfully, isTestable: " + isTestable); console.log('checkOsAccountTestable successfully, isTestable: ' + isTestable);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkOsAccountTestable error: " + JSON.stringify(err)); console.log('checkOsAccountTestable error: ' + JSON.stringify(err));
} }
``` ```
...@@ -460,9 +460,9 @@ checkOsAccountTestable(): Promise&lt;boolean&gt; ...@@ -460,9 +460,9 @@ checkOsAccountTestable(): Promise&lt;boolean&gt;
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
try { try {
accountManager.checkOsAccountTestable().then((isTestable) => { accountManager.checkOsAccountTestable().then((isTestable) => {
console.log("checkOsAccountTestable successfully, isTestable: " + isTestable); console.log('checkOsAccountTestable successfully, isTestable: ' + isTestable);
}).catch((err) => { }).catch((err) => {
console.log("checkOsAccountTestable failed, error: " + JSON.stringify(err)); console.log('checkOsAccountTestable failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('checkOsAccountTestable exception: ' + JSON.stringify(err)); console.log('checkOsAccountTestable exception: ' + JSON.stringify(err));
...@@ -496,13 +496,13 @@ checkOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -496,13 +496,13 @@ checkOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
try { try {
accountManager.checkOsAccountVerified((err, isVerified) => { accountManager.checkOsAccountVerified((err, isVerified) => {
if (err) { if (err) {
console.log("checkOsAccountVerified failed, error: " + JSON.stringify(err)); console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkOsAccountVerified successfully, isVerified: " + isVerified); console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkOsAccountVerified exception: " + JSON.stringify(err)); console.log('checkOsAccountVerified exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -539,13 +539,13 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): ...@@ -539,13 +539,13 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;):
try { try {
accountManager.checkOsAccountVerified(localId, (err, isVerified) => { accountManager.checkOsAccountVerified(localId, (err, isVerified) => {
if (err) { if (err) {
console.log("checkOsAccountVerified failed, error: " + JSON.stringify(err)); console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("checkOsAccountVerified successfully, isVerified: " + isVerified); console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkOsAccountVerified exception: " + err); console.log('checkOsAccountVerified exception: ' + err);
} }
``` ```
...@@ -586,9 +586,9 @@ checkOsAccountVerified(localId: number): Promise&lt;boolean&gt; ...@@ -586,9 +586,9 @@ checkOsAccountVerified(localId: number): Promise&lt;boolean&gt;
let localId = 100; let localId = 100;
try { try {
accountManager.checkOsAccountVerified(localId).then((isVerified) => { accountManager.checkOsAccountVerified(localId).then((isVerified) => {
console.log("checkOsAccountVerified successfully, isVerified: " + isVerified); console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
}).catch((err) => { }).catch((err) => {
console.log("checkOsAccountVerified failed, error: " + JSON.stringify(err)); console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('checkOsAccountVerified exception: ' + JSON.stringify(err)); console.log('checkOsAccountVerified exception: ' + JSON.stringify(err));
...@@ -627,19 +627,19 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -627,19 +627,19 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let accountName = "testAccountName"; let accountName = 'testAccountName';
try { try {
accountManager.createOsAccount(accountName, account_osAccount.OsAccountType.NORMAL, (err, osAccountInfo) => { accountManager.createOsAccount(accountName, account_osAccount.OsAccountType.NORMAL, (err, osAccountInfo) => {
accountManager.removeOsAccount(osAccountInfo.localId, (err)=>{ accountManager.removeOsAccount(osAccountInfo.localId, (err)=>{
if (err) { if (err) {
console.log("removeOsAccount failed, error: " + JSON.stringify(err)); console.log('removeOsAccount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("removeOsAccount successfully"); console.log('removeOsAccount successfully');
} }
}); });
}); });
} catch (err) { } catch (err) {
console.log('removeOsAccount exception:' + JSON.stringify(err)); console.log('removeOsAccount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -680,17 +680,17 @@ removeOsAccount(localId: number): Promise&lt;void&gt; ...@@ -680,17 +680,17 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let accountName = "testAccountName"; let accountName = 'testAccountName';
try { try {
accountManager.createOsAccount(accountName, account_osAccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{ accountManager.createOsAccount(accountName, account_osAccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
accountManager.removeOsAccount(osAccountInfo.localId).then(() => { accountManager.removeOsAccount(osAccountInfo.localId).then(() => {
console.log("removeOsAccount successfully"); console.log('removeOsAccount successfully');
}).catch((err) => { }).catch((err) => {
console.log("removeOsAccount failed, error: " + JSON.stringify(err)); console.log('removeOsAccount failed, error: ' + JSON.stringify(err));
}); });
}); });
} catch (err) { } catch (err) {
console.log("removeOsAccount exception: " + JSON.stringify(err)); console.log('removeOsAccount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -729,17 +729,17 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl ...@@ -729,17 +729,17 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let localId = 100; let localId = 100;
let constraint = "constraint.wifi"; let constraint = 'constraint.wifi';
try { try {
accountManager.setOsAccountConstraints(localId, [constraint], true, (err) => { accountManager.setOsAccountConstraints(localId, [constraint], true, (err) => {
if (err) { if (err) {
console.log("setOsAccountConstraints failed, error:" + JSON.stringify(err)); console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("setOsAccountConstraints successfully"); console.log('setOsAccountConstraints successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log("setOsAccountConstraints exception: " + JSON.stringify(err)); console.log('setOsAccountConstraints exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -790,7 +790,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl ...@@ -790,7 +790,7 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err)); console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('setOsAccountConstraints exception:' + JSON.stringify(err)); console.log('setOsAccountConstraints exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -828,17 +828,17 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt; ...@@ -828,17 +828,17 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let localId = 100; let localId = 100;
let name = "demoName"; let name = 'demoName';
try { try {
accountManager.setOsAccountName(localId, name, (err) => { accountManager.setOsAccountName(localId, name, (err) => {
if (err) { if (err) {
console.log("setOsAccountName failed, error: " + JSON.stringify(err)); console.log('setOsAccountName failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("setOsAccountName successfully"); console.log('setOsAccountName successfully');
} }
}); });
} catch (err) { } catch (err) {
console.log('setOsAccountName exception:' + JSON.stringify(err)); console.log('setOsAccountName exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -889,7 +889,7 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt; ...@@ -889,7 +889,7 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
console.log('setOsAccountName failed, error: ' + JSON.stringify(err)); console.log('setOsAccountName failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('setOsAccountName exception:' + JSON.stringify(err)); console.log('setOsAccountName exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -922,13 +922,13 @@ getOsAccountCount(callback: AsyncCallback&lt;number&gt;): void ...@@ -922,13 +922,13 @@ getOsAccountCount(callback: AsyncCallback&lt;number&gt;): void
try { try {
accountManager.getOsAccountCount((err, count) => { accountManager.getOsAccountCount((err, count) => {
if (err) { if (err) {
console.log("getOsAccountCount failed, error: " + JSON.stringify(err)); console.log('getOsAccountCount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountCount successfully, count: " + count); console.log('getOsAccountCount successfully, count: ' + count);
} }
}); });
} catch (err) { } catch (err) {
console.log("getOsAccountCount exception: " + JSON.stringify(err)); console.log('getOsAccountCount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -960,12 +960,12 @@ getOsAccountCount(): Promise&lt;number&gt; ...@@ -960,12 +960,12 @@ getOsAccountCount(): Promise&lt;number&gt;
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
try { try {
accountManager.getOsAccountCount().then((count) => { accountManager.getOsAccountCount().then((count) => {
console.log("getOsAccountCount successfully, count: " + count); console.log('getOsAccountCount successfully, count: ' + count);
}).catch((err) => { }).catch((err) => {
console.log("getOsAccountCount failed, error: " + JSON.stringify(err)); console.log('getOsAccountCount failed, error: ' + JSON.stringify(err));
}); });
} catch(err) { } catch(err) {
console.log('getOsAccountCount exception:' + JSON.stringify(err)); console.log('getOsAccountCount exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -996,13 +996,13 @@ getOsAccountLocalId(callback: AsyncCallback&lt;number&gt;): void ...@@ -996,13 +996,13 @@ getOsAccountLocalId(callback: AsyncCallback&lt;number&gt;): void
try { try {
accountManager.getOsAccountLocalId((err, localId) => { accountManager.getOsAccountLocalId((err, localId) => {
if (err) { if (err) {
console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalId failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountLocalId successfully, localId: " + localId); console.log('getOsAccountLocalId successfully, localId: ' + localId);
} }
}); });
} catch (err) { } catch (err) {
console.log("getOsAccountLocalId exception: " + JSON.stringify(err)); console.log('getOsAccountLocalId exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1032,9 +1032,9 @@ getOsAccountLocalId(): Promise&lt;number&gt; ...@@ -1032,9 +1032,9 @@ getOsAccountLocalId(): Promise&lt;number&gt;
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
try { try {
accountManager.getOsAccountLocalId().then((localId) => { accountManager.getOsAccountLocalId().then((localId) => {
console.log("getOsAccountLocalId successfully, localId: " + localId); console.log('getOsAccountLocalId successfully, localId: ' + localId);
}).catch((err) => { }).catch((err) => {
console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalId failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('getOsAccountLocalId exception: ' + JSON.stringify(err)); console.log('getOsAccountLocalId exception: ' + JSON.stringify(err));
...@@ -1071,12 +1071,12 @@ getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): v ...@@ -1071,12 +1071,12 @@ getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): v
try { try {
accountManager.getOsAccountLocalIdForUid(uid, (err, localId) => { accountManager.getOsAccountLocalIdForUid(uid, (err, localId) => {
if (err) { if (err) {
console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdForUid failed, error: ' + JSON.stringify(err));
} }
console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); console.log('getOsAccountLocalIdForUid successfully, localId: ' + localId);
}); });
} catch (err) { } catch (err) {
console.log("getOsAccountLocalIdForUid exception: " + JSON.stringify(err)); console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1114,9 +1114,9 @@ getOsAccountLocalIdForUid(uid: number): Promise&lt;number&gt; ...@@ -1114,9 +1114,9 @@ getOsAccountLocalIdForUid(uid: number): Promise&lt;number&gt;
let uid = 12345678; let uid = 12345678;
try { try {
accountManager.getOsAccountLocalIdForUid(uid).then((localId) => { accountManager.getOsAccountLocalIdForUid(uid).then((localId) => {
console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); console.log('getOsAccountLocalIdForUid successfully, localId: ' + localId);
}).catch((err) => { }).catch((err) => {
console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdForUid failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err)); console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err));
...@@ -1155,9 +1155,9 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb ...@@ -1155,9 +1155,9 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb
try { try {
accountManager.getOsAccountLocalIdForDomain(domainInfo, (err, localId) => { accountManager.getOsAccountLocalIdForDomain(domainInfo, (err, localId) => {
if (err) { if (err) {
console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdForDomain failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); console.log('getOsAccountLocalIdForDomain successfully, localId: ' + localId);
} }
}); });
} catch (err) { } catch (err) {
...@@ -1201,12 +1201,12 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise&lt;number&g ...@@ -1201,12 +1201,12 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise&lt;number&g
let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'};
try { try {
accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId) => { accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId) => {
console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); console.log('getOsAccountLocalIdForDomain successfully, localId: ' + localId);
}).catch((err) => { }).catch((err) => {
console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdForDomain failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log("getOsAccountLocalIdForDomain exception: " + JSON.stringify(err)); console.log('getOsAccountLocalIdForDomain exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1245,7 +1245,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void ...@@ -1245,7 +1245,7 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
} }
}); });
} catch (err) { } catch (err) {
console.log('queryMaxOsAccountNumber exception:' + JSON.stringify(err)); console.log('queryMaxOsAccountNumber exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1282,7 +1282,7 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt; ...@@ -1282,7 +1282,7 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
console.log('queryMaxOsAccountNumber failed, error: ' + JSON.stringify(err)); console.log('queryMaxOsAccountNumber failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('queryMaxOsAccountNumber exception:' + JSON.stringify(err)); console.log('queryMaxOsAccountNumber exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1319,13 +1319,13 @@ getOsAccountConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;str ...@@ -1319,13 +1319,13 @@ getOsAccountConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;str
try { try {
accountManager.getOsAccountConstraints(localId, (err, constraints) => { accountManager.getOsAccountConstraints(localId, (err, constraints) => {
if (err) { if (err) {
console.log("getOsAccountConstraints failed, err: " + JSON.stringify(err)); console.log('getOsAccountConstraints failed, err: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountConstraints successfully, constraints: " + JSON.stringify(constraints)); console.log('getOsAccountConstraints successfully, constraints: ' + JSON.stringify(constraints));
} }
}); });
} catch (err) { } catch (err) {
console.log('getOsAccountConstraints exception:' + JSON.stringify(err)); console.log('getOsAccountConstraints exception: ' + JSON.stringify(err));
} }
``` ```
...@@ -1371,7 +1371,7 @@ getOsAccountConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt; ...@@ -1371,7 +1371,7 @@ getOsAccountConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
console.log('getOsAccountConstraints err: ' + JSON.stringify(err)); console.log('getOsAccountConstraints err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('getOsAccountConstraints exception:' + JSON.stringify(e)); console.log('getOsAccountConstraints exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1409,7 +1409,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;& ...@@ -1409,7 +1409,7 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&
console.log('queryAllCreatedOsAccounts accountArr:' + JSON.stringify(accountArr)); console.log('queryAllCreatedOsAccounts accountArr:' + JSON.stringify(accountArr));
}); });
} catch (e) { } catch (e) {
console.log('queryAllCreatedOsAccounts exception:' + JSON.stringify(e)); console.log('queryAllCreatedOsAccounts exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1448,7 +1448,7 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt; ...@@ -1448,7 +1448,7 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
console.log('queryAllCreatedOsAccounts err: ' + JSON.stringify(err)); console.log('queryAllCreatedOsAccounts err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('queryAllCreatedOsAccounts exception:' + JSON.stringify(e)); console.log('queryAllCreatedOsAccounts exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1485,7 +1485,7 @@ getActivatedOsAccountLocalIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt; ...@@ -1485,7 +1485,7 @@ getActivatedOsAccountLocalIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;
} }
}); });
} catch (e) { } catch (e) {
console.log('getActivatedOsAccountLocalIds exception:' + JSON.stringify(e)); console.log('getActivatedOsAccountLocalIds exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1520,7 +1520,7 @@ getActivatedOsAccountLocalIds(): Promise&lt;Array&lt;number&gt;&gt; ...@@ -1520,7 +1520,7 @@ getActivatedOsAccountLocalIds(): Promise&lt;Array&lt;number&gt;&gt;
console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err)); console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('getActivatedOsAccountLocalIds exception:' + JSON.stringify(e)); console.log('getActivatedOsAccountLocalIds exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1564,7 +1564,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback& ...@@ -1564,7 +1564,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
console.log('createOsAccount osAccountInfo:' + JSON.stringify(osAccountInfo)); console.log('createOsAccount osAccountInfo:' + JSON.stringify(osAccountInfo));
}); });
} catch (e) { } catch (e) {
console.log('createOsAccount exception:' + JSON.stringify(e)); console.log('createOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1614,7 +1614,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf ...@@ -1614,7 +1614,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
console.log('createOsAccount err: ' + JSON.stringify(err)); console.log('createOsAccount err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('createOsAccount exception:' + JSON.stringify(e)); console.log('createOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1659,7 +1659,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal ...@@ -1659,7 +1659,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
console.log('createOsAccountForDomain osAccountInfo:' + JSON.stringify(osAccountInfo)); console.log('createOsAccountForDomain osAccountInfo:' + JSON.stringify(osAccountInfo));
}); });
} catch (e) { } catch (e) {
console.log('createOsAccountForDomain exception:' + JSON.stringify(e)); console.log('createOsAccountForDomain exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1710,7 +1710,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr ...@@ -1710,7 +1710,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
console.log('createOsAccountForDomain err: ' + JSON.stringify(err)); console.log('createOsAccountForDomain err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('createOsAccountForDomain exception:' + JSON.stringify(e)); console.log('createOsAccountForDomain exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1746,7 +1746,7 @@ getCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void ...@@ -1746,7 +1746,7 @@ getCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
console.log('getCurrentOsAccount curAccountInfo:' + JSON.stringify(curAccountInfo)); console.log('getCurrentOsAccount curAccountInfo:' + JSON.stringify(curAccountInfo));
}); });
} catch (e) { } catch (e) {
console.log('getCurrentOsAccount exception:' + JSON.stringify(e)); console.log('getCurrentOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1783,7 +1783,7 @@ getCurrentOsAccount(): Promise&lt;OsAccountInfo&gt; ...@@ -1783,7 +1783,7 @@ getCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
console.log('getCurrentOsAccount err: ' + JSON.stringify(err)); console.log('getCurrentOsAccount err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('getCurrentOsAccount exception:' + JSON.stringify(e)); console.log('getCurrentOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1825,7 +1825,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt; ...@@ -1825,7 +1825,7 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;
console.log('queryOsAccountById accountInfo:' + JSON.stringify(accountInfo)); console.log('queryOsAccountById accountInfo:' + JSON.stringify(accountInfo));
}); });
} catch (e) { } catch (e) {
console.log('queryOsAccountById exception:' + JSON.stringify(e)); console.log('queryOsAccountById exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -1873,7 +1873,7 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt; ...@@ -1873,7 +1873,7 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
console.log('queryOsAccountById err: ' + JSON.stringify(err)); console.log('queryOsAccountById err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('queryOsAccountById exception:' + JSON.stringify(e)); console.log('queryOsAccountById exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2057,7 +2057,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;) ...@@ -2057,7 +2057,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;)
console.log('get photo:' + photo + ' by localId: ' + localId); console.log('get photo:' + photo + ' by localId: ' + localId);
}); });
} catch (e) { } catch (e) {
console.log('getOsAccountProfilePhoto exception:' + JSON.stringify(e)); console.log('getOsAccountProfilePhoto exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2105,7 +2105,7 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt; ...@@ -2105,7 +2105,7 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
console.log('getOsAccountProfilePhoto err: ' + JSON.stringify(err)); console.log('getOsAccountProfilePhoto err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('getOsAccountProfilePhoto exception:' + JSON.stringify(e)); console.log('getOsAccountProfilePhoto exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2152,7 +2152,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback ...@@ -2152,7 +2152,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
console.log('setOsAccountProfilePhoto err:' + JSON.stringify(err)); console.log('setOsAccountProfilePhoto err:' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('setOsAccountProfilePhoto exception:' + JSON.stringify(e)); console.log('setOsAccountProfilePhoto exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2206,7 +2206,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt; ...@@ -2206,7 +2206,7 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
console.log('setOsAccountProfilePhoto err: ' + JSON.stringify(err)); console.log('setOsAccountProfilePhoto err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('setOsAccountProfilePhoto exception:' + JSON.stringify(e)); console.log('setOsAccountProfilePhoto exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2244,7 +2244,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback ...@@ -2244,7 +2244,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback
console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber); console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber);
}); });
} catch (e) { } catch (e) {
console.log('ger localId exception:' + JSON.stringify(e)); console.log('ger localId exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2326,7 +2326,7 @@ getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback&lt;n ...@@ -2326,7 +2326,7 @@ getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback&lt;n
console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId); console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId);
}); });
} catch (e) { } catch (e) {
console.log('ger serialNumber exception:' + JSON.stringify(e)); console.log('ger serialNumber exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2370,7 +2370,7 @@ getSerialNumberForOsAccountLocalId(localId: number): Promise&lt;number&gt; ...@@ -2370,7 +2370,7 @@ getSerialNumberForOsAccountLocalId(localId: number): Promise&lt;number&gt;
console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err)); console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.log('getSerialNumberForOsAccountLocalId exception:' + JSON.stringify(e)); console.log('getSerialNumberForOsAccountLocalId exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2411,7 +2411,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g ...@@ -2411,7 +2411,7 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g
try { try {
accountManager.on('activating', 'osAccountOnOffNameA', onCallback); accountManager.on('activating', 'osAccountOnOffNameA', onCallback);
} catch (e) { } catch (e) {
console.log('receive localId exception:' + JSON.stringify(e)); console.log('receive localId exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2452,7 +2452,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number ...@@ -2452,7 +2452,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
try { try {
accountManager.off('activating', 'osAccountOnOffNameA', offCallback); accountManager.off('activating', 'osAccountOnOffNameA', offCallback);
} catch (e) { } catch (e) {
console.log('off exception:' + JSON.stringify(e)); console.log('off exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2491,7 +2491,7 @@ getBundleIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): void; ...@@ -2491,7 +2491,7 @@ getBundleIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): void;
console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId)); console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId));
}); });
} catch (e) { } catch (e) {
console.info('getBundleIdForUid exception:' + JSON.stringify(e)); console.info('getBundleIdForUid exception: ' + JSON.stringify(e));
} }
``` ```
### getBundleIdForUid<sup>9+</sup> ### getBundleIdForUid<sup>9+</sup>
...@@ -2535,7 +2535,7 @@ getBundleIdForUid(uid: number): Promise&lt;number&gt;; ...@@ -2535,7 +2535,7 @@ getBundleIdForUid(uid: number): Promise&lt;number&gt;;
console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); console.info('getBundleIdForUid errInfo:' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.info('getBundleIdForUid exception:' + JSON.stringify(e)); console.info('getBundleIdForUid exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2573,7 +2573,7 @@ isMainOsAccount(callback: AsyncCallback&lt;boolean&gt;): void; ...@@ -2573,7 +2573,7 @@ isMainOsAccount(callback: AsyncCallback&lt;boolean&gt;): void;
console.info('isMainOsAccount result:' + JSON.stringify(result)); console.info('isMainOsAccount result:' + JSON.stringify(result));
}); });
} catch (e) { } catch (e) {
console.info('isMainOsAccount exception:' + JSON.stringify(e)); console.info('isMainOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
### isMainOsAccount<sup>9+</sup> ### isMainOsAccount<sup>9+</sup>
...@@ -2611,7 +2611,7 @@ isMainOsAccount(): Promise&lt;boolean&gt;; ...@@ -2611,7 +2611,7 @@ isMainOsAccount(): Promise&lt;boolean&gt;;
console.info('isMainOsAccount errInfo:' + JSON.stringify(err)); console.info('isMainOsAccount errInfo:' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.info('isMainOsAccount exception:' + JSON.stringify(e)); console.info('isMainOsAccount exception: ' + JSON.stringify(e));
} }
``` ```
### getOsAccountConstraintSourceTypes<sup>9+</sup> ### getOsAccountConstraintSourceTypes<sup>9+</sup>
...@@ -2652,7 +2652,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: ...@@ -2652,7 +2652,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback:
console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos));
}); });
} catch (e) { } catch (e) {
console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); console.info('getOsAccountConstraintSourceTypes exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2700,7 +2700,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise& ...@@ -2700,7 +2700,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise&
console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err));
}); });
} catch (e) { } catch (e) {
console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); console.info('getOsAccountConstraintSourceTypes exception: ' + JSON.stringify(e));
} }
``` ```
...@@ -2728,9 +2728,9 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -2728,9 +2728,9 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable((err, isEnabled) => { accountManager.isMultiOsAccountEnable((err, isEnabled) => {
if (err) { if (err) {
console.log("isMultiOsAccountEnable failed, error: " + JSON.stringify(err)); console.log('isMultiOsAccountEnable failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("isMultiOsAccountEnable successfully, isEnabled: " + isEnabled); console.log('isMultiOsAccountEnable successfully, isEnabled: ' + isEnabled);
} }
}); });
``` ```
...@@ -2865,12 +2865,12 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async ...@@ -2865,12 +2865,12 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let localId = 100; let localId = 100;
let constraint = "constraint.wifi"; let constraint = 'constraint.wifi';
accountManager.isOsAccountConstraintEnable(localId, constraint, (err, isEnabled) => { accountManager.isOsAccountConstraintEnable(localId, constraint, (err, isEnabled) => {
if (err) { if (err) {
console.log("isOsAccountConstraintEnable failed, error:" + JSON.stringify(err)); console.log('isOsAccountConstraintEnable failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("isOsAccountConstraintEnable successfully, isEnabled:" + isEnabled); console.log('isOsAccountConstraintEnable successfully, isEnabled: ' + isEnabled);
} }
}); });
``` ```
...@@ -2907,11 +2907,11 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boo ...@@ -2907,11 +2907,11 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boo
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let localId = 100; let localId = 100;
let constraint = "constraint.wifi"; let constraint = 'constraint.wifi';
accountManager.isOsAccountConstraintEnable(localId, constraint).then((isEnabled) => { accountManager.isOsAccountConstraintEnable(localId, constraint).then((isEnabled) => {
console.log("isOsAccountConstraintEnable successfully, isEnabled: " + isEnabled); console.log('isOsAccountConstraintEnable successfully, isEnabled: ' + isEnabled);
}).catch((err) => { }).catch((err) => {
console.log("isOsAccountConstraintEnable err: " + JSON.stringify(err)); console.log('isOsAccountConstraintEnable err: ' + JSON.stringify(err));
}); });
``` ```
...@@ -2939,9 +2939,9 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -2939,9 +2939,9 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount((err, isTestable) => { accountManager.isTestOsAccount((err, isTestable) => {
if (err) { if (err) {
console.log("isTestOsAccount failed, error: " + JSON.stringify(err)); console.log('isTestOsAccount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("isTestOsAccount successfully, isTestable: " + isTestable); console.log('isTestOsAccount successfully, isTestable: ' + isTestable);
} }
}); });
``` ```
...@@ -2969,9 +2969,9 @@ isTestOsAccount(): Promise&lt;boolean&gt; ...@@ -2969,9 +2969,9 @@ isTestOsAccount(): Promise&lt;boolean&gt;
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount().then((isTestable) => { accountManager.isTestOsAccount().then((isTestable) => {
console.log("isTestOsAccount successfully, isTestable: " + isTestable); console.log('isTestOsAccount successfully, isTestable: ' + isTestable);
}).catch((err) => { }).catch((err) => {
console.log("isTestOsAccount failed, error: " + JSON.stringify(err)); console.log('isTestOsAccount failed, error: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3001,9 +3001,9 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -3001,9 +3001,9 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => { accountManager.isOsAccountVerified((err, isVerified) => {
if (err) { if (err) {
console.log("isOsAccountVerified failed, error: " + JSON.stringify(err)); console.log('isOsAccountVerified failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("isOsAccountVerified successfully, isVerified: " + isVerified); console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
} }
}); });
``` ```
...@@ -3036,9 +3036,9 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo ...@@ -3036,9 +3036,9 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo
let localId = 100; let localId = 100;
accountManager.isOsAccountVerified(localId, (err, isVerified) => { accountManager.isOsAccountVerified(localId, (err, isVerified) => {
if (err) { if (err) {
console.log("isOsAccountVerified failed, error: " + JSON.stringify(err)); console.log('isOsAccountVerified failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("isOsAccountVerified successfully, isVerified: " + isVerified); console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
} }
}); });
``` ```
...@@ -3074,9 +3074,9 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt; ...@@ -3074,9 +3074,9 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified(localId).then((isVerified) => { accountManager.isOsAccountVerified(localId).then((isVerified) => {
console.log("isOsAccountVerified successfully, isVerified: " + isVerified); console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
}).catch((err) => { }).catch((err) => {
console.log("isOsAccountVerified failed, error: " + JSON.stringify(err)); console.log('isOsAccountVerified failed, error: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3106,9 +3106,9 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void ...@@ -3106,9 +3106,9 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount((err, count)=>{ accountManager.getCreatedOsAccountsCount((err, count)=>{
if (err) { if (err) {
console.log("getCreatedOsAccountsCount failed, error: " + JSON.stringify(err)); console.log('getCreatedOsAccountsCount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getCreatedOsAccountsCount successfully, count: " + count); console.log('getCreatedOsAccountsCount successfully, count: ' + count);
} }
}); });
``` ```
...@@ -3138,9 +3138,9 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt; ...@@ -3138,9 +3138,9 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt;
```js ```js
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount().then((count) => { accountManager.getCreatedOsAccountsCount().then((count) => {
console.log("getCreatedOsAccountsCount successfully, count: " + count); console.log('getCreatedOsAccountsCount successfully, count: ' + count);
}).catch((err) => { }).catch((err) => {
console.log("getCreatedOsAccountsCount failed, error: " + JSON.stringify(err)); console.log('getCreatedOsAccountsCount failed, error: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3168,9 +3168,9 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void ...@@ -3168,9 +3168,9 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess((err, localId) => { accountManager.getOsAccountLocalIdFromProcess((err, localId) => {
if (err) { if (err) {
console.log("getOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdFromProcess failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountLocalIdFromProcess successfully, localId: " + localId); console.log('getOsAccountLocalIdFromProcess failed, error: ' + localId);
} }
}); });
``` ```
...@@ -3230,9 +3230,9 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;): ...@@ -3230,9 +3230,9 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;):
let uid = 12345678; let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid, (err, localId) => { accountManager.getOsAccountLocalIdFromUid(uid, (err, localId) => {
if (err) { if (err) {
console.log("getOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdFromUid failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountLocalIdFromUid successfully, localId: " + localId); console.log('getOsAccountLocalIdFromUid successfully, localId: ' + localId);
} }
}); });
``` ```
...@@ -3267,9 +3267,9 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt; ...@@ -3267,9 +3267,9 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let uid = 12345678; let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid).then((localId) => { accountManager.getOsAccountLocalIdFromUid(uid).then((localId) => {
console.log("getOsAccountLocalIdFromUid successfully, localId: " + localId); console.log('getOsAccountLocalIdFromUid successfully, localId: ' + localId);
}).catch((err) => { }).catch((err) => {
console.log("getOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdFromUid failed, error: ' + JSON.stringify(err));
}); });
``` ```
...@@ -3301,9 +3301,9 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall ...@@ -3301,9 +3301,9 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, localId) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, localId) => {
if (err) { if (err) {
console.log("getOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); console.log('getOsAccountLocalIdFromDomain failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("getOsAccountLocalIdFromDomain successfully, localId: " + localId); console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId);
} }
}); });
``` ```
...@@ -4396,7 +4396,7 @@ static unregisterInputer(authType: AuthType): void ...@@ -4396,7 +4396,7 @@ static unregisterInputer(authType: AuthType): void
account_osAccount.InputerManager.unregisterInputer(authType); account_osAccount.InputerManager.unregisterInputer(authType);
console.log('unregisterInputer success.'); console.log('unregisterInputer success.');
} catch(err) { } catch(err) {
console.log("unregisterInputer err:" + JSON.stringify(err)); console.log('unregisterInputer err:' + JSON.stringify(err));
} }
``` ```
...@@ -4577,7 +4577,7 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback&lt;D ...@@ -4577,7 +4577,7 @@ getAccountInfo(domain: string, accountName: string, callback: AsyncCallback&lt;D
}, { }, {
domain: domain, domain: domain,
accountName: accountName, accountName: accountName,
accountId: "xxxx" accountId: 'xxxx'
}) })
}, },
getAuthStatusInfo: (domainAccountInfo, callback) => {}, getAuthStatusInfo: (domainAccountInfo, callback) => {},
...@@ -4823,7 +4823,7 @@ static registerPlugin(plugin: DomainPlugin): void ...@@ -4823,7 +4823,7 @@ static registerPlugin(plugin: DomainPlugin): void
account_osAccount.DomainAccountManager.registerPlugin(plugin); account_osAccount.DomainAccountManager.registerPlugin(plugin);
console.log('registerPlugin success.'); console.log('registerPlugin success.');
} catch(err) { } catch(err) {
console.log("registerPlugin err:" + JSON.stringify(err)); console.log('registerPlugin err:' + JSON.stringify(err));
} }
``` ```
...@@ -4845,7 +4845,7 @@ static unregisterPlugin(): void ...@@ -4845,7 +4845,7 @@ static unregisterPlugin(): void
account_osAccount.DomainAccountManager.unregisterPlugin(); account_osAccount.DomainAccountManager.unregisterPlugin();
console.log('unregisterPlugin success.'); console.log('unregisterPlugin success.');
} catch(err) { } catch(err) {
console.log("unregisterPlugin err:" + JSON.stringify(err)); console.log('unregisterPlugin err:' + JSON.stringify(err));
} }
``` ```
...@@ -4888,8 +4888,8 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs ...@@ -4888,8 +4888,8 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
**示例:** **示例:**
```js ```js
let domainAccountInfo = { let domainAccountInfo = {
domain: "CHINA", domain: 'CHINA',
accountName: "zhangsan" accountName: 'zhangsan'
} }
let credential = new Uint8Array([0]) let credential = new Uint8Array([0])
try { try {
...@@ -5030,15 +5030,15 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;bool ...@@ -5030,15 +5030,15 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;bool
**示例:** **示例:**
```js ```js
let domainAccountInfo = { let domainAccountInfo = {
domain: "CHINA", domain: 'CHINA',
accountName: "zhangsan" accountName: 'zhangsan'
} }
try { try {
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, result) => { account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, result) => {
if (err) { if (err) {
console.log("call hasAccount failed, error: " + JSON.stringify(err)); console.log('call hasAccount failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("hasAccount result: " + result); console.log('hasAccount result: ' + result);
} }
}); });
} catch (err) { } catch (err) {
...@@ -5081,14 +5081,14 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise&lt;boolean&gt; ...@@ -5081,14 +5081,14 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise&lt;boolean&gt;
**示例:** **示例:**
```js ```js
let domainAccountInfo = { let domainAccountInfo = {
domain: "CHINA", domain: 'CHINA',
accountName: "zhangsan" accountName: 'zhangsan'
} }
try { try {
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result) => { account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result) => {
console.log("hasAccount result: " + result); console.log('hasAccount result: ' + result);
}).catch((err) => { }).catch((err) => {
console.log("call hasAccount failed, error: " + JSON.stringify(err)); console.log('call hasAccount failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('hasAccount exception = ' + JSON.stringify(err)); console.log('hasAccount exception = ' + JSON.stringify(err));
...@@ -5126,17 +5126,17 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call ...@@ -5126,17 +5126,17 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call
**示例:** **示例:**
```js ```js
let domainAccountInfo = { let domainAccountInfo = {
domain: "CHINA", domain: 'CHINA',
accountName: "zhangsan", accountName: 'zhangsan',
accountId: "123456" accountId: '123456'
} }
let token = new Uint8Array([0]) let token = new Uint8Array([0])
try { try {
account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token, (err) => { account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token, (err) => {
if (err != null) { if (err != null) {
console.log("updateAccountToken failed, error: " + JSON.stringify(err)); console.log('updateAccountToken failed, error: ' + JSON.stringify(err));
} else { } else {
console.log("updateAccountToken successfully"); console.log('updateAccountToken successfully');
} }
}) })
} catch (err) { } catch (err) {
...@@ -5180,16 +5180,16 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro ...@@ -5180,16 +5180,16 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro
**示例:** **示例:**
```js ```js
let domainAccountInfo = { let domainAccountInfo = {
domain: "CHINA", domain: 'CHINA',
accountName: "zhangsan", accountName: 'zhangsan',
accountId: "123456" accountId: '123456'
} }
let token = new Uint8Array([0]) let token = new Uint8Array([0])
try { try {
account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token).then(() => { account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token).then(() => {
console.log("updateAccountToken successfully"); console.log('updateAccountToken successfully');
}).catch((err) => { }).catch((err) => {
console.log("updateAccountToken failed, error: " + JSON.stringify(err)); console.log('updateAccountToken failed, error: ' + JSON.stringify(err));
}); });
} catch (err) { } catch (err) {
console.log('updateAccountToken exception = ' + JSON.stringify(err)); console.log('updateAccountToken exception = ' + JSON.stringify(err));
...@@ -5465,7 +5465,7 @@ cancel(challenge: Uint8Array): void; ...@@ -5465,7 +5465,7 @@ cancel(challenge: Uint8Array): void;
try { try {
userIDM.cancel(challenge); userIDM.cancel(challenge);
} catch(err) { } catch(err) {
console.log("cancel err:" + JSON.stringify(err)); console.log('cancel err:' + JSON.stringify(err));
} }
``` ```
......
...@@ -58,7 +58,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -58,7 +58,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try { try {
privacyManager.addPermissionUsedRecord(tokenID, "ohos.permission.PERMISSION_USED_STATS", 1, 0).then(() => { privacyManager.addPermissionUsedRecord(tokenID, 'ohos.permission.PERMISSION_USED_STATS', 1, 0).then(() => {
console.log('addPermissionUsedRecord success'); console.log('addPermissionUsedRecord success');
}).catch((err) => { }).catch((err) => {
console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`); console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`);
...@@ -108,7 +108,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -108,7 +108,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try { try {
privacyManager.addPermissionUsedRecord(tokenID, "ohos.permission.PERMISSION_USED_STATS", 1, 0, (err, data) => { privacyManager.addPermissionUsedRecord(tokenID, 'ohos.permission.PERMISSION_USED_STATS', 1, 0, (err, data) => {
if (err) { if (err) {
console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`); console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`);
} else { } else {
...@@ -160,14 +160,14 @@ getPermissionUsedRecord(request: PermissionUsedRequest): Promise&lt;PermissionUs ...@@ -160,14 +160,14 @@ getPermissionUsedRecord(request: PermissionUsedRequest): Promise&lt;PermissionUs
import privacyManager from '@ohos.privacyManager'; import privacyManager from '@ohos.privacyManager';
let request = { let request = {
"tokenId": 1, 'tokenId': 1,
"isRemote": false, 'isRemote': false,
"deviceId": "device", 'deviceId': 'device',
"bundleName": "bundle", 'bundleName': 'bundle',
"permissionNames": [], 'permissionNames': [],
"beginTime": 0, 'beginTime': 0,
"endTime": 1, 'endTime': 1,
"flag":privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL, 'flag':privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
}; };
try { try {
privacyManager.getPermissionUsedRecord(request).then((data) => { privacyManager.getPermissionUsedRecord(request).then((data) => {
...@@ -215,14 +215,14 @@ getPermissionUsedRecord(request: PermissionUsedRequest, callback: AsyncCallback& ...@@ -215,14 +215,14 @@ getPermissionUsedRecord(request: PermissionUsedRequest, callback: AsyncCallback&
import privacyManager from '@ohos.privacyManager'; import privacyManager from '@ohos.privacyManager';
let request = { let request = {
"tokenId": 1, 'tokenId': 1,
"isRemote": false, 'isRemote': false,
"deviceId": "device", 'deviceId': 'device',
"bundleName": "bundle", 'bundleName': 'bundle',
"permissionNames": [], 'permissionNames': [],
"beginTime": 0, 'beginTime': 0,
"endTime": 1, 'endTime': 1,
"flag":privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL, 'flag':privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
}; };
try { try {
privacyManager.getPermissionUsedRecord(request, (err, data) => { privacyManager.getPermissionUsedRecord(request, (err, data) => {
...@@ -280,7 +280,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -280,7 +280,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try { try {
privacyManager.startUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS").then(() => { privacyManager.startUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS').then(() => {
console.log('startUsingPermission success'); console.log('startUsingPermission success');
}).catch((err) => { }).catch((err) => {
console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`); console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`);
...@@ -328,7 +328,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -328,7 +328,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try { try {
privacyManager.startUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS", (err, data) => { privacyManager.startUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS', (err, data) => {
if (err) { if (err) {
console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`); console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`);
} else { } else {
...@@ -383,7 +383,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -383,7 +383,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try { try {
privacyManager.stopUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS").then(() => { privacyManager.stopUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS').then(() => {
console.log('stopUsingPermission success'); console.log('stopUsingPermission success');
}).catch((err) => { }).catch((err) => {
console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`); console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`);
...@@ -431,7 +431,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -431,7 +431,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try { try {
privacyManager.stopUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS", (err, data) => { privacyManager.stopUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS', (err, data) => {
if (err) { if (err) {
console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`); console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`);
} else { } else {
...@@ -481,7 +481,7 @@ import privacyManager from '@ohos.privacyManager'; ...@@ -481,7 +481,7 @@ import privacyManager from '@ohos.privacyManager';
let permissionList = []; let permissionList = [];
try { try {
privacyManager.on('activeStateChange', permissionList, (data) => { privacyManager.on('activeStateChange', permissionList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data)); console.debug('receive permission state change, data:' + JSON.stringify(data));
}); });
} catch(err) { } catch(err) {
console.log(`catch err->${JSON.stringify(err)}`); console.log(`catch err->${JSON.stringify(err)}`);
...@@ -513,7 +513,7 @@ off(type: 'activeStateChange', permissionList: Array&lt;Permissions&gt;, callbac ...@@ -513,7 +513,7 @@ off(type: 'activeStateChange', permissionList: Array&lt;Permissions&gt;, callbac
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | -------- | | -------- | -------- |
| 12100001 | The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes. | | 12100001 | The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes. |
| 12100004 | The interface is not used together with "on"| | 12100004 | The interface is not used together with 'on'|
| 12100007 | Service is abnormal. | | 12100007 | Service is abnormal. |
| 12100008 | Out of memory. | | 12100008 | Out of memory. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册