提交 abe3decc 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 823a3c06
......@@ -64,7 +64,6 @@ Creates an app account. This API uses an asynchronous callback to return the res
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.createAccount("WangWu", (err) => {
console.log("createAccount err: " + JSON.stringify(err));
......@@ -102,7 +101,6 @@ Creates an app account with custom data. This API uses an asynchronous callback
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
customData: {
"age": "10"
......@@ -155,7 +153,6 @@ Creates an app account with custom data. This API uses a promise to return the r
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
customData: {
"age": "10"
......@@ -215,7 +212,6 @@ Creates an app account implicitly based on the specified account owner. This API
});
}
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.createAccountImplicitly("com.example.accountjsdemo", {
onResult: onResultCallback,
......@@ -270,7 +266,6 @@ Creates an app account implicitly based on the specified account owner and optio
});
}
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
authType: "getSocialData",
requiredLabels: [ "student" ]
......@@ -311,7 +306,6 @@ Removes an app account. This API uses an asynchronous callback to return the res
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.removeAccount("ZhaoLiu", (err) => {
if (err) {
......@@ -356,7 +350,6 @@ Removes an app account. This API uses a promise to return the result.
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.removeAccount("Lisi").then(() => {
console.log("removeAccount successfully");
......@@ -397,7 +390,6 @@ Sets the access to the data of an account for an app. This API uses an asynchron
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true, (err) => {
if (err) {
......@@ -445,7 +437,6 @@ Sets the access to the data of an account for an app. This API uses a promise to
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true).then(() => {
console.log("setAppAccess successfully");
......@@ -485,7 +476,6 @@ Checks whether an app can access the data of an account. This API uses an asynch
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo", (err, isAccessible) => {
if (err) {
......@@ -532,7 +522,6 @@ Checks whether an app can access the data of an account. This API uses a promise
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo").then((isAccessible) => {
console.log("checkAppAccess successfully, isAccessible: " + isAccessible);
......@@ -573,7 +562,6 @@ Sets data synchronization for an app account. This API uses an asynchronous call
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setDataSyncEnabled("ZhangSan", true, (err) => {
console.log("setDataSyncEnabled err: " + JSON.stringify(err));
......@@ -617,7 +605,6 @@ Sets data synchronization for an app account. This API uses a promise to return
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager .setDataSyncEnabled("ZhangSan", true).then(() => {
console.log('setDataSyncEnabled Success');
......@@ -657,7 +644,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.checkDataSyncEnabled("ZhangSan", (err, isEnabled) => {
if (err) {
......@@ -704,7 +690,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.checkDataSyncEnabled("ZhangSan").then((isEnabled) => {
console.log("checkDataSyncEnabled successfully, isEnabled: " + isEnabled);
......@@ -744,7 +729,6 @@ Sets a credential for an app account. This API uses an asynchronous callback to
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx", (err) => {
if (err) {
......@@ -791,7 +775,6 @@ Sets a credential for an app account. This API uses a promise to return the resu
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx").then(() => {
console.log("setCredential successfully");
......@@ -831,7 +814,6 @@ Obtains the credential of an app account. This API uses an asynchronous callback
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX", (err, result) => {
if (err) {
......@@ -878,7 +860,6 @@ Obtains the credential of an app account. This API uses a promise to return the
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getCredential("ZhangSan", "PIN_SIX").then((credential) => {
console.log("getCredential successfully, credential: " + credential);
......@@ -919,7 +900,6 @@ Sets custom data for an app account. This API uses an asynchronous callback to r
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setCustomData("ZhangSan", "age", "12", (err) => {
if (err) {
......@@ -967,7 +947,6 @@ Sets custom data for an app account. This API uses a promise to return the resul
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setCustomData("ZhangSan", "age", "12").then(() => {
console.log("setCustomData successfully");
......@@ -1007,7 +986,6 @@ Obtains the custom data of an app account based on the specified key. This API u
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getCustomData("ZhangSan", "age", (err, data) => {
if (err) {
......@@ -1054,7 +1032,6 @@ Obtains the custom data of an app account based on the specified key. This API u
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getCustomData("ZhangSan", "age").then((data) => {
console.log("getCustomData successfully, data: " + data);
......@@ -1099,7 +1076,6 @@ Obtains the custom data of an app account based on the specified key. The API re
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
let value = appAccountManager.getCustomDataSync("ZhangSan", "age");
console.info("getCustomDataSync successfully, vaue:" + value);
......@@ -1114,8 +1090,6 @@ getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
Obtains information about all accessible app accounts. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
......@@ -1133,7 +1107,6 @@ Obtains information about all accessible app accounts. This API uses an asynchro
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAllAccounts((err, data) => {
if (err) {
......@@ -1153,8 +1126,6 @@ getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
Obtains information about all accessible app accounts. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount
**Return value**
......@@ -1172,7 +1143,6 @@ Obtains information about all accessible app accounts. This API uses a promise t
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAllAccounts().then((data) => {
console.debug("getAllAccounts successfully");
......@@ -1190,8 +1160,6 @@ getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccount
Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
......@@ -1212,7 +1180,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2", (err, data) => {
if (err) {
......@@ -1232,8 +1199,6 @@ getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
......@@ -1259,7 +1224,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAccountsByOwner("com.example.accountjsdemo2").then((data) => {
console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data));
......@@ -1299,7 +1263,6 @@ Subscribes to account information changes of apps.
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){
console.log("receive change data:" + JSON.stringify(data));
}
......@@ -1312,7 +1275,7 @@ Subscribes to account information changes of apps.
### off('accountChange')<sup>9+</sup>
off(type: 'accountChange', callback?: Callback<Array\<AppAccountInfo>>): void
off(type: 'accountChange', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
Unsubscribes from account information changes.
......@@ -1323,7 +1286,7 @@ Unsubscribes from account information changes.
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ------------ |
| type | 'accountChange' | Yes | Event type to unsubscribe from. The value is **'accountChange'**. |
| callback | Callback<Array\<[AppAccountInfo](#appaccountinfo)>> | No | Callback to unregister.|
| callback | Callback&lt;Array&lt;[AppAccountInfo](#appaccountinfo)&gt;&gt; | No | Callback to unregister.|
**Error codes**
......@@ -1336,8 +1299,7 @@ Unsubscribes from account information changes.
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){
function changeOnCallback(data) {
console.log("receive change data:" + JSON.stringify(data));
}
try{
......@@ -1398,7 +1360,6 @@ Authenticates an app account. This API uses an asynchronous callback to return t
});
}
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", {
onResult: onResultCallback,
......@@ -1458,7 +1419,6 @@ Authenticates an app account with customized options. This API uses an asynchron
let options = {
"password": "xxxx",
};
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", options, {
onResult: onResultCallback,
......@@ -1498,7 +1458,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, token) => {
if (err) {
......@@ -1546,7 +1505,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((token) => {
console.log("getAuthToken successfully, token: " + token);
......@@ -1587,7 +1545,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx", (err) => {
if (err) {
......@@ -1635,7 +1592,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx").then(() => {
console.log("setAuthToken successfully");
......@@ -1677,7 +1633,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => {
if (err) {
......@@ -1726,7 +1681,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => {
console.log("deleteAuthToken successfully");
......@@ -1770,7 +1724,6 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => {
if (err) {
......@@ -1821,7 +1774,6 @@ Sets the visibility of an authorization token to an app. This API uses a promise
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => {
console.log("setAuthTokenVisibility successfully");
......@@ -1863,7 +1815,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, isVisible) => {
if (err) {
......@@ -1912,7 +1863,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((isVisible) => {
console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible);
......@@ -1951,7 +1901,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses an a
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo", (err, tokenArr) => {
if (err) {
......@@ -1997,7 +1946,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses a pr
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo").then((tokenArr) => {
console.log('getAllAuthTokens successfully, tokenArr: ' + JSON.stringify(tokenArr));
......@@ -2037,7 +1985,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData", (err, authList) => {
if (err) {
......@@ -2084,7 +2031,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData").then((authList) => {
console.log("getAuthList successfully, authList: " + authList);
......@@ -2123,7 +2069,6 @@ Obtains the authenticator callback for the authentication session. This API uses
```js
import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try {
......@@ -2183,7 +2128,6 @@ Obtains the authenticator callback for the authentication session. This API uses
```js
import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
try {
......@@ -2236,7 +2180,6 @@ Obtains the authenticator information of an app. This API uses an asynchronous c
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo", (err, info) => {
if (err) {
......@@ -2281,7 +2224,6 @@ Obtains the authenticator information of an app. This API uses a promise to retu
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo").then((info) => {
console.log("queryAuthenticatorInfo successfully, info: " + JSON.stringify(info));
......@@ -2324,7 +2266,6 @@ Checks whether an app account has specific labels. This API uses an asynchronous
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let labels = ["student"];
try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels, (err, hasAllLabels) => {
......@@ -2375,7 +2316,6 @@ Checks whether an app account has specific labels. This API uses a promise to re
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let labels = ["student"];
try {
appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels).then((hasAllLabels) => {
......@@ -2416,7 +2356,6 @@ Deletes the credential of the specified type from an app account. This API uses
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX", (err) => {
if (err) {
......@@ -2463,7 +2402,6 @@ Deletes the credential of the specified type from an app account. This API uses
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.deleteCredential("zhangsan", "PIN_SIX").then(() => {
console.log("deleteCredential successfully");
......@@ -2502,7 +2440,6 @@ Selects the accounts that can be accessed by the invoker based on the options. T
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
allowedOwners: [ "com.example.accountjsdemo" ],
requiredLabels: [ "student" ]
......@@ -2552,7 +2489,6 @@ Selects the accounts that can be accessed by the invoker based on the options. T
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
allowedOwners: ["com.example.accountjsdemo"]
};
......@@ -2597,7 +2533,6 @@ Verifies the credential of an app account. This API uses an asynchronous callbac
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", {
onResult: (resultCode, result) => {
......@@ -2644,7 +2579,6 @@ Verifies the user credential. This API uses an asynchronous callback to return t
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
credentialType: "pin",
credential: "123456"
......@@ -2692,7 +2626,6 @@ Sets the authenticator attributes of an app. This API uses an asynchronous callb
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
try {
appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", {
onResult: (resultCode, result) => {
......@@ -2737,7 +2670,6 @@ Set authenticator properties. This API uses an asynchronous callback to return t
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
let options = {
properties: {"prop1": "value1"}
};
......@@ -2780,7 +2712,6 @@ Adds an app account. This API uses an asynchronous callback to return the result
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("WangWu", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
});
......@@ -2793,7 +2724,6 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
Adds an app account name and additional information. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-1).
**System capability**: SystemCapability.Account.AppAccount
......@@ -2809,7 +2739,6 @@ Adds an app account name and additional information. This API uses an asynchrono
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101", (err) => {
console.log("addAccount err: " + JSON.stringify(err));
});
......@@ -2843,7 +2772,6 @@ Adds an app account name and additional information. This API uses an asynchrono
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccount("LiSi", "token101").then(()=> {
console.log('addAccount Success');
}).catch((err) => {
......@@ -2889,7 +2817,6 @@ Adds an app account implicitly based on the specified owner. This API uses an as
});
}
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, {
onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback
......@@ -2918,7 +2845,6 @@ Deletes an app account. This API uses an asynchronous callback to return the res
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu", (err) => {
console.log("deleteAccount err: " + JSON.stringify(err));
});
......@@ -2951,7 +2877,6 @@ Deletes an app account. This API uses a promise to return the result.
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteAccount("ZhaoLiu").then(() => {
console.log('deleteAccount Success');
}).catch((err) => {
......@@ -2981,7 +2906,6 @@ Disables an app account from accessing an app. This API uses an asynchronous cal
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => {
console.log("disableAppAccess err: " + JSON.stringify(err));
});
......@@ -3015,7 +2939,6 @@ Disables an app account from accessing an app. This API uses a promise to return
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => {
console.log('disableAppAccess Success');
}).catch((err) => {
......@@ -3046,7 +2969,6 @@ Enables an app account to access an app. This API uses an asynchronous callback
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => {
console.log("enableAppAccess: " + JSON.stringify(err));
});
......@@ -3080,7 +3002,6 @@ Enables an app account to access an app. This API uses a promise to return the r
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => {
console.log('enableAppAccess Success');
}).catch((err) => {
......@@ -3112,7 +3033,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => {
console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err));
console.log('checkAppAccountSyncEnable result: ' + result);
......@@ -3148,7 +3068,6 @@ Checks whether data synchronization is enabled for an app account. This API uses
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => {
console.log('checkAppAccountSyncEnable, result: ' + data);
}).catch((err) => {
......@@ -3180,7 +3099,6 @@ Set credentials for an app account. This API uses an asynchronous callback to re
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => {
console.log("setAccountCredential err: " + JSON.stringify(err));
});
......@@ -3215,7 +3133,6 @@ Set credentials for an app account. This API uses a promise to return the result
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => {
console.log('setAccountCredential Success');
}).catch((err) => {
......@@ -3247,7 +3164,6 @@ Sets additional information for an app account. This API uses an asynchronous ca
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => {
console.log("setAccountExtraInfo err: " + JSON.stringify(err));
});
......@@ -3282,7 +3198,6 @@ Sets additional information for an app account. This API uses a promise to retur
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => {
console.log('setAccountExtraInfo Success');
}).catch((err) => {
......@@ -3315,7 +3230,6 @@ Sets data synchronization for an app account. This API uses an asynchronous call
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => {
console.log("setAppAccountSyncEnable err: " + JSON.stringify(err));
});
......@@ -3351,7 +3265,6 @@ Sets data synchronization for an app account. This API uses a promise to return
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => {
console.log('setAppAccountSyncEnable Success');
}).catch((err) => {
......@@ -3384,7 +3297,6 @@ Sets data to be associated with an app account. This API uses an asynchronous ca
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
console.log("setAssociatedData err: " + JSON.stringify(err));
});
......@@ -3420,7 +3332,6 @@ Sets data to be associated with an app account. This API uses a promise to retur
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => {
console.log('setAssociatedData Success');
}).catch((err) => {
......@@ -3451,7 +3362,6 @@ Obtains information about all accessible app accounts. This API uses an asynchro
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts((err, data)=>{
console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err));
console.debug("getAllAccessibleAccounts data:" + JSON.stringify(data));
......@@ -3481,7 +3391,6 @@ Obtains information about all accessible app accounts. This API uses a promise t
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllAccessibleAccounts().then((data) => {
console.log('getAllAccessibleAccounts: ' + data);
}).catch((err) => {
......@@ -3513,7 +3422,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
console.debug("getAllAccounts err:" + JSON.stringify(err));
......@@ -3550,7 +3458,6 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
const selfBundle = "com.example.actsgetallaaccounts";
appAccountManager.getAllAccounts(selfBundle).then((data) => {
console.log('getAllAccounts: ' + data);
......@@ -3582,7 +3489,6 @@ Obtains the credential of an app account. This API uses an asynchronous callback
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => {
console.log("getAccountCredential err: " + JSON.stringify(err));
console.log('getAccountCredential result: ' + result);
......@@ -3617,7 +3523,6 @@ Obtains the credential of an app account. This API uses a promise to return the
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => {
console.log('getAccountCredential, result: ' + data);
}).catch((err) => {
......@@ -3647,7 +3552,6 @@ Obtains additional information of an app account. Additional information refers
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => {
console.log("getAccountExtraInfo err: " + JSON.stringify(err));
console.log('getAccountExtraInfo result: ' + result);
......@@ -3681,7 +3585,6 @@ Obtains additional information of an app account. Additional information refers
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => {
console.log('getAccountExtraInfo, result: ' + data);
}).catch((err) => {
......@@ -3712,7 +3615,6 @@ Obtains data associated with an app account. This API uses an asynchronous callb
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => {
console.log("getAssociatedData err: " + JSON.stringify(err));
console.log('getAssociatedData result: ' + result);
......@@ -3747,7 +3649,6 @@ Obtains data associated with an app account. This API uses a promise to return t
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => {
console.log('getAssociatedData: ' + data);
}).catch((err) => {
......@@ -3778,7 +3679,6 @@ Subscribes to account information changes of apps.
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
}
......@@ -3792,7 +3692,7 @@ Subscribes to account information changes of apps.
### off('change')<sup>(deprecated)</sup>
off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
off(type: 'change', callback?: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
Unsubscribes from account information changes.
......@@ -3807,12 +3707,11 @@ Unsubscribes from account information changes.
| Name | Type | Mandatory | Description |
| -------- | -------------------------------- | ---- | ------------ |
| type | 'change' | Yes | Event type to unsubscribe from. The value is **'change'**, which indicates the account change event. |
| callback | Callback<Array\<[AppAccountInfo](#appaccountinfo)>> | No | Callback to unregister.|
| callback | Callback&lt;Array&lt;[AppAccountInfo](#appaccountinfo)&gt;&gt; | No | Callback to unregister.|
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
function changeOnCallback(data){
console.debug("receive change data:" + JSON.stringify(data));
appAccountManager.off('change', function(){
......@@ -3866,7 +3765,6 @@ Authenticates an app account with customized options. This API uses an asynchron
});
}
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, {
onResult: onResultCallback,
onRequestRedirected: onRequestRedirectedCallback
......@@ -3897,7 +3795,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, data) => {
console.log('getOAuthToken err: ' + JSON.stringify(err));
console.log('getOAuthToken token: ' + data);
......@@ -3933,7 +3830,6 @@ Obtains the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((data) => {
console.log('getOAuthToken token: ' + data);
}).catch((err) => {
......@@ -3965,7 +3861,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx", (err) => {
console.log('setOAuthToken err: ' + JSON.stringify(err));
});
......@@ -4000,7 +3895,6 @@ Sets an authorization token of the specific authentication type for an app accou
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx").then(() => {
console.log('setOAuthToken successfully');
}).catch((err) => {
......@@ -4033,7 +3927,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => {
console.log('deleteOAuthToken err: ' + JSON.stringify(err));
});
......@@ -4069,7 +3962,6 @@ Deletes the authorization token of the specified authentication type for an app
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => {
console.log('deleteOAuthToken successfully');
}).catch((err) => {
......@@ -4102,7 +3994,6 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => {
console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
});
......@@ -4138,7 +4029,6 @@ Sets the visibility of an authorization token to an app. This API uses a promise
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => {
console.log('setOAuthTokenVisibility successfully');
}).catch((err) => {
......@@ -4170,7 +4060,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, data) => {
console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
console.log('checkOAuthTokenVisibility isVisible: ' + data);
......@@ -4206,7 +4095,6 @@ Checks the visibility of an authorization token of the specified authentication
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((data) => {
console.log('checkOAuthTokenVisibility isVisible: ' + data);
}).catch((err) => {
......@@ -4237,7 +4125,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses an a
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo", (err, data) => {
console.log("getAllOAuthTokens err: " + JSON.stringify(err));
console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
......@@ -4272,7 +4159,6 @@ Obtains all tokens visible to the invoker for an app account. This API uses a pr
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo").then((data) => {
console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
}).catch((err) => {
......@@ -4303,7 +4189,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData", (err, data) => {
console.log('getOAuthList err: ' + JSON.stringify(err));
console.log('getOAuthList data: ' + JSON.stringify(data));
......@@ -4338,7 +4223,6 @@ Obtains the authorization list of the specified authentication type for an app a
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData").then((data) => {
console.log('getOAuthList data: ' + JSON.stringify(data));
}).catch((err) => {
......@@ -4369,7 +4253,6 @@ Obtains the authenticator callback for an authentication session. This API uses
```js
import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
......@@ -4415,7 +4298,6 @@ Obtains the authenticator callback for an authentication session. This API uses
```js
import featureAbility from '@ohos.ability.featureAbility';
let appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant().then((want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
......@@ -4454,7 +4336,6 @@ Obtains the authenticator information of an app. This API uses an asynchronous c
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo", (err, data) => {
console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
console.log('getAuthenticatorInfo data: ' + JSON.stringify(data));
......@@ -4488,7 +4369,6 @@ Obtains the authenticator information of an app. This API uses a promise to retu
**Example**
```js
let appAccountManager = account_appAccount.createAppAccountManager();
appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo").then((data) => {
console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
}).catch((err) => {
......
......@@ -534,9 +534,9 @@ Allows an application to change the telephone state.
**Enable ACL**: TRUE
## ohos.permission.START_ABILIIES_FROM_BACKGROUND
## ohos.permission.START_ABILITIES_FROM_BACKGROUND
Allows an application to start Feature abilities in the background.
Allows an application to start or access other components from the background.
**Permission level**: system_basic
......@@ -1594,6 +1594,16 @@ Allows a system application to obtain the authentication and networking capabili
**Enable ACL**: TRUE
## ohos.permission.APP_TRACKING_CONSENT
Allows an application to read advertisement identifiers.
**Permission level**: normal
**Authorization mode**: user_grant
**Enable ACL**: TRUE
## ohos.permission.RUN_ANY_CODE
Allows an application to run unsigned code.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册