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

doc排查

Signed-off-by: Nchennian <chennian1@huawei.com>
上级 dd30afa9
......@@ -73,7 +73,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
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)}`);
}).catch((err) => {
console.log(`checkAccessToken fail, err->${JSON.stringify(err)}`);
......@@ -117,7 +117,7 @@ verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus
```js
let atManager = abilityAccessCtrl.createAtManager();
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)}`);
```
......@@ -168,7 +168,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1;
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');
}).catch((err) => {
console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`);
......@@ -220,7 +220,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1;
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) {
console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -279,7 +279,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1;
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');
}).catch((err) => {
console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`);
......@@ -331,7 +331,7 @@ let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
let permissionFlags = 1;
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) {
console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -388,7 +388,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取
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)}`);
}).catch((err) => {
console.log(`getPermissionFlags fail, err->${JSON.stringify(err)}`);
......@@ -466,10 +466,10 @@ import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
let permissionList: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try {
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) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -504,7 +504,7 @@ off(type: 'permissionStateChange', tokenIDList: Array&lt;number&gt;, permissionL
| 错误码ID | 错误信息 |
| -------- | -------- |
| 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. |
| 12100008 | Out of memory. |
......@@ -517,7 +517,7 @@ import bundleManager from '@ohos.bundle.bundleManager';
let atManager = abilityAccessCtrl.createAtManager();
let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
let permissionList: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try {
atManager.off('permissionStateChange', tokenIDList, permissionList);
} catch(err) {
......@@ -557,7 +557,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
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 => {
console.log(`promise: data->${JSON.stringify(data)}`);
});
......@@ -598,10 +598,10 @@ requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permission
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"], (err, data)=>{
console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults);
atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA'], (err, data)=>{
console.info('data:' + JSON.stringify(data));
console.info('data permissions:' + data.permissions);
console.info('data authResults:' + data.authResults);
});
} catch(err) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -649,12 +649,12 @@ requestPermissionsFromUser(context: Context, permissionList: Array&lt;Permission
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"]).then((data) => {
console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults);
atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA']).then((data) => {
console.info('data:' + JSON.stringify(data));
console.info('data permissions:' + data.permissions);
console.info('data authResults:' + data.authResults);
}).catch((err) => {
console.info("data:" + JSON.stringify(err));
console.info('data:' + JSON.stringify(err));
})
} catch(err) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -693,7 +693,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
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 => {
console.log(`promise: data->${JSON.stringify(data)}`);
});
......@@ -733,7 +733,7 @@ checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
```js
let atManager = abilityAccessCtrl.createAtManager();
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)}`);
```
......
......@@ -65,11 +65,11 @@ createAccount(name: string, callback: AsyncCallback&lt;void&gt;): void;
```js
try {
appAccountManager.createAccount("WangWu", (err) => {
console.log("createAccount err: " + JSON.stringify(err));
appAccountManager.createAccount('WangWu', (err) => {
console.log('createAccount err: ' + JSON.stringify(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
```js
let options = {
customData: {
"age": "10"
'age': '10'
}
}
try {
appAccountManager.createAccount("LiSi", options, (err) => {
appAccountManager.createAccount('LiSi', options, (err) => {
if (err) {
console.log("createAccount failed, error: " + JSON.stringify(err));
console.log('createAccount failed, error: ' + JSON.stringify(err));
} else {
console.log("createAccount successfully");
console.log('createAccount successfully');
}
});
} 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;
```js
let options = {
customData: {
"age": "10"
'age': '10'
}
}
try {
appAccountManager.createAccount("LiSi", options).then(() => {
console.log("createAccount successfully");
appAccountManager.createAccount('LiSi', options).then(() => {
console.log('createAccount successfully');
}).catch((err) => {
console.log("createAccount failed, error: " + JSON.stringify(err));
console.log('createAccount failed, error: ' + JSON.stringify(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
```js
function onResultCallback(code, result) {
console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result));
console.log('resultCode: ' + code);
console.log('result: ' + JSON.stringify(result));
}
function onRequestRedirectedCallback(request) {
......@@ -210,19 +210,19 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
console.log('startAbility successfully');
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
console.log('startAbility err: ' + JSON.stringify(err));
})
}
try {
appAccountManager.createAccountImplicitly("com.example.accountjsdemo", {
appAccountManager.createAccountImplicitly('com.example.accountjsdemo', {
onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback
});
} 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,
```js
function onResultCallback(code, result) {
console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result));
console.log('resultCode: ' + code);
console.log('result: ' + JSON.stringify(result));
}
function onRequestRedirectedCallback(request) {
......@@ -269,23 +269,23 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions,
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
console.log('startAbility successfully');
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
console.log('startAbility err: ' + JSON.stringify(err));
})
}
let options = {
authType: "getSocialData",
requiredLabels: [ "student" ]
authType: 'getSocialData',
requiredLabels: [ 'student' ]
};
try {
appAccountManager.createAccountImplicitly("com.example.accountjsdemo", options, {
appAccountManager.createAccountImplicitly('com.example.accountjsdemo', options, {
onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback
});
} 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
```js
try {
appAccountManager.removeAccount("ZhaoLiu", (err) => {
appAccountManager.removeAccount('ZhaoLiu', (err) => {
if (err) {
console.log("removeAccount failed, error: " + JSON.stringify(err));
console.log('removeAccount failed, error: ' + JSON.stringify(err));
} else {
console.log("removeAccount successfully");
console.log('removeAccount successfully');
}
});
} 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;
```js
try {
appAccountManager.removeAccount("Lisi").then(() => {
console.log("removeAccount successfully");
appAccountManager.removeAccount('Lisi').then(() => {
console.log('removeAccount successfully');
}).catch((err) => {
console.log("removeAccount failed, error: " + JSON.stringify(err));
console.log('removeAccount failed, error: ' + JSON.stringify(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:
```js
try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true, (err) => {
appAccountManager.setAppAccess('ZhangSan', 'com.example.accountjsdemo', true, (err) => {
if (err) {
console.log("setAppAccess failed: " + JSON.stringify(err));
console.log('setAppAccess failed: ' + JSON.stringify(err));
} else {
console.log("setAppAccess successfully");
console.log('setAppAccess successfully');
}
});
} 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
```js
try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true).then(() => {
console.log("setAppAccess successfully");
appAccountManager.setAppAccess('ZhangSan', 'com.example.accountjsdemo', true).then(() => {
console.log('setAppAccess successfully');
}).catch((err) => {
console.log("setAppAccess failed: " + JSON.stringify(err));
console.log('setAppAccess failed: ' + JSON.stringify(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
```js
try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo", (err, isAccessible) => {
appAccountManager.checkAppAccess('ZhangSan', 'com.example.accountjsdemo', (err, isAccessible) => {
if (err) {
console.log("checkAppAccess failed, error: " + JSON.stringify(err));
console.log('checkAppAccess failed, error: ' + JSON.stringify(err));
} else {
console.log("checkAppAccess successfully");
console.log('checkAppAccess successfully');
}
});
} 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;
```js
try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo").then((isAccessible) => {
console.log("checkAppAccess successfully, isAccessible: " + isAccessible);
appAccountManager.checkAppAccess('ZhangSan', 'com.example.accountjsdemo').then((isAccessible) => {
console.log('checkAppAccess successfully, isAccessible: ' + isAccessible);
}).catch((err) => {
console.log("checkAppAccess failed, error: " + JSON.stringify(err));
console.log('checkAppAccess failed, error: ' + JSON.stringify(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;
```js
try {
appAccountManager.setDataSyncEnabled("ZhangSan", true, (err) => {
console.log("setDataSyncEnabled err: " + JSON.stringify(err));
appAccountManager.setDataSyncEnabled('ZhangSan', true, (err) => {
console.log('setDataSyncEnabled err: ' + JSON.stringify(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;
```js
try {
appAccountManager .setDataSyncEnabled("ZhangSan", true).then(() => {
appAccountManager .setDataSyncEnabled('ZhangSan', true).then(() => {
console.log('setDataSyncEnabled Success');
}).catch((err) => {
console.log("setDataSyncEnabled err: " + JSON.stringify(err));
console.log('setDataSyncEnabled err: ' + JSON.stringify(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
```js
try {
appAccountManager.checkDataSyncEnabled("ZhangSan", (err, isEnabled) => {
appAccountManager.checkDataSyncEnabled('ZhangSan', (err, isEnabled) => {
if (err) {
console.log("checkDataSyncEnabled failed, err: " + JSON.stringify(err));
console.log('checkDataSyncEnabled failed, err: ' + JSON.stringify(err));
} else {
console.log('checkDataSyncEnabled successfully, isEnabled: ' + isEnabled);
}
});
} 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;
```js
try {
appAccountManager.checkDataSyncEnabled("ZhangSan").then((isEnabled) => {
console.log("checkDataSyncEnabled successfully, isEnabled: " + isEnabled);
appAccountManager.checkDataSyncEnabled('ZhangSan').then((isEnabled) => {
console.log('checkDataSyncEnabled successfully, isEnabled: ' + isEnabled);
}).catch((err) => {
console.log("checkDataSyncEnabled failed, err: " + JSON.stringify(err));
console.log('checkDataSyncEnabled failed, err: ' + JSON.stringify(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:
```js
try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx", (err) => {
appAccountManager.setCredential('ZhangSan', 'PIN_SIX', 'xxxxxx', (err) => {
if (err) {
console.log("setCredential failed, error: " + JSON.stringify(err));
console.log('setCredential failed, error: ' + JSON.stringify(err));
} else {
console.log("setCredential successfully");
console.log('setCredential successfully');
}
});
} 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
```js
try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx").then(() => {
console.log("setCredential successfully");
appAccountManager.setCredential('ZhangSan', 'PIN_SIX', 'xxxxxx').then(() => {
console.log('setCredential successfully');
}).catch((err) => {
console.log("setCredential failed, error: " + JSON.stringify(err));
console.log('setCredential failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX", (err, result) => {
appAccountManager.getCredential('ZhangSan', 'PIN_SIX', (err, result) => {
if (err) {
console.log("getCredential failed, error: " + JSON.stringify(err));
console.log('getCredential failed, error: ' + JSON.stringify(err));
} else {
console.log('getCredential successfully, result: ' + result);
}
});
} 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;
```js
try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX").then((credential) => {
console.log("getCredential successfully, credential: " + credential);
appAccountManager.getCredential('ZhangSan', 'PIN_SIX').then((credential) => {
console.log('getCredential successfully, credential: ' + credential);
}).catch((err) => {
console.log("getCredential failed, error: " + JSON.stringify(err));
console.log('getCredential failed, error: ' + JSON.stringify(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&
```js
try {
appAccountManager.setCustomData("ZhangSan", "age", "12", (err) => {
appAccountManager.setCustomData('ZhangSan', 'age', '12', (err) => {
if (err) {
console.log("setCustomData failed, error: " + JSON.stringify(err));
console.log('setCustomData failed, error: ' + JSON.stringify(err));
} else {
console.log("setCustomData successfully");
console.log('setCustomData successfully');
}
});
} 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;
```js
try {
appAccountManager.setCustomData("ZhangSan", "age", "12").then(() => {
console.log("setCustomData successfully");
appAccountManager.setCustomData('ZhangSan', 'age', '12').then(() => {
console.log('setCustomData successfully');
}).catch((err) => {
console.log("setCustomData failed, error: " + JSON.stringify(err));
console.log('setCustomData failed, error: ' + JSON.stringify(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;):
```js
try {
appAccountManager.getCustomData("ZhangSan", "age", (err, data) => {
appAccountManager.getCustomData('ZhangSan', 'age', (err, data) => {
if (err) {
console.log('getCustomData failed, error: ' + err);
} else {
console.log("getCustomData successfully, data: " + data);
console.log('getCustomData successfully, data: ' + data);
}
});
} 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;
```js
try {
appAccountManager.getCustomData("ZhangSan", "age").then((data) => {
console.log("getCustomData successfully, data: " + data);
appAccountManager.getCustomData('ZhangSan', 'age').then((data) => {
console.log('getCustomData successfully, data: ' + data);
}).catch((err) => {
console.log("getCustomData failed, error: " + JSON.stringify(err));
console.log('getCustomData failed, error: ' + JSON.stringify(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;
```js
try {
let value = appAccountManager.getCustomDataSync("ZhangSan", "age");
console.info("getCustomDataSync successfully, vaue:" + value);
let value = appAccountManager.getCustomDataSync('ZhangSan', 'age');
console.info('getCustomDataSync successfully, vaue: ' + value);
} 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
try {
appAccountManager.getAllAccounts((err, data) => {
if (err) {
console.debug("getAllAccounts failed, error:" + JSON.stringify(err));
console.debug('getAllAccounts failed, error: ' + JSON.stringify(err));
} else {
console.debug("getAllAccounts successfully");
console.debug('getAllAccounts successfully');
}
});
} 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;
```js
try {
appAccountManager.getAllAccounts().then((data) => {
console.debug("getAllAccounts successfully");
console.debug('getAllAccounts successfully');
}).catch((err) => {
console.debug("getAllAccounts failed, error:" + JSON.stringify(err));
console.debug('getAllAccounts failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2", (err, data) => {
appAccountManager.getAccountsByOwner('com.example.accountjsdemo2', (err, data) => {
if (err) {
console.debug("getAccountsByOwner failed, error:" + JSON.stringify(err));
console.debug('getAccountsByOwner failed, error:' + JSON.stringify(err));
} else {
console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data));
console.debug('getAccountsByOwner successfully, data:' + JSON.stringify(data));
}
});
} 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;
```js
try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2").then((data) => {
console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data));
appAccountManager.getAccountsByOwner('com.example.accountjsdemo2').then((data) => {
console.debug('getAccountsByOwner successfully, data: ' + JSON.stringify(data));
}).catch((err) => {
console.debug("getAccountsByOwner failed, error:" + JSON.stringify(err));
console.debug('getAccountsByOwner failed, error: ' + JSON.stringify(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
```js
function changeOnCallback(data){
console.log("receive change data:" + JSON.stringify(data));
console.log('receive change data:' + JSON.stringify(data));
}
try{
appAccountManager.on("accountChange", ["com.example.actsaccounttest"], changeOnCallback);
appAccountManager.on('accountChange', ['com.example.actsaccounttest'], changeOnCallback);
} 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
```js
function changeOnCallback(data) {
console.log("receive change data:" + JSON.stringify(data));
console.log('receive change data:' + JSON.stringify(data));
}
try{
appAccountManager.on("accountChange", ["com.example.actsaccounttest"], changeOnCallback);
appAccountManager.on('accountChange', ['com.example.actsaccounttest'], changeOnCallback);
} catch(err) {
console.error("on accountChange failed, error:" + JSON.stringify(err));
console.error('on accountChange failed, error:' + JSON.stringify(err));
}
try{
appAccountManager.off('accountChange', changeOnCallback);
}
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
function onResultCallback(code, authResult) {
console.log("resultCode: " + code);
console.log("authResult: " + JSON.stringify(authResult));
console.log('resultCode: ' + code);
console.log('authResult: ' + JSON.stringify(authResult));
}
function onRequestRedirectedCallback(request) {
......@@ -1366,19 +1366,19 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
console.log('startAbility successfully');
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
console.log('startAbility err: ' + JSON.stringify(err));
})
}
try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", {
appAccountManager.auth('LiSi', 'com.example.accountjsdemo', 'getSocialData', {
onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback
});
} 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
function onResultCallback(code, authResult) {
console.log("resultCode: " + code);
console.log("authResult: " + JSON.stringify(authResult));
console.log('resultCode: ' + code);
console.log('authResult: ' + JSON.stringify(authResult));
}
function onRequestRedirectedCallback(request) {
......@@ -1429,22 +1429,22 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
console.log('startAbility successfully');
}).catch((err) => {
console.log("startAbility err: " + JSON.stringify(err));
console.log('startAbility err: ' + JSON.stringify(err));
})
}
let options = {
"password": "xxxx",
'password': 'xxxx',
};
try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", options, {
appAccountManager.auth('LiSi', 'com.example.accountjsdemo', 'getSocialData', options, {
onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback
});
} 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
```js
try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, token) => {
appAccountManager.getAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', (err, token) => {
if (err) {
console.log("getAuthToken failed, error: " + JSON.stringify(err));
console.log('getAuthToken failed, error: ' + JSON.stringify(err));
} else {
console.log("getAuthToken successfully, token: " + token);
console.log('getAuthToken successfully, token: ' + token);
}
});
} 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
```js
try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((token) => {
console.log("getAuthToken successfully, token: " + token);
appAccountManager.getAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData').then((token) => {
console.log('getAuthToken successfully, token: ' + token);
}).catch((err) => {
console.log("getAuthToken failed, error: " + JSON.stringify(err));
console.log('getAuthToken failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx", (err) => {
appAccountManager.setAuthToken('LiSi', 'getSocialData', 'xxxx', (err) => {
if (err) {
console.log("setAuthToken failed, error: " + JSON.stringify(err));
console.log('setAuthToken failed, error: ' + JSON.stringify(err));
} else {
console.log("setAuthToken successfully");
console.log('setAuthToken successfully');
}
});
} catch (err) {
......@@ -1612,13 +1612,13 @@ setAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt;
```js
try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx").then(() => {
console.log("setAuthToken successfully");
appAccountManager.setAuthToken('LiSi', 'getSocialData', 'xxxx').then(() => {
console.log('setAuthToken successfully');
}).catch((err) => {
console.log("setAuthToken failed, error: " + JSON.stringify(err));
console.log('setAuthToken failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => {
appAccountManager.deleteAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx', (err) => {
if (err) {
console.log('deleteAuthToken failed, error: ' + JSON.stringify(err));
} else {
console.log("deleteAuthToken successfully");
console.log('deleteAuthToken successfully');
}
});
} catch (err) {
......@@ -1701,8 +1701,8 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P
```js
try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => {
console.log("deleteAuthToken successfully");
appAccountManager.deleteAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx').then(() => {
console.log('deleteAuthToken successfully');
}).catch((err) => {
console.log('deleteAuthToken failed, error: ' + JSON.stringify(err));
});
......@@ -1744,15 +1744,15 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis
```js
try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => {
appAccountManager.setAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true, (err) => {
if (err) {
console.log("setAuthTokenVisibility failed, error: " + JSON.stringify(err));
console.log('setAuthTokenVisibility failed, error: ' + JSON.stringify(err));
} else {
console.log("setAuthTokenVisibility successfully");
console.log('setAuthTokenVisibility successfully');
}
});
} 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
```js
try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => {
console.log("setAuthTokenVisibility successfully");
appAccountManager.setAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true).then(() => {
console.log('setAuthTokenVisibility successfully');
}).catch((err) => {
console.log("setAuthTokenVisibility failed, error: " + JSON.stringify(err));
console.log('setAuthTokenVisibility failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, isVisible) => {
appAccountManager.checkAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', (err, isVisible) => {
if (err) {
console.log("checkAuthTokenVisibility failed, error: " + JSON.stringify(err));
console.log('checkAuthTokenVisibility failed, error: ' + JSON.stringify(err));
} else {
console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible);
console.log('checkAuthTokenVisibility successfully, isVisible: ' + isVisible);
}
});
} 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
```js
try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((isVisible) => {
console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible);
appAccountManager.checkAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo').then((isVisible) => {
console.log('checkAuthTokenVisibility successfully, isVisible: ' + isVisible);
}).catch((err) => {
console.log("checkAuthTokenVisibility failed, error: " + JSON.stringify(err));
console.log('checkAuthTokenVisibility failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo", (err, tokenArr) => {
appAccountManager.getAllAuthTokens('LiSi', 'com.example.accountjsdemo', (err, tokenArr) => {
if (err) {
console.log("getAllAuthTokens failed, error: " + JSON.stringify(err));
console.log('getAllAuthTokens failed, error: ' + JSON.stringify(err));
} else {
console.log('getAllAuthTokens successfully, tokenArr: ' + tokenArr);
}
});
} 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
```js
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));
}).catch((err) => {
console.log("getAllAuthTokens failed, error: " + JSON.stringify(err));
console.log('getAllAuthTokens failed, error: ' + JSON.stringify(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;
```js
try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData", (err, authList) => {
appAccountManager.getAuthList('LiSi', 'getSocialData', (err, authList) => {
if (err) {
console.log("getAuthList failed, error: " + JSON.stringify(err));
console.log('getAuthList failed, error: ' + JSON.stringify(err));
} else {
console.log("getAuthList successfully, authList: " + authList);
console.log('getAuthList successfully, authList: ' + authList);
}
});
} catch (err) {
......@@ -2049,13 +2049,13 @@ getAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
```js
try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData").then((authList) => {
console.log("getAuthList successfully, authList: " + authList);
appAccountManager.getAuthList('LiSi', 'getSocialData').then((authList) => {
console.log('getAuthList successfully, authList: ' + authList);
}).catch((err) => {
console.log("getAuthList failed, error: " + JSON.stringify(err));
console.log('getAuthList failed, error: ' + JSON.stringify(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;):
try {
appAccountManager.getAuthCallback(sessionId, (err, callback) => {
if (err != null) {
console.log("getAuthCallback err: " + JSON.stringify(err));
console.log('getAuthCallback err: ' + JSON.stringify(err));
return;
}
var result = {
accountInfo: {
name: "Lisi",
owner: "com.example.accountjsdemo",
name: 'Lisi',
owner: 'com.example.accountjsdemo',
},
tokenInfo: {
token: "xxxxxx",
authType: "getSocialData"
token: 'xxxxxx',
authType: 'getSocialData'
}
};
callback.onResult(0, result);
});
} 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;
appAccountManager.getAuthCallback(sessionId).then((callback) => {
var result = {
accountInfo: {
name: "Lisi",
owner: "com.example.accountjsdemo",
name: 'Lisi',
owner: 'com.example.accountjsdemo',
},
tokenInfo: {
token: "xxxxxx",
authType: "getSocialData"
token: 'xxxxxx',
authType: 'getSocialData'
}
};
callback.onResult(0, result);
}).catch((err) => {
console.log("getAuthCallback err: " + JSON.stringify(err));
console.log('getAuthCallback err: ' + JSON.stringify(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
```js
try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo", (err, info) => {
appAccountManager.queryAuthenticatorInfo('com.example.accountjsdemo', (err, info) => {
if (err) {
console.log("queryAuthenticatorInfo failed, error: " + JSON.stringify(err));
console.log('queryAuthenticatorInfo failed, error: ' + JSON.stringify(err));
} else {
console.log('queryAuthenticatorInfo successfully, info: ' + JSON.stringify(info));
}
});
} 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;
```js
try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo").then((info) => {
console.log("queryAuthenticatorInfo successfully, info: " + JSON.stringify(info));
appAccountManager.queryAuthenticatorInfo('com.example.accountjsdemo').then((info) => {
console.log('queryAuthenticatorInfo successfully, info: ' + JSON.stringify(info));
}).catch((err) => {
console.log("queryAuthenticatorInfo failed, error: " + JSON.stringify(err));
console.log('queryAuthenticatorInfo failed, error: ' + JSON.stringify(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
**示例:**
```js
let labels = ["student"];
let labels = ['student'];
try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels, (err, hasAllLabels) => {
appAccountManager.checkAccountLabels('zhangsan', 'com.example.accountjsdemo', labels, (err, hasAllLabels) => {
if (err) {
console.log("checkAccountLabels failed, error: " + JSON.stringify(err));
console.log('checkAccountLabels failed, error: ' + JSON.stringify(err));
} else {
console.log("checkAccountLabels successfully, hasAllLabels: " + hasAllLabels);
console.log('checkAccountLabels successfully, hasAllLabels: ' + hasAllLabels);
}
});
} 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
**示例:**
```js
let labels = ["student"];
let labels = ['student'];
try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels).then((hasAllLabels) => {
appAccountManager.checkAccountLabels('zhangsan', 'com.example.accountjsdemo', labels).then((hasAllLabels) => {
console.log('checkAccountLabels successfully: ' + hasAllLabels);
}).catch((err) => {
console.log("checkAccountLabels failed, error: " + JSON.stringify(err));
console.log('checkAccountLabels failed, error: ' + JSON.stringify(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
```js
try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX", (err) => {
appAccountManager.deleteCredential('zhangsan', 'PIN_SIX', (err) => {
if (err) {
console.log("deleteCredential failed, error: " + JSON.stringify(err));
console.log('deleteCredential failed, error: ' + JSON.stringify(err));
} else {
console.log("deleteCredential successfully");
console.log('deleteCredential successfully');
}
});
} 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;
```js
try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX").then(() => {
console.log("deleteCredential successfully");
appAccountManager.deleteCredential('zhangsan', 'PIN_SIX').then(() => {
console.log('deleteCredential successfully');
}).catch((err) => {
console.log("deleteCredential failed, error: " + JSON.stringify(err));
console.log('deleteCredential failed, error: ' + JSON.stringify(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&
```js
let options = {
allowedOwners: [ "com.example.accountjsdemo" ],
requiredLabels: [ "student" ]
allowedOwners: [ 'com.example.accountjsdemo' ],
requiredLabels: [ 'student' ]
};
try {
appAccountManager.selectAccountsByOptions(options, (err, accountArr) => {
if (err) {
console.log("selectAccountsByOptions failed, error: " + JSON.stringify(err));
console.log('selectAccountsByOptions failed, error: ' + JSON.stringify(err));
} else {
console.log("selectAccountsByOptions successfully, accountArr: " + JSON.stringify(accountArr));
console.log('selectAccountsByOptions successfully, accountArr: ' + JSON.stringify(accountArr));
}
});
} 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
```js
let options = {
allowedOwners: ["com.example.accountjsdemo"]
allowedOwners: ['com.example.accountjsdemo']
};
try {
appAccountManager.selectAccountsByOptions(options).then((accountArr) => {
console.log("selectAccountsByOptions successfully, accountArr: " + JSON.stringify(accountArr));
console.log('selectAccountsByOptions successfully, accountArr: ' + JSON.stringify(accountArr));
}).catch((err) => {
console.log("selectAccountsByOptions failed, error: " + JSON.stringify(err));
console.log('selectAccountsByOptions failed, error: ' + JSON.stringify(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;
```js
try {
appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", {
appAccountManager.verifyCredential('zhangsan', 'com.example.accountjsdemo', {
onResult: (resultCode, result) => {
console.log("verifyCredential onResult, resultCode:" + JSON.stringify(resultCode));
console.log("verifyCredential onResult, result:" + JSON.stringify(result));
console.log('verifyCredential onResult, resultCode: ' + JSON.stringify(resultCode));
console.log('verifyCredential onResult, result: ' + JSON.stringify(result));
},
onRequestRedirected: (request) => {
console.log("verifyCredential onRequestRedirected, request:" + JSON.stringify(request));
console.log('verifyCredential onRequestRedirected, request: ' + JSON.stringify(request));
}
});
} 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,
```js
let options = {
credentialType: "pin",
credential: "123456"
credentialType: 'pin',
credential: '123456'
};
try {
appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", options, {
appAccountManager.verifyCredential('zhangsan', 'com.example.accountjsdemo', options, {
onResult: (resultCode, result) => {
console.log("verifyCredential onResult, resultCode:" + JSON.stringify(resultCode));
console.log("verifyCredential onResult, result:" + JSON.stringify(result));
console.log('verifyCredential onResult, resultCode: ' + JSON.stringify(resultCode));
console.log('verifyCredential onResult, result: ' + JSON.stringify(result));
},
onRequestRedirected: (request) => {
console.log("verifyCredential onRequestRedirected, request:" + JSON.stringify(request));
console.log('verifyCredential onRequestRedirected, request: ' + JSON.stringify(request));
}
});
} 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;
```js
try {
appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", {
appAccountManager.setAuthenticatorProperties('com.example.accountjsdemo', {
onResult: (resultCode, result) => {
console.log("setAuthenticatorProperties onResult, resultCode:" + JSON.stringify(resultCode));
console.log("setAuthenticatorProperties onResult, result:" + JSON.stringify(result));
console.log('setAuthenticatorProperties onResult, resultCode: ' + JSON.stringify(resultCode));
console.log('setAuthenticatorProperties onResult, result: ' + JSON.stringify(result));
},
onRequestRedirected: (request) => {
console.log("setAuthenticatorProperties onRequestRedirected, request:" + JSON.stringify(request));
console.log('setAuthenticatorProperties onRequestRedirected, request: ' + JSON.stringify(request));
}
});
} 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
```js
let options = {
properties: {"prop1": "value1"}
properties: {'prop1': 'value1'}
};
try {
appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", options, {
appAccountManager.setAuthenticatorProperties('com.example.accountjsdemo', options, {
onResult: (resultCode, result) => {
console.log("setAuthenticatorProperties onResult, resultCode:" + JSON.stringify(resultCode));
console.log("setAuthenticatorProperties onResult, result:" + JSON.stringify(result));
console.log('setAuthenticatorProperties onResult, resultCode: ' + JSON.stringify(resultCode));
console.log('setAuthenticatorProperties onResult, result: ' + JSON.stringify(result));
},
onRequestRedirected: (request) => {
console.log("setAuthenticatorProperties onRequestRedirected, request:" + JSON.stringify(request));
console.log('setAuthenticatorProperties onRequestRedirected, request: ' + JSON.stringify(request));
}
});
} 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
**示例:**
```js
appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
appAccountManager.addAccount('WangWu', (err) => {
console.log('addAccount err: ' + JSON.stringify(err));
});
```
......@@ -2759,8 +2759,8 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
**示例:**
```js
appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
appAccountManager.addAccount('LiSi', 'token101', (err) => {
console.log('addAccount err: ' + JSON.stringify(err));
});
```
......@@ -2791,10 +2791,10 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
**示例:**
```js
appAccountManager.addAccount("LiSi", "token101").then(()=> {
appAccountManager.addAccount('LiSi', 'token101').then(()=> {
console.log('addAccount Success');
}).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
function onResultCallback(code, result) {
console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result));
console.log('resultCode: ' + code);
console.log('result: ' + JSON.stringify(result));
}
function onRequestRedirectedCallback(request) {
......@@ -2837,13 +2837,13 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
console.log('startAbility successfully');
}).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,
onRequestRedirected: onRequestRedirectedCallback
});
......@@ -2871,8 +2871,8 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```js
appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err));
appAccountManager.deleteAccount('ZhaoLiu', (err) => {
console.log('deleteAccount err: ' + JSON.stringify(err));
});
```
......@@ -2903,10 +2903,10 @@ deleteAccount(name: string): Promise&lt;void&gt;
**示例:**
```js
appAccountManager.deleteAccount("ZhaoLiu").then(() => {
appAccountManager.deleteAccount('ZhaoLiu').then(() => {
console.log('deleteAccount Success');
}).catch((err) => {
console.log("deleteAccount err: " + JSON.stringify(err));
console.log('deleteAccount err: ' + JSON.stringify(err));
});
```
### disableAppAccess<sup>(deprecated)</sup>
......@@ -2932,8 +2932,8 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
**示例:**
```js
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err));
appAccountManager.disableAppAccess('ZhangSan', 'com.example.accountjsdemo', (err) => {
console.log('disableAppAccess err: ' + JSON.stringify(err));
});
```
......@@ -2965,10 +2965,10 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:**
```js
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => {
appAccountManager.disableAppAccess('ZhangSan', 'com.example.accountjsdemo').then(() => {
console.log('disableAppAccess Success');
}).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
**示例:**
```js
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err));
appAccountManager.enableAppAccess('ZhangSan', 'com.example.accountjsdemo', (err) => {
console.log('enableAppAccess: ' + JSON.stringify(err));
});
```
......@@ -3028,10 +3028,10 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
**示例:**
```js
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => {
appAccountManager.enableAppAccess('ZhangSan', 'com.example.accountjsdemo').then(() => {
console.log('enableAppAccess Success');
}).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;):
**示例:**
```js
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
appAccountManager.checkAppAccountSyncEnable('ZhangSan', (err, result) => {
console.log('checkAppAccountSyncEnable err: ' + JSON.stringify(err));
console.log('checkAppAccountSyncEnable result: ' + result);
});
```
......@@ -3094,10 +3094,10 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
**示例:**
```js
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
appAccountManager.checkAppAccountSyncEnable('ZhangSan').then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data);
}).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
**示例:**
```js
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err));
appAccountManager.setAccountCredential('ZhangSan', 'credentialType001', 'credential001', (err) => {
console.log('setAccountCredential err: ' + JSON.stringify(err));
});
```
......@@ -3159,10 +3159,10 @@ setAccountCredential(name: string, credentialType: string, credential: string):
**示例:**
```js
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
appAccountManager.setAccountCredential('ZhangSan', 'credentialType001', 'credential001').then(() => {
console.log('setAccountCredential Success');
}).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;
**示例:**
```js
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err));
appAccountManager.setAccountExtraInfo('ZhangSan', 'Tk002', (err) => {
console.log('setAccountExtraInfo err: ' + JSON.stringify(err));
});
```
......@@ -3224,10 +3224,10 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
**示例:**
```js
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
appAccountManager.setAccountExtraInfo('ZhangSan', 'Tk002').then(() => {
console.log('setAccountExtraInfo Success');
}).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
**示例:**
```js
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
appAccountManager.setAppAccountSyncEnable('ZhangSan', true, (err) => {
console.log('setAppAccountSyncEnable err: ' + JSON.stringify(err));
});
```
......@@ -3291,10 +3291,10 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
**示例:**
```js
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
appAccountManager .setAppAccountSyncEnable('ZhangSan', true).then(() => {
console.log('setAppAccountSyncEnable Success');
}).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
**示例:**
```js
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err));
appAccountManager.setAssociatedData('ZhangSan', 'k001', 'v001', (err) => {
console.log('setAssociatedData err: ' + JSON.stringify(err));
});
```
......@@ -3358,10 +3358,10 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
**示例:**
```js
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
appAccountManager.setAssociatedData('ZhangSan', 'k001', 'v001').then(() => {
console.log('setAssociatedData Success');
}).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;&
```js
appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
console.debug("getAllAccessibleAccounts data:" + JSON.stringify(data));
console.debug('getAllAccessibleAccounts err: ' + JSON.stringify(err));
console.debug('getAllAccessibleAccounts data: ' + JSON.stringify(data));
});
```
......@@ -3420,7 +3420,7 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data);
}).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
**示例:**
```js
const selfBundle = "com.example.actsgetallaaccounts";
const selfBundle = 'com.example.actsgetallaaccounts';
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
console.debug("getAllAccounts err:" + JSON.stringify(err));
console.debug("getAllAccounts data:" + JSON.stringify(data));
console.debug('getAllAccounts err: ' + JSON.stringify(err));
console.debug('getAllAccounts data:' + JSON.stringify(data));
});
```
......@@ -3484,11 +3484,11 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
**示例:**
```js
const selfBundle = "com.example.actsgetallaaccounts";
const selfBundle = 'com.example.actsgetallaaccounts';
appAccountManager.getAllAccounts(selfBundle).then((data) => {
console.log('getAllAccounts: ' + data);
}).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
**示例:**
```js
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err));
appAccountManager.getAccountCredential('ZhangSan', 'credentialType001', (err, result) => {
console.log('getAccountCredential err: ' + JSON.stringify(err));
console.log('getAccountCredential result: ' + result);
});
```
......@@ -3549,10 +3549,10 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
**示例:**
```js
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
appAccountManager.getAccountCredential('ZhangSan', 'credentialType001').then((data) => {
console.log('getAccountCredential, result: ' + data);
}).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
**示例:**
```js
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err));
appAccountManager.getAccountExtraInfo('ZhangSan', (err, result) => {
console.log('getAccountExtraInfo err: ' + JSON.stringify(err));
console.log('getAccountExtraInfo result: ' + result);
});
```
......@@ -3611,10 +3611,10 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;
**示例:**
```js
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
appAccountManager.getAccountExtraInfo('ZhangSan').then((data) => {
console.log('getAccountExtraInfo, result: ' + data);
}).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
**示例:**
```js
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err));
appAccountManager.getAssociatedData('ZhangSan', 'k001', (err, result) => {
console.log('getAssociatedData err: ' + JSON.stringify(err));
console.log('getAssociatedData result: ' + result);
});
```
......@@ -3675,10 +3675,10 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;
**示例:**
```js
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
appAccountManager.getAssociatedData('ZhangSan', 'k001').then((data) => {
console.log('getAssociatedData: ' + data);
}).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
```js
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
console.debug('receive change data:' + JSON.stringify(data));
}
try{
appAccountManager.on('change', ["com.example.actsaccounttest"], changeOnCallback);
appAccountManager.on('change', ['com.example.actsaccounttest'], changeOnCallback);
}
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
```js
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
console.debug('receive change data: ' + JSON.stringify(data));
appAccountManager.off('change', function(){
console.debug("off finish");
console.debug('off finish');
})
}
try{
appAccountManager.on('change', ["com.example.actsaccounttest"], changeOnCallback);
appAccountManager.on('change', ['com.example.actsaccounttest'], changeOnCallback);
}
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
```js
function onResultCallback(code, result) {
console.log("resultCode: " + code);
console.log("result: " + JSON.stringify(result));
console.log('resultCode: ' + code);
console.log('result: ' + JSON.stringify(result));
}
function onRequestRedirectedCallback(request) {
......@@ -3790,13 +3790,13 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
entities: ['entity.system.default'],
}
this.context.startAbility(wantInfo).then(() => {
console.log("startAbility successfully");
console.log('startAbility successfully');
}).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,
onRequestRedirected: onRequestRedirectedCallback
});
......@@ -3826,7 +3826,7 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
**示例:**
```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 token: ' + data);
});
......@@ -3861,10 +3861,10 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
**示例:**
```js
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((data) => {
appAccountManager.getOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData').then((data) => {
console.log('getOAuthToken token: ' + data);
}).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
**示例:**
```js
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx", (err) => {
appAccountManager.setOAuthToken('LiSi', 'getSocialData', 'xxxx', (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err));
});
```
......@@ -3926,7 +3926,7 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
**示例:**
```js
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx").then(() => {
appAccountManager.setOAuthToken('LiSi', 'getSocialData', 'xxxx').then(() => {
console.log('setOAuthToken successfully');
}).catch((err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err));
......@@ -3958,7 +3958,7 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
**示例:**
```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));
});
```
......@@ -3993,10 +3993,10 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
**示例:**
```js
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => {
appAccountManager.deleteOAuthToken('LiSi', 'com.example.accountjsdemo', 'getSocialData', 'xxxxx').then(() => {
console.log('deleteOAuthToken successfully');
}).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
**示例:**
```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));
});
```
......@@ -4060,7 +4060,7 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
**示例:**
```js
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => {
appAccountManager.setOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo', true).then(() => {
console.log('setOAuthTokenVisibility successfully');
}).catch((err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
......@@ -4091,7 +4091,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
**示例:**
```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 isVisible: ' + data);
});
......@@ -4126,7 +4126,7 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
**示例:**
```js
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((data) => {
appAccountManager.checkOAuthTokenVisibility('LiSi', 'getSocialData', 'com.example.accountjsdemo').then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data);
}).catch((err) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
......@@ -4156,8 +4156,8 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
**示例:**
```js
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err));
appAccountManager.getAllOAuthTokens('LiSi', 'com.example.accountjsdemo', (err, data) => {
console.log('getAllOAuthTokens err: ' + JSON.stringify(err));
console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
});
```
......@@ -4190,10 +4190,10 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
**示例:**
```js
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo").then((data) => {
appAccountManager.getAllOAuthTokens('LiSi', 'com.example.accountjsdemo').then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
}).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
**示例:**
```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 data: ' + JSON.stringify(data));
});
......@@ -4254,10 +4254,10 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
**示例:**
```js
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData").then((data) => {
appAccountManager.getOAuthList('LiSi', 'getSocialData').then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data));
}).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
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
if (err.code != account_appAccount.ResultCode.SUCCESS) {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
console.log('getAuthenticatorCallback err: ' + JSON.stringify(err));
return;
}
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi",
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo",
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData",
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
var result = {[account_appAccount.Constants.KEY_NAME]: 'LiSi',
[account_appAccount.Constants.KEY_OWNER]: 'com.example.accountjsdemo',
[account_appAccount.Constants.KEY_AUTH_TYPE]: 'getSocialData',
[account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
});
}
......@@ -4336,13 +4336,13 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
onCreate(want, param) {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi",
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo",
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData",
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
var result = {[account_appAccount.Constants.KEY_NAME]: 'LiSi',
[account_appAccount.Constants.KEY_OWNER]: 'com.example.accountjsdemo',
[account_appAccount.Constants.KEY_AUTH_TYPE]: 'getSocialData',
[account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).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
**示例:**
```js
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
appAccountManager.getAuthenticatorInfo('com.example.accountjsdemo', (err, data) => {
console.log('getAuthenticatorInfo err: ' + JSON.stringify(err));
console.log('getAuthenticatorInfo data: ' + JSON.stringify(data));
});
```
......@@ -4403,10 +4403,10 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
**示例:**
```js
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo").then((data) => {
appAccountManager.getAuthenticatorInfo('com.example.accountjsdemo').then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
}).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;
| 名称 | 值 | 说明 |
| -------------------------------- | ---------------------- | ----------------------- |
| ACTION_ADD_ACCOUNT_IMPLICITLY<sup>(deprecated)</sup> | "addAccountImplicitly" | 表示操作,隐式添加帐号。 |
| ACTION_AUTHENTICATE<sup>(deprecated)</sup> | "authenticate" | 表示操作,鉴权。 |
| ACTION_CREATE_ACCOUNT_IMPLICITLY<sup>9+</sup> | "createAccountImplicitly" | 表示操作,隐式创建帐号。 |
| ACTION_AUTH<sup>9+</sup> | "auth" | 表示操作,鉴权。 |
| ACTION_VERIFY_CREDENTIAL<sup>9+</sup> | "verifyCredential" | 表示操作,验证凭据。 |
| ACTION_SET_AUTHENTICATOR_PROPERTIES<sup>9+</sup> | "setAuthenticatorProperties" | 表示操作,设置认证器属性。 |
| KEY_NAME | "name" | 表示键名,应用帐号的名称。 |
| KEY_OWNER | "owner" | 表示键名,应用帐号所有者。|
| KEY_TOKEN | "token" | 表示键名,令牌。 |
| KEY_ACTION | "action" | 表示键名,操作。 |
| KEY_AUTH_TYPE | "authType" | 表示键名,鉴权类型。 |
| KEY_SESSION_ID | "sessionId" | 表示键名,会话标识。 |
| KEY_CALLER_PID | "callerPid" | 表示键名,调用方PID。 |
| KEY_CALLER_UID | "callerUid" | 表示键名,调用方UID。 |
| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | 表示键名,调用方包名。 |
| KEY_REQUIRED_LABELS<sup>9+</sup> | "requiredLabels" | 表示键名,必需的标签。 |
| KEY_BOOLEAN_RESULT<sup>9+</sup> | "booleanResult" | 表示键名,布尔返回值。 |
| ACTION_ADD_ACCOUNT_IMPLICITLY<sup>(deprecated)</sup> | 'addAccountImplicitly' | 表示操作,隐式添加帐号。 |
| ACTION_AUTHENTICATE<sup>(deprecated)</sup> | 'authenticate' | 表示操作,鉴权。 |
| ACTION_CREATE_ACCOUNT_IMPLICITLY<sup>9+</sup> | 'createAccountImplicitly' | 表示操作,隐式创建帐号。 |
| ACTION_AUTH<sup>9+</sup> | 'auth' | 表示操作,鉴权。 |
| ACTION_VERIFY_CREDENTIAL<sup>9+</sup> | 'verifyCredential' | 表示操作,验证凭据。 |
| ACTION_SET_AUTHENTICATOR_PROPERTIES<sup>9+</sup> | 'setAuthenticatorProperties' | 表示操作,设置认证器属性。 |
| KEY_NAME | 'name' | 表示键名,应用帐号的名称。 |
| KEY_OWNER | 'owner' | 表示键名,应用帐号所有者。|
| KEY_TOKEN | 'token' | 表示键名,令牌。 |
| KEY_ACTION | 'action' | 表示键名,操作。 |
| KEY_AUTH_TYPE | 'authType' | 表示键名,鉴权类型。 |
| KEY_SESSION_ID | 'sessionId' | 表示键名,会话标识。 |
| KEY_CALLER_PID | 'callerPid' | 表示键名,调用方PID。 |
| KEY_CALLER_UID | 'callerUid' | 表示键名,调用方UID。 |
| KEY_CALLER_BUNDLE_NAME | 'callerBundleName' | 表示键名,调用方包名。 |
| KEY_REQUIRED_LABELS<sup>9+</sup> | 'requiredLabels' | 表示键名,必需的标签。 |
| KEY_BOOLEAN_RESULT<sup>9+</sup> | 'booleanResult' | 表示键名,布尔返回值。 |
## ResultCode<sup>(deprecated)</sup>
......@@ -4609,21 +4609,21 @@ onResult: (code: number, result?: AuthResult) =&gt; void
```js
let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234";
var sessionId = '1234';
appAccountManager.getAuthCallback(sessionId).then((callback) => {
var result = {
accountInfo: {
name: "Lisi",
owner: "com.example.accountjsdemo",
name: 'Lisi',
owner: 'com.example.accountjsdemo',
},
tokenInfo: {
token: "xxxxxx",
authType: "getSocialData"
token: 'xxxxxx',
authType: 'getSocialData'
}
};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).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
class MyAuthenticator extends account_appAccount.Authenticator {
createAccountImplicitly(options, callback) {
callback.onRequestRedirected({
bundleName: "com.example.accountjsdemo",
abilityName: "com.example.accountjsdemo.LoginAbility",
bundleName: 'com.example.accountjsdemo',
abilityName: 'com.example.accountjsdemo.LoginAbility',
});
}
auth(name, authType, options, callback) {
var result = {
accountInfo: {
name: "Lisi",
owner: "com.example.accountjsdemo",
name: 'Lisi',
owner: 'com.example.accountjsdemo',
},
tokenInfo: {
token: "xxxxxx",
authType: "getSocialData"
token: 'xxxxxx',
authType: 'getSocialData'
}
};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
......@@ -4680,11 +4680,11 @@ onRequestContinued?: () =&gt; void
```js
let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234";
var sessionId = '1234';
appAccountManager.getAuthCallback(sessionId).then((callback) => {
callback.onRequestContinued();
}).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
```js
let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234";
var sessionId = '1234';
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi",
[account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo",
[account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData",
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
var result = {[account_appAccount.Constants.KEY_NAME]: 'LiSi',
[account_appAccount.Constants.KEY_OWNER]: 'com.example.accountjsdemo',
[account_appAccount.Constants.KEY_AUTH_TYPE]: 'getSocialData',
[account_appAccount.Constants.KEY_TOKEN]: 'xxxxxx'};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}).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
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({
bundleName: "com.example.accountjsdemo",
abilityName: "com.example.accountjsdemo.LoginAbility",
bundleName: 'com.example.accountjsdemo',
abilityName: 'com.example.accountjsdemo.LoginAbility',
});
}
authenticate(name, authType, callerBundleName, options, callback) {
var result = {[account_appAccount.Constants.KEY_NAME]: name,
[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);
}
}
......@@ -4773,11 +4773,11 @@ onRequestContinued?: () =&gt; void
```js
let appAccountManager = account_appAccount.createAppAccountManager();
var sessionId = "1234";
var sessionId = '1234';
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
callback.onRequestContinued();
}).catch((err) => {
console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
console.log('getAuthenticatorCallback err: ' + JSON.stringify(err));
});
```
......@@ -4937,22 +4937,22 @@ getRemoteObject(): rpc.RemoteObject;
class MyAuthenticator extends account_appAccount.Authenticator {
addAccountImplicitly(authType, callerBundleName, options, callback) {
callback.onRequestRedirected({
bundleName: "com.example.accountjsdemo",
abilityName: "com.example.accountjsdemo.LoginAbility",
bundleName: 'com.example.accountjsdemo',
abilityName: 'com.example.accountjsdemo.LoginAbility',
});
}
authenticate(name, authType, callerBundleName, options, callback) {
var result = {[account_appAccount.Constants.KEY_NAME]: name,
[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);
}
verifyCredential(name, options, callback) {
callback.onRequestRedirected({
bundleName: "com.example.accountjsdemo",
abilityName: "com.example.accountjsdemo.VerifyAbility",
bundleName: 'com.example.accountjsdemo',
abilityName: 'com.example.accountjsdemo.VerifyAbility',
parameters: {
name: name
}
......
......@@ -86,7 +86,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
if (err) {
console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
} else {
console.log("activateOsAccount successfully");
console.log('activateOsAccount successfully');
}
});
} catch (err) {
......@@ -139,7 +139,7 @@ activateOsAccount(localId: number): Promise&lt;void&gt;
console.log('activateOsAccount failed, err:' + JSON.stringify(err));
});
} 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
if (err) {
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
} else {
console.log("checkMultiOsAccountEnabled successfully, isEnabled: " + isEnabled);
console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled);
}
});
} catch (err) {
......@@ -254,7 +254,7 @@ checkOsAccountActivated(localId: number, callback: AsyncCallback&lt;boolean&gt;)
}
});
} catch (err) {
console.log('checkOsAccountActivated exception:' + JSON.stringify(err));
console.log('checkOsAccountActivated exception: ' + JSON.stringify(err));
}
```
......@@ -297,10 +297,10 @@ checkOsAccountActivated(localId: number): Promise&lt;boolean&gt;
accountManager.checkOsAccountActivated(localId).then((isActivated) => {
console.log('checkOsAccountActivated successfully, isActivated: ' + isActivated);
}).catch((err) => {
console.log('checkOsAccountActivated failed, error: ' + JSON.stringify(err));
console.log('checkOsAccountActivated failed, error: ' + JSON.stringify(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
```js
let accountManager = account_osAccount.getAccountManager();
let localId = 100;
let constraint = "constraint.wifi";
let constraint = 'constraint.wifi';
try {
accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err, isEnabled)=>{
if (err) {
console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err));
console.log('checkOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
} else {
console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled);
console.log('checkOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
}
});
} 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
```js
let accountManager = account_osAccount.getAccountManager();
let localId = 100;
let constraint = "constraint.wifi";
let constraint = 'constraint.wifi';
try {
accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled) => {
console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled);
console.log('checkOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
}).catch((err) => {
console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err));
console.log('checkOsAccountConstraintEnabled failed, error: ' + JSON.stringify(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
try {
accountManager.checkOsAccountTestable((err, isTestable) => {
if (err) {
console.log("checkOsAccountTestable failed, error: " + JSON.stringify(err));
console.log('checkOsAccountTestable failed, error: ' + JSON.stringify(err));
} else {
console.log("checkOsAccountTestable successfully, isTestable: " + isTestable);
console.log('checkOsAccountTestable successfully, isTestable: ' + isTestable);
}
});
} 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;
let accountManager = account_osAccount.getAccountManager();
try {
accountManager.checkOsAccountTestable().then((isTestable) => {
console.log("checkOsAccountTestable successfully, isTestable: " + isTestable);
console.log('checkOsAccountTestable successfully, isTestable: ' + isTestable);
}).catch((err) => {
console.log("checkOsAccountTestable failed, error: " + JSON.stringify(err));
console.log('checkOsAccountTestable failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('checkOsAccountTestable exception: ' + JSON.stringify(err));
......@@ -496,13 +496,13 @@ checkOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
try {
accountManager.checkOsAccountVerified((err, isVerified) => {
if (err) {
console.log("checkOsAccountVerified failed, error: " + JSON.stringify(err));
console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
} else {
console.log("checkOsAccountVerified successfully, isVerified: " + isVerified);
console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
}
});
} 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;):
try {
accountManager.checkOsAccountVerified(localId, (err, isVerified) => {
if (err) {
console.log("checkOsAccountVerified failed, error: " + JSON.stringify(err));
console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
} else {
console.log("checkOsAccountVerified successfully, isVerified: " + isVerified);
console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
}
});
} catch (err) {
console.log("checkOsAccountVerified exception: " + err);
console.log('checkOsAccountVerified exception: ' + err);
}
```
......@@ -586,9 +586,9 @@ checkOsAccountVerified(localId: number): Promise&lt;boolean&gt;
let localId = 100;
try {
accountManager.checkOsAccountVerified(localId).then((isVerified) => {
console.log("checkOsAccountVerified successfully, isVerified: " + isVerified);
console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
}).catch((err) => {
console.log("checkOsAccountVerified failed, error: " + JSON.stringify(err));
console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('checkOsAccountVerified exception: ' + JSON.stringify(err));
......@@ -627,19 +627,19 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
```js
let accountManager = account_osAccount.getAccountManager();
let accountName = "testAccountName";
let accountName = 'testAccountName';
try {
accountManager.createOsAccount(accountName, account_osAccount.OsAccountType.NORMAL, (err, osAccountInfo) => {
accountManager.removeOsAccount(osAccountInfo.localId, (err)=>{
if (err) {
console.log("removeOsAccount failed, error: " + JSON.stringify(err));
console.log('removeOsAccount failed, error: ' + JSON.stringify(err));
} else {
console.log("removeOsAccount successfully");
console.log('removeOsAccount successfully');
}
});
});
} 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;
```js
let accountManager = account_osAccount.getAccountManager();
let accountName = "testAccountName";
let accountName = 'testAccountName';
try {
accountManager.createOsAccount(accountName, account_osAccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
accountManager.removeOsAccount(osAccountInfo.localId).then(() => {
console.log("removeOsAccount successfully");
console.log('removeOsAccount successfully');
}).catch((err) => {
console.log("removeOsAccount failed, error: " + JSON.stringify(err));
console.log('removeOsAccount failed, error: ' + JSON.stringify(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
```js
let accountManager = account_osAccount.getAccountManager();
let localId = 100;
let constraint = "constraint.wifi";
let constraint = 'constraint.wifi';
try {
accountManager.setOsAccountConstraints(localId, [constraint], true, (err) => {
if (err) {
console.log("setOsAccountConstraints failed, error:" + JSON.stringify(err));
console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err));
} else {
console.log("setOsAccountConstraints successfully");
console.log('setOsAccountConstraints successfully');
}
});
} catch (err) {
console.log("setOsAccountConstraints exception: " + JSON.stringify(err));
console.log('setOsAccountConstraints exception: ' + JSON.stringify(err));
}
```
......@@ -787,10 +787,10 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
accountManager.setOsAccountConstraints(localId, ['constraint.location.set'], false).then(() => {
console.log('setOsAccountConstraints succsuccessfully');
}).catch((err) => {
console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err));
console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(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;
```js
let accountManager = account_osAccount.getAccountManager();
let localId = 100;
let name = "demoName";
let name = 'demoName';
try {
accountManager.setOsAccountName(localId, name, (err) => {
if (err) {
console.log("setOsAccountName failed, error: " + JSON.stringify(err));
console.log('setOsAccountName failed, error: ' + JSON.stringify(err));
} else {
console.log("setOsAccountName successfully");
console.log('setOsAccountName successfully');
}
});
} catch (err) {
console.log('setOsAccountName exception:' + JSON.stringify(err));
console.log('setOsAccountName exception: ' + JSON.stringify(err));
}
```
......@@ -886,10 +886,10 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
accountManager.setOsAccountName(localId, name).then(() => {
console.log('setOsAccountName successfully');
}).catch((err) => {
console.log('setOsAccountName failed, error: ' + JSON.stringify(err));
console.log('setOsAccountName failed, error: ' + JSON.stringify(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
try {
accountManager.getOsAccountCount((err, count) => {
if (err) {
console.log("getOsAccountCount failed, error: " + JSON.stringify(err));
console.log('getOsAccountCount failed, error: ' + JSON.stringify(err));
} else {
console.log("getOsAccountCount successfully, count: " + count);
console.log('getOsAccountCount successfully, count: ' + count);
}
});
} 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;
let accountManager = account_osAccount.getAccountManager();
try {
accountManager.getOsAccountCount().then((count) => {
console.log("getOsAccountCount successfully, count: " + count);
console.log('getOsAccountCount successfully, count: ' + count);
}).catch((err) => {
console.log("getOsAccountCount failed, error: " + JSON.stringify(err));
console.log('getOsAccountCount failed, error: ' + JSON.stringify(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
try {
accountManager.getOsAccountLocalId((err, localId) => {
if (err) {
console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalId failed, error: ' + JSON.stringify(err));
} else {
console.log("getOsAccountLocalId successfully, localId: " + localId);
console.log('getOsAccountLocalId successfully, localId: ' + localId);
}
});
} 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;
let accountManager = account_osAccount.getAccountManager();
try {
accountManager.getOsAccountLocalId().then((localId) => {
console.log("getOsAccountLocalId successfully, localId: " + localId);
console.log('getOsAccountLocalId successfully, localId: ' + localId);
}).catch((err) => {
console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalId failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('getOsAccountLocalId exception: ' + JSON.stringify(err));
......@@ -1071,12 +1071,12 @@ getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): v
try {
accountManager.getOsAccountLocalIdForUid(uid, (err, localId) => {
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) {
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;
let uid = 12345678;
try {
accountManager.getOsAccountLocalIdForUid(uid).then((localId) => {
console.log("getOsAccountLocalIdForUid successfully, localId: " + localId);
console.log('getOsAccountLocalIdForUid successfully, localId: ' + localId);
}).catch((err) => {
console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalIdForUid failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err));
......@@ -1155,9 +1155,9 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb
try {
accountManager.getOsAccountLocalIdForDomain(domainInfo, (err, localId) => {
if (err) {
console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalIdForDomain failed, error: ' + JSON.stringify(err));
} else {
console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId);
console.log('getOsAccountLocalIdForDomain successfully, localId: ' + localId);
}
});
} catch (err) {
......@@ -1201,12 +1201,12 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise&lt;number&g
let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'};
try {
accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId) => {
console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId);
console.log('getOsAccountLocalIdForDomain successfully, localId: ' + localId);
}).catch((err) => {
console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalIdForDomain failed, error: ' + JSON.stringify(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
}
});
} catch (err) {
console.log('queryMaxOsAccountNumber exception:' + JSON.stringify(err));
console.log('queryMaxOsAccountNumber exception: ' + JSON.stringify(err));
}
```
......@@ -1279,10 +1279,10 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
accountManager.queryMaxOsAccountNumber().then((maxCnt) => {
console.log('queryMaxOsAccountNumber successfully, maxCnt: ' + maxCnt);
}).catch((err) => {
console.log('queryMaxOsAccountNumber failed, error: ' + JSON.stringify(err));
console.log('queryMaxOsAccountNumber failed, error: ' + JSON.stringify(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
try {
accountManager.getOsAccountConstraints(localId, (err, constraints) => {
if (err) {
console.log("getOsAccountConstraints failed, err: " + JSON.stringify(err));
console.log('getOsAccountConstraints failed, err: ' + JSON.stringify(err));
} else {
console.log("getOsAccountConstraints successfully, constraints: " + JSON.stringify(constraints));
console.log('getOsAccountConstraints successfully, constraints: ' + JSON.stringify(constraints));
}
});
} catch (err) {
console.log('getOsAccountConstraints exception:' + JSON.stringify(err));
console.log('getOsAccountConstraints exception: ' + JSON.stringify(err));
}
```
......@@ -1368,10 +1368,10 @@ getOsAccountConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
accountManager.getOsAccountConstraints(localId).then((constraints) => {
console.log('getOsAccountConstraints, constraints: ' + constraints);
}).catch((err) => {
console.log('getOsAccountConstraints err: ' + JSON.stringify(err));
console.log('getOsAccountConstraints err: ' + JSON.stringify(err));
});
} 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;&
console.log('queryAllCreatedOsAccounts accountArr:' + JSON.stringify(accountArr));
});
} catch (e) {
console.log('queryAllCreatedOsAccounts exception:' + JSON.stringify(e));
console.log('queryAllCreatedOsAccounts exception: ' + JSON.stringify(e));
}
```
......@@ -1445,10 +1445,10 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
accountManager.queryAllCreatedOsAccounts().then((accountArr) => {
console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr));
}).catch((err) => {
console.log('queryAllCreatedOsAccounts err: ' + JSON.stringify(err));
console.log('queryAllCreatedOsAccounts err: ' + JSON.stringify(err));
});
} 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;
}
});
} catch (e) {
console.log('getActivatedOsAccountLocalIds exception:' + JSON.stringify(e));
console.log('getActivatedOsAccountLocalIds exception: ' + JSON.stringify(e));
}
```
......@@ -1517,10 +1517,10 @@ getActivatedOsAccountLocalIds(): Promise&lt;Array&lt;number&gt;&gt;
accountManager.getActivatedOsAccountLocalIds().then((idArray) => {
console.log('getActivatedOsAccountLocalIds, idArray: ' + idArray);
}).catch((err) => {
console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err));
console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err));
});
} 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&
console.log('createOsAccount osAccountInfo:' + JSON.stringify(osAccountInfo));
});
} catch (e) {
console.log('createOsAccount exception:' + JSON.stringify(e));
console.log('createOsAccount exception: ' + JSON.stringify(e));
}
```
......@@ -1611,10 +1611,10 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
accountManager.createOsAccount('testAccountName', account_osAccount.OsAccountType.NORMAL).then((accountInfo) => {
console.log('createOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
}).catch((err) => {
console.log('createOsAccount err: ' + JSON.stringify(err));
console.log('createOsAccount err: ' + JSON.stringify(err));
});
} 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
console.log('createOsAccountForDomain osAccountInfo:' + JSON.stringify(osAccountInfo));
});
} catch (e) {
console.log('createOsAccountForDomain exception:' + JSON.stringify(e));
console.log('createOsAccountForDomain exception: ' + JSON.stringify(e));
}
```
......@@ -1707,10 +1707,10 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
accountManager.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => {
console.log('createOsAccountForDomain, account info: ' + JSON.stringify(accountInfo));
}).catch((err) => {
console.log('createOsAccountForDomain err: ' + JSON.stringify(err));
console.log('createOsAccountForDomain err: ' + JSON.stringify(err));
});
} 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
console.log('getCurrentOsAccount curAccountInfo:' + JSON.stringify(curAccountInfo));
});
} catch (e) {
console.log('getCurrentOsAccount exception:' + JSON.stringify(e));
console.log('getCurrentOsAccount exception: ' + JSON.stringify(e));
}
```
......@@ -1780,10 +1780,10 @@ getCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
accountManager.getCurrentOsAccount().then((accountInfo) => {
console.log('getCurrentOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
}).catch((err) => {
console.log('getCurrentOsAccount err: ' + JSON.stringify(err));
console.log('getCurrentOsAccount err: ' + JSON.stringify(err));
});
} 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;
console.log('queryOsAccountById accountInfo:' + JSON.stringify(accountInfo));
});
} catch (e) {
console.log('queryOsAccountById exception:' + JSON.stringify(e));
console.log('queryOsAccountById exception: ' + JSON.stringify(e));
}
```
......@@ -1870,10 +1870,10 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
accountManager.queryOsAccountById(localId).then((accountInfo) => {
console.log('queryOsAccountById, accountInfo: ' + JSON.stringify(accountInfo));
}).catch((err) => {
console.log('queryOsAccountById err: ' + JSON.stringify(err));
console.log('queryOsAccountById err: ' + JSON.stringify(err));
});
} catch (e) {
console.log('queryOsAccountById exception:' + JSON.stringify(e));
console.log('queryOsAccountById exception: ' + JSON.stringify(e));
}
```
......@@ -1939,7 +1939,7 @@ getOsAccountType(): Promise&lt;OsAccountType&gt;
accountManager.getOsAccountType().then((accountType) => {
console.log('getOsAccountType, accountType: ' + accountType);
}).catch((err) => {
console.log('getOsAccountType err: ' + JSON.stringify(err));
console.log('getOsAccountType err: ' + JSON.stringify(err));
});
} catch (e) {
console.log('getOsAccountType exception: ' + JSON.stringify(e));
......@@ -2012,7 +2012,7 @@ queryDistributedVirtualDeviceId(): Promise&lt;string&gt;
accountManager.queryDistributedVirtualDeviceId().then((virtualID) => {
console.log('queryDistributedVirtualDeviceId, virtualID: ' + virtualID);
}).catch((err) => {
console.log('queryDistributedVirtualDeviceId err: ' + JSON.stringify(err));
console.log('queryDistributedVirtualDeviceId err: ' + JSON.stringify(err));
});
} catch (e) {
console.log('queryDistributedVirtualDeviceId exception: ' + JSON.stringify(e));
......@@ -2057,7 +2057,7 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;)
console.log('get photo:' + photo + ' by localId: ' + localId);
});
} catch (e) {
console.log('getOsAccountProfilePhoto exception:' + JSON.stringify(e));
console.log('getOsAccountProfilePhoto exception: ' + JSON.stringify(e));
}
```
......@@ -2102,10 +2102,10 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
accountManager.getOsAccountProfilePhoto(localId).then((photo) => {
console.log('getOsAccountProfilePhoto: ' + photo);
}).catch((err) => {
console.log('getOsAccountProfilePhoto err: ' + JSON.stringify(err));
console.log('getOsAccountProfilePhoto err: ' + JSON.stringify(err));
});
} 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
console.log('setOsAccountProfilePhoto err:' + JSON.stringify(err));
});
} catch (e) {
console.log('setOsAccountProfilePhoto exception:' + JSON.stringify(e));
console.log('setOsAccountProfilePhoto exception: ' + JSON.stringify(e));
}
```
......@@ -2203,10 +2203,10 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
accountManager.setOsAccountProfilePhoto(localId, photo).then(() => {
console.log('setOsAccountProfilePhoto success');
}).catch((err) => {
console.log('setOsAccountProfilePhoto err: ' + JSON.stringify(err));
console.log('setOsAccountProfilePhoto err: ' + JSON.stringify(err));
});
} 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
console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber);
});
} catch (e) {
console.log('ger localId exception:' + JSON.stringify(e));
console.log('ger localId exception: ' + JSON.stringify(e));
}
```
......@@ -2285,10 +2285,10 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise&lt;number&gt;
accountManager.getOsAccountLocalIdForSerialNumber(serialNumber).then((localId) => {
console.log('getOsAccountLocalIdForSerialNumber localId: ' + localId);
}).catch((err) => {
console.log('getOsAccountLocalIdForSerialNumber err: ' + JSON.stringify(err));
console.log('getOsAccountLocalIdForSerialNumber err: ' + JSON.stringify(err));
});
} catch (e) {
console.log('getOsAccountLocalIdForSerialNumber exception: ' + JSON.stringify(e));
console.log('getOsAccountLocalIdForSerialNumber exception: ' + JSON.stringify(e));
}
```
......@@ -2326,7 +2326,7 @@ getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback&lt;n
console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId);
});
} catch (e) {
console.log('ger serialNumber exception:' + JSON.stringify(e));
console.log('ger serialNumber exception: ' + JSON.stringify(e));
}
```
......@@ -2367,10 +2367,10 @@ getSerialNumberForOsAccountLocalId(localId: number): Promise&lt;number&gt;
accountManager.getSerialNumberForOsAccountLocalId(localId).then((serialNumber) => {
console.log('getSerialNumberForOsAccountLocalId serialNumber: ' + serialNumber);
}).catch((err) => {
console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err));
console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err));
});
} 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
try {
accountManager.on('activating', 'osAccountOnOffNameA', onCallback);
} 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
try {
accountManager.off('activating', 'osAccountOnOffNameA', offCallback);
} 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;
console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId));
});
} catch (e) {
console.info('getBundleIdForUid exception:' + JSON.stringify(e));
console.info('getBundleIdForUid exception: ' + JSON.stringify(e));
}
```
### getBundleIdForUid<sup>9+</sup>
......@@ -2535,7 +2535,7 @@ getBundleIdForUid(uid: number): Promise&lt;number&gt;;
console.info('getBundleIdForUid errInfo:' + JSON.stringify(err));
});
} 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;
console.info('isMainOsAccount result:' + JSON.stringify(result));
});
} catch (e) {
console.info('isMainOsAccount exception:' + JSON.stringify(e));
console.info('isMainOsAccount exception: ' + JSON.stringify(e));
}
```
### isMainOsAccount<sup>9+</sup>
......@@ -2611,7 +2611,7 @@ isMainOsAccount(): Promise&lt;boolean&gt;;
console.info('isMainOsAccount errInfo:' + JSON.stringify(err));
});
} catch (e) {
console.info('isMainOsAccount exception:' + JSON.stringify(e));
console.info('isMainOsAccount exception: ' + JSON.stringify(e));
}
```
### getOsAccountConstraintSourceTypes<sup>9+</sup>
......@@ -2652,7 +2652,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback:
console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos));
});
} 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&
console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err));
});
} 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
let accountManager = account_osAccount.getAccountManager();
accountManager.isMultiOsAccountEnable((err, isEnabled) => {
if (err) {
console.log("isMultiOsAccountEnable failed, error: " + JSON.stringify(err));
console.log('isMultiOsAccountEnable failed, error: ' + JSON.stringify(err));
} else {
console.log("isMultiOsAccountEnable successfully, isEnabled: " + isEnabled);
console.log('isMultiOsAccountEnable successfully, isEnabled: ' + isEnabled);
}
});
```
......@@ -2760,7 +2760,7 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt;
accountManager.isMultiOsAccountEnable().then((isEnabled) => {
console.log('isMultiOsAccountEnable successfully, isEnabled: ' + isEnabled);
}).catch((err) => {
console.log('isMultiOsAccountEnable failed, error: ' + JSON.stringify(err));
console.log('isMultiOsAccountEnable failed, error: ' + JSON.stringify(err));
});
```
......@@ -2834,7 +2834,7 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt;
accountManager.isOsAccountActived(localId).then((isActived) => {
console.log('isOsAccountActived successfully, isActived: ' + isActived);
}).catch((err) => {
console.log('isOsAccountActived failed, error: ' + JSON.stringify(err));
console.log('isOsAccountActived failed, error: ' + JSON.stringify(err));
});
```
......@@ -2865,12 +2865,12 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
```js
let accountManager = account_osAccount.getAccountManager();
let localId = 100;
let constraint = "constraint.wifi";
let constraint = 'constraint.wifi';
accountManager.isOsAccountConstraintEnable(localId, constraint, (err, isEnabled) => {
if (err) {
console.log("isOsAccountConstraintEnable failed, error:" + JSON.stringify(err));
console.log('isOsAccountConstraintEnable failed, error: ' + JSON.stringify(err));
} 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
```js
let accountManager = account_osAccount.getAccountManager();
let localId = 100;
let constraint = "constraint.wifi";
let constraint = 'constraint.wifi';
accountManager.isOsAccountConstraintEnable(localId, constraint).then((isEnabled) => {
console.log("isOsAccountConstraintEnable successfully, isEnabled: " + isEnabled);
console.log('isOsAccountConstraintEnable successfully, isEnabled: ' + isEnabled);
}).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
let accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount((err, isTestable) => {
if (err) {
console.log("isTestOsAccount failed, error: " + JSON.stringify(err));
console.log('isTestOsAccount failed, error: ' + JSON.stringify(err));
} else {
console.log("isTestOsAccount successfully, isTestable: " + isTestable);
console.log('isTestOsAccount successfully, isTestable: ' + isTestable);
}
});
```
......@@ -2969,9 +2969,9 @@ isTestOsAccount(): Promise&lt;boolean&gt;
```js
let accountManager = account_osAccount.getAccountManager();
accountManager.isTestOsAccount().then((isTestable) => {
console.log("isTestOsAccount successfully, isTestable: " + isTestable);
console.log('isTestOsAccount successfully, isTestable: ' + isTestable);
}).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
let accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified((err, isVerified) => {
if (err) {
console.log("isOsAccountVerified failed, error: " + JSON.stringify(err));
console.log('isOsAccountVerified failed, error: ' + JSON.stringify(err));
} 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
let localId = 100;
accountManager.isOsAccountVerified(localId, (err, isVerified) => {
if (err) {
console.log("isOsAccountVerified failed, error: " + JSON.stringify(err));
console.log('isOsAccountVerified failed, error: ' + JSON.stringify(err));
} else {
console.log("isOsAccountVerified successfully, isVerified: " + isVerified);
console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
}
});
```
......@@ -3074,9 +3074,9 @@ isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
```js
let accountManager = account_osAccount.getAccountManager();
accountManager.isOsAccountVerified(localId).then((isVerified) => {
console.log("isOsAccountVerified successfully, isVerified: " + isVerified);
console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
}).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
let accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount((err, count)=>{
if (err) {
console.log("getCreatedOsAccountsCount failed, error: " + JSON.stringify(err));
console.log('getCreatedOsAccountsCount failed, error: ' + JSON.stringify(err));
} else {
console.log("getCreatedOsAccountsCount successfully, count: " + count);
console.log('getCreatedOsAccountsCount successfully, count: ' + count);
}
});
```
......@@ -3138,9 +3138,9 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt;
```js
let accountManager = account_osAccount.getAccountManager();
accountManager.getCreatedOsAccountsCount().then((count) => {
console.log("getCreatedOsAccountsCount successfully, count: " + count);
console.log('getCreatedOsAccountsCount successfully, count: ' + count);
}).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
let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromProcess((err, localId) => {
if (err) {
console.log("getOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalIdFromProcess failed, error: ' + JSON.stringify(err));
} else {
console.log("getOsAccountLocalIdFromProcess successfully, localId: " + localId);
console.log('getOsAccountLocalIdFromProcess failed, error: ' + localId);
}
});
```
......@@ -3200,7 +3200,7 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
accountManager.getOsAccountLocalIdFromProcess().then((localId) => {
console.log('getOsAccountLocalIdFromProcess successfully, localId: ' + localId);
}).catch((err) => {
console.log('getOsAccountLocalIdFromProcess failed, error: ' + JSON.stringify(err));
console.log('getOsAccountLocalIdFromProcess failed, error: ' + JSON.stringify(err));
});
```
......@@ -3230,9 +3230,9 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;):
let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid, (err, localId) => {
if (err) {
console.log("getOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalIdFromUid failed, error: ' + JSON.stringify(err));
} else {
console.log("getOsAccountLocalIdFromUid successfully, localId: " + localId);
console.log('getOsAccountLocalIdFromUid successfully, localId: ' + localId);
}
});
```
......@@ -3267,9 +3267,9 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
let accountManager = account_osAccount.getAccountManager();
let uid = 12345678;
accountManager.getOsAccountLocalIdFromUid(uid).then((localId) => {
console.log("getOsAccountLocalIdFromUid successfully, localId: " + localId);
console.log('getOsAccountLocalIdFromUid successfully, localId: ' + localId);
}).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
let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, localId) => {
if (err) {
console.log("getOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err));
console.log('getOsAccountLocalIdFromDomain failed, error: ' + JSON.stringify(err));
} else {
console.log("getOsAccountLocalIdFromDomain successfully, localId: " + localId);
console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId);
}
});
```
......@@ -3342,7 +3342,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&
accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((localId) => {
console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId);
}).catch((err) => {
console.log('getOsAccountLocalIdFromDomain failed, error: ' + JSON.stringify(err));
console.log('getOsAccountLocalIdFromDomain failed, error: ' + JSON.stringify(err));
});
```
......@@ -3412,7 +3412,7 @@ getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
accountManager.getOsAccountAllConstraints(localId).then((constraints) => {
console.log('getOsAccountAllConstraints, constraints: ' + constraints);
}).catch((err) => {
console.log('getOsAccountAllConstraints err: ' + JSON.stringify(err));
console.log('getOsAccountAllConstraints err: ' + JSON.stringify(err));
});
```
......@@ -3472,7 +3472,7 @@ queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
accountManager.queryActivatedOsAccountIds().then((idArray) => {
console.log('queryActivatedOsAccountIds, idArray: ' + idArray);
}).catch((err) => {
console.log('queryActivatedOsAccountIds err: ' + JSON.stringify(err));
console.log('queryActivatedOsAccountIds err: ' + JSON.stringify(err));
});
```
......@@ -3533,7 +3533,7 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
accountManager.queryCurrentOsAccount().then((accountInfo) => {
console.log('queryCurrentOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
}).catch((err) => {
console.log('queryCurrentOsAccount err: ' + JSON.stringify(err));
console.log('queryCurrentOsAccount err: ' + JSON.stringify(err));
});
```
......@@ -3590,7 +3590,7 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
accountManager.getOsAccountTypeFromProcess().then((accountType) => {
console.log('getOsAccountTypeFromProcess, accountType: ' + accountType);
}).catch((err) => {
console.log('getOsAccountTypeFromProcess err: ' + JSON.stringify(err));
console.log('getOsAccountTypeFromProcess err: ' + JSON.stringify(err));
});
```
......@@ -3651,7 +3651,7 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt;
accountManager.getDistributedVirtualDeviceId().then((virtualID) => {
console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID);
}).catch((err) => {
console.log('getDistributedVirtualDeviceId err: ' + JSON.stringify(err));
console.log('getDistributedVirtualDeviceId err: ' + JSON.stringify(err));
});
```
......@@ -3717,7 +3717,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => {
console.log('getOsAccountLocalIdBySerialNumber localId: ' + localId);
}).catch((err) => {
console.log('getOsAccountLocalIdBySerialNumber err: ' + JSON.stringify(err));
console.log('getOsAccountLocalIdBySerialNumber err: ' + JSON.stringify(err));
});
```
......@@ -3783,7 +3783,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => {
console.log('getSerialNumberByOsAccountLocalId serialNumber: ' + serialNumber);
}).catch((err) => {
console.log('getSerialNumberByOsAccountLocalId err: ' + JSON.stringify(err));
console.log('getSerialNumberByOsAccountLocalId err: ' + JSON.stringify(err));
});
```
......@@ -4396,7 +4396,7 @@ static unregisterInputer(authType: AuthType): void
account_osAccount.InputerManager.unregisterInputer(authType);
console.log('unregisterInputer success.');
} 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
}, {
domain: domain,
accountName: accountName,
accountId: "xxxx"
accountId: 'xxxx'
})
},
getAuthStatusInfo: (domainAccountInfo, callback) => {},
......@@ -4823,7 +4823,7 @@ static registerPlugin(plugin: DomainPlugin): void
account_osAccount.DomainAccountManager.registerPlugin(plugin);
console.log('registerPlugin success.');
} catch(err) {
console.log("registerPlugin err:" + JSON.stringify(err));
console.log('registerPlugin err:' + JSON.stringify(err));
}
```
......@@ -4845,7 +4845,7 @@ static unregisterPlugin(): void
account_osAccount.DomainAccountManager.unregisterPlugin();
console.log('unregisterPlugin success.');
} 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
**示例:**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan"
domain: 'CHINA',
accountName: 'zhangsan'
}
let credential = new Uint8Array([0])
try {
......@@ -5030,15 +5030,15 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;bool
**示例:**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan"
domain: 'CHINA',
accountName: 'zhangsan'
}
try {
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, result) => {
if (err) {
console.log("call hasAccount failed, error: " + JSON.stringify(err));
console.log('call hasAccount failed, error: ' + JSON.stringify(err));
} else {
console.log("hasAccount result: " + result);
console.log('hasAccount result: ' + result);
}
});
} catch (err) {
......@@ -5081,14 +5081,14 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise&lt;boolean&gt;
**示例:**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan"
domain: 'CHINA',
accountName: 'zhangsan'
}
try {
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result) => {
console.log("hasAccount result: " + result);
console.log('hasAccount result: ' + result);
}).catch((err) => {
console.log("call hasAccount failed, error: " + JSON.stringify(err));
console.log('call hasAccount failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('hasAccount exception = ' + JSON.stringify(err));
......@@ -5126,17 +5126,17 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, call
**示例:**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan",
accountId: "123456"
domain: 'CHINA',
accountName: 'zhangsan',
accountId: '123456'
}
let token = new Uint8Array([0])
try {
account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token, (err) => {
if (err != null) {
console.log("updateAccountToken failed, error: " + JSON.stringify(err));
console.log('updateAccountToken failed, error: ' + JSON.stringify(err));
} else {
console.log("updateAccountToken successfully");
console.log('updateAccountToken successfully');
}
})
} catch (err) {
......@@ -5180,16 +5180,16 @@ updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Pro
**示例:**
```js
let domainAccountInfo = {
domain: "CHINA",
accountName: "zhangsan",
accountId: "123456"
domain: 'CHINA',
accountName: 'zhangsan',
accountId: '123456'
}
let token = new Uint8Array([0])
try {
account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token).then(() => {
console.log("updateAccountToken successfully");
console.log('updateAccountToken successfully');
}).catch((err) => {
console.log("updateAccountToken failed, error: " + JSON.stringify(err));
console.log('updateAccountToken failed, error: ' + JSON.stringify(err));
});
} catch (err) {
console.log('updateAccountToken exception = ' + JSON.stringify(err));
......@@ -5465,7 +5465,7 @@ cancel(challenge: Uint8Array): void;
try {
userIDM.cancel(challenge);
} 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';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
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');
}).catch((err) => {
console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`);
......@@ -108,7 +108,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
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) {
console.log(`addPermissionUsedRecord fail, err->${JSON.stringify(err)}`);
} else {
......@@ -160,14 +160,14 @@ getPermissionUsedRecord(request: PermissionUsedRequest): Promise&lt;PermissionUs
import privacyManager from '@ohos.privacyManager';
let request = {
"tokenId": 1,
"isRemote": false,
"deviceId": "device",
"bundleName": "bundle",
"permissionNames": [],
"beginTime": 0,
"endTime": 1,
"flag":privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
'tokenId': 1,
'isRemote': false,
'deviceId': 'device',
'bundleName': 'bundle',
'permissionNames': [],
'beginTime': 0,
'endTime': 1,
'flag':privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
};
try {
privacyManager.getPermissionUsedRecord(request).then((data) => {
......@@ -215,14 +215,14 @@ getPermissionUsedRecord(request: PermissionUsedRequest, callback: AsyncCallback&
import privacyManager from '@ohos.privacyManager';
let request = {
"tokenId": 1,
"isRemote": false,
"deviceId": "device",
"bundleName": "bundle",
"permissionNames": [],
"beginTime": 0,
"endTime": 1,
"flag":privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
'tokenId': 1,
'isRemote': false,
'deviceId': 'device',
'bundleName': 'bundle',
'permissionNames': [],
'beginTime': 0,
'endTime': 1,
'flag':privacyManager.PermissionUsageFlag.FLAG_PERMISSION_USAGE_DETAIL,
};
try {
privacyManager.getPermissionUsedRecord(request, (err, data) => {
......@@ -280,7 +280,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try {
privacyManager.startUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS").then(() => {
privacyManager.startUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS').then(() => {
console.log('startUsingPermission success');
}).catch((err) => {
console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`);
......@@ -328,7 +328,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try {
privacyManager.startUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS", (err, data) => {
privacyManager.startUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS', (err, data) => {
if (err) {
console.log(`startUsingPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -383,7 +383,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try {
privacyManager.stopUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS").then(() => {
privacyManager.stopUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS').then(() => {
console.log('stopUsingPermission success');
}).catch((err) => {
console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`);
......@@ -431,7 +431,7 @@ import privacyManager from '@ohos.privacyManager';
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
try {
privacyManager.stopUsingPermission(tokenID, "ohos.permission.PERMISSION_USED_STATS", (err, data) => {
privacyManager.stopUsingPermission(tokenID, 'ohos.permission.PERMISSION_USED_STATS', (err, data) => {
if (err) {
console.log(`stopUsingPermission fail, err->${JSON.stringify(err)}`);
} else {
......@@ -481,7 +481,7 @@ import privacyManager from '@ohos.privacyManager';
let permissionList = [];
try {
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) {
console.log(`catch err->${JSON.stringify(err)}`);
......@@ -513,7 +513,7 @@ off(type: 'activeStateChange', permissionList: Array&lt;Permissions&gt;, callbac
| 错误码ID | 错误信息 |
| -------- | -------- |
| 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. |
| 12100008 | Out of memory. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册