未验证 提交 610f75eb 编写于 作者: O openharmony_ci 提交者: Gitee

!18591 翻译完成:18216 FIx docs description of form

Merge pull request !18591 from wusongqing/TR18216
......@@ -7,6 +7,12 @@ This is the base class of [UIAbility](js-apis-app-ability-uiAbility.md) and [Ext
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import Ability from '@ohos.app.ability.Ability';
```
## Ability.onConfigurationUpdate
onConfigurationUpdate(newConfig: Configuration): void;
......
......@@ -412,7 +412,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
abilityManager.acquireShareData(1, (err, wantParam) => {
abilityManager.acquireShareData(1, (err, data) => {
if (err) {
console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`);
} else {
......@@ -449,7 +449,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
try {
abilityManager.acquireShareData(1).then((wantParam) => {
abilityManager.acquireShareData(1).then((data) => {
console.log(`acquireShareData success, data: ${JSON.stringify(data)}`);
}).catch((err) => {
console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`);
......
......@@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an
**Parameters**
| Type| Description|
| -------- | -------- |
|AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.|
| Type| Description|
| -------- | -------- |
|AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.|
**Error codes**
......@@ -59,9 +59,9 @@ Checks whether this application is undergoing a stability test. This API uses a
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.|
| Type| Description|
| -------- | -------- |
| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.|
**Error codes**
......@@ -94,9 +94,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.|
| Type| Description|
| -------- | -------- |
| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.|
**Error codes**
......@@ -128,9 +128,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Parameters**
| Type| Description|
| -------- | -------- |
| AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.|
| Type| Description|
| -------- | -------- |
| AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.|
**Error codes**
......@@ -164,9 +164,9 @@ Obtains the memory size of this application. This API uses a promise to return t
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.|
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.|
**Error codes**
......@@ -198,9 +198,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb
**Parameters**
| Type| Description|
| -------- | -------- |
|AsyncCallback<number> |Callback used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.|
| Type| Description|
| -------- | -------- |
|AsyncCallback<number> |Callback used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.|
**Error codes**
......@@ -641,7 +641,7 @@ Obtains applications that are running in the foreground. This API uses a promise
| Type| Description|
| -------- | -------- |
| Promise\<Array\<[AppStateData](js-apis-inner-application-appStateData.md)>> | Promise used to return an array holding the application state data|
| Promise\<Array\<[AppStateData](js-apis-inner-application-appStateData.md)>> | Promise used to return an array holding the application state data. |
**Error codes**
......@@ -669,7 +669,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
Kills a process by bundle name and account ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
> **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -715,19 +719,23 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Bundle name.|
| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
| callback | AsyncCallback\<void\> | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Bundle name.|
| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
| callback | AsyncCallback\<void\> | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.|
**Error codes**
......
......@@ -6,6 +6,12 @@ The **Configuration** module defines environment change information. **Configura
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import Configuration from '@ohos.app.ability.Configuration';
```
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description|
......
......@@ -41,32 +41,71 @@ Obtains the request information from Want.
import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest';
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`);
}
onRequest(want, startId) {
console.info(TAG, `onRequest, want: ${want.abilityName}`);
try {
var requestInfo = dialogRequest.getRequestInfo(want);
} catch(err) {
console.error('getRequestInfo err= ${JSON.stringify(err)}');
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
let TAG = "getRequestInfoTest";
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`);
}
onRequest(want, startId) {
console.info(TAG, `onRequest, want: ${want.abilityName}`);
try {
var requestInfo = dialogRequest.getRequestInfo(want);
} catch (err) {
console.error('getRequestInfo err= ${JSON.stringify(err)}');
}
}
onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`);
}
onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
}
onDisconnect(want) {
console.info(TAG, `onDisconnect, want: ${want.abilityName}`);
}
onDisconnect(want) {
console.info(TAG, `onDisconnect, want: ${want.abilityName}`);
}
onDestroy() {
console.info(TAG, `onDestroy`);
}
}
onDestroy() {
console.info(TAG, `onDestroy`);
}
}
```
## dialogRequest.getRequestCallback
......@@ -95,6 +134,44 @@ Obtains the request callback from Want.
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility';
import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest';
let TAG = "getRequestCallbackTest";
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
......@@ -112,6 +189,7 @@ Obtains the request callback from Want.
onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
}
onDisconnect(want) {
......@@ -127,8 +205,7 @@ Obtains the request callback from Want.
## RequestInfo
Defines the request information, which is used as an input parameter for binding the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Example**
......@@ -137,6 +214,44 @@ Defines the request information, which is used as an input parameter for binding
import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest';
import window from '@ohos.window';
let TAG = "RequestInfoTest";
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
......@@ -163,6 +278,8 @@ Defines the request information, which is used as an input parameter for binding
onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
}
onDisconnect(want) {
......@@ -179,7 +296,7 @@ Defines the request information, which is used as an input parameter for binding
Enumerates the result codes of the request for the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description |
| ------------ | ------------------ | ---------------------- |
......@@ -191,7 +308,7 @@ Defines the result of the request for the modal dialog box. Only the result code
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
......@@ -207,7 +324,7 @@ setRequestResult(result: RequestResult): void;
Sets the result of the request for the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
......@@ -229,6 +346,44 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility';
import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest';
let TAG = "setRequestResultTest";
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) {
......@@ -250,6 +405,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
}
onDisconnect(want) {
......
......@@ -45,8 +45,7 @@ Called when the system memory level changes.
**Example**
```ts
```ts
import UIAbility from '@ohos.app.ability.Ability';
let callbackId;
......@@ -58,7 +57,7 @@ export default class MyAbility extends UIAbility {
let environmentCallback = {
onConfigurationUpdated(config){
console.log('onConfigurationUpdated config: ${JSON.stringify(config)}');
}
},
onMemoryLevel(level){
console.log('onMemoryLevel level: ${JSON.stringify(level)}');
......@@ -81,4 +80,4 @@ export default class MyAbility extends UIAbility {
});
}
}
```
```
......@@ -311,33 +311,36 @@ Obtains the information about a given mission. This API uses an asynchronous cal
**Example**
```ts
import missionManager from '@ohos.app.ability.missionManager';
import missionManager from '@ohos.app.ability.missionManager';
let testMissionId = 1;
try {
let allMissions=await missionManager.getMissionInfos('',10).catch(function(err){console.log(err);});
if (allMissions && allMissions.length > 0) {
testMissionId = allMissions[0].missionId;
}
let testMissionId = 1;
missionManager.getMissionInfo('', testMissionId, (error, mission) => {
if (error) {
missionManager.getMissionInfos('',10)
.then((allMissions) => {
try {
if (allMissions && allMissions.length > 0) {
testMissionId = allMissions[0].missionId;
}
missionManager.getMissionInfo('', testMissionId, (error, mission) => {
if (error) {
console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}');
} else {
} else {
console.log('mission.missionId = ${mission.missionId}');
console.log('mission.runningState = ${mission.runningState}');
console.log('mission.lockedState = ${mission.lockedState}');
console.log('mission.timestamp = ${mission.timestamp}');
console.log('mission.label = ${mission.label}');
console.log('mission.iconPath = ${mission.iconPath}');
}
});
} catch (paramError) {
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
}
});
} catch (paramError) {
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
}
})
.catch(function(err){console.log(err);});
```
## missionManager.getMissionInfo
getMissionInfo(deviceId: string, missionId: number): Promise&lt;MissionInfo&gt;;
......@@ -943,8 +946,8 @@ Clears all unlocked missions. This API uses a promise to return the result.
import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.clearAllMissions(bundleName).then(() => {
console.info('clearAllMissions successfully.');
missionManager.clearAllMissions(bundleName).then((data) => {
console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}');
}).catch(err => {
console.error('clearAllMissions failed: ${err.message}');
});
......
......@@ -66,7 +66,7 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the
| ID| Error Message|
| ------- | -------- |
| 18500002 | Copy file failed, maybe not exist or inaccessible. |
| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages.
......@@ -130,7 +130,7 @@ Applies a quick fix patch. This API uses a promise to return the result.
| ID| Error Message|
| ------- | -------- |
| 18500002 | Copy file failed, maybe not exist or inaccessible. |
| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages.
......@@ -183,7 +183,7 @@ Obtains the quick fix information of the application. This API uses an asynchron
| ID| Error Message|
| ------- | -------- |
| 18500001 | The bundle is not exist. |
| 18500001 | The specified bundleName is invalid. |
| 18500008 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
......@@ -233,7 +233,7 @@ Obtains the quick fix information of the application. This API uses a promise to
| ID| Error Message|
| ------- | -------- |
| 18500001 | The bundle is not exist. |
| 18500001 | The specified bundleName is invalid. |
| 18500008 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
......@@ -252,3 +252,102 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
## quickFixManager.revokeQuickFix<sup>10+<sup>
revokeQuickFix(bundleName: string, callback: AsyncCallback\<void>): void;
Revokes quick fix. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.INSTALL_BUNDLE and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.Ability.AbilityRuntime.QuickFix
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 18500001 | The bundle is not exist or no patch has applied. |
| 18500009 | The application has a apply quick fix task that is being processed. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500007 | Unload patch failed. |
**Example**
```ts
let bundleName = "com.example.myapplication";
quickFixManager.revokeQuickFix(bundleName, (err) => {
console.info("revokeQuickFix " + bundleName + " " + JSON.stringify(err));
});
```
## quickFixManager.revokeQuickFix<sup>10+<sup>
revokeQuickFix(bundleName: string): Promise\<void>;
Revokes quick fix. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INSTALL_BUNDLE and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.Ability.AbilityRuntime.QuickFix
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise\<void> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 18500001 | The bundle is not exist or no patch has applied. |
| 18500009 | The application has a apply quick fix task that is being processed. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500007 | Unload patch failed. |
**Example**
```ts
let bundleName = "com.example.myapplication";
quickFixManager.revokeQuickFix(bundleName).then(() => {
console.info("revokeQuickFix " + bundleName +" ok");
}).catch((err) => {
console.info("revokeQuickFix " + bundleName +" failed, error code is ", JSON.stringify((err)));
});
```
<!--no_check-->
\ No newline at end of file
......@@ -3,8 +3,9 @@
The **ServiceExtensionAbility** module provides lifecycle callbacks when a ServiceExtensionAbility (background service) is created, destroyed, connected, or disconnected.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs of this module can be used only in the stage model.
## Modules to Import
......@@ -145,6 +146,29 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal
}
```
If the returned **RemoteObject** object depends on an asynchronous API, you can use the asynchronous lifecycle.
```ts
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject{
constructor(des) {
super(des);
}
onConnect(code, data, reply, option) {
}
}
async function getDescriptor() {
// Call the asynchronous function.
return "asyncTest"
}
class ServiceExt extends ServiceExtension {
async onConnect(want) {
console.log(`onConnect , want: ${want.abilityName}`);
let descriptor = await getDescriptor();
return new StubTest(descriptor);
}
}
```
## ServiceExtensionAbility.onDisconnect
......@@ -172,6 +196,17 @@ Called when a client is disconnected from this ServiceExtensionAbility.
}
```
After the **onDisconnect** lifecycle callback is executed, the application may exit. As a result, the asynchronous function in **onDisconnect** may fail to be executed correctly, for example, asynchronously writing data to the database. The asynchronous lifecycle can be used to ensure that the subsequent lifecycle continues after the asynchronous **onDisconnect** is complete.
```ts
class ServiceExt extends ServiceExtension {
async onDisconnect(want) {
console.log('onDisconnect, want: ${want.abilityName}');
// Call the asynchronous function.
}
}
```
## ServiceExtensionAbility.onReconnect
onReconnect(want: Want): void;
......
......@@ -15,11 +15,8 @@ import StartOptions from '@ohos.app.ability.StartOptions';
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.|
......
......@@ -132,6 +132,7 @@ Called when this UIAbility is destroyed to clear resources.
**Example**
```ts
class MyUIAbility extends UIAbility {
onDestroy() {
......@@ -140,6 +141,16 @@ Called when this UIAbility is destroyed to clear resources.
}
```
After the **onDestroy** lifecycle callback is executed, the application may exit. As a result, the asynchronous function in **onDestroy** may fail to be executed correctly, for example, asynchronously writing data to the database. The asynchronous lifecycle can be used to ensure that the subsequent lifecycle continues after the asynchronous **onDestroy** is complete.
```ts
class MyUIAbility extends UIAbility {
async onDestroy() {
console.log('onDestroy');
// Call the asynchronous function.
}
}
```
## UIAbility.onForeground
......@@ -360,7 +371,7 @@ Sends sequenceable data to the target ability.
| ------- | -------------------------------- |
| 16200001 | Caller released. The caller has been released. |
| 16200002 | Callee invalid. The callee does not exist. |
| 16000050 | Internal Error. |
| 16000050 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
......@@ -441,7 +452,7 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
| ------- | -------------------------------- |
| 16200001 | Caller released. The caller has been released. |
| 16200002 | Callee invalid. The callee does not exist. |
| 16000050 | Internal Error. |
| 16000050 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
......@@ -586,9 +597,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
}
```
## Caller.onRemoteStateChange
## Caller.onRemoteStateChange<sup>10+</sup>
onRemoteStateChange(callback: OnRemoteStateChangeCallback): void;
onRemoteStateChange(callback: OnRemoteStateChangeCallback): void;
Registers a callback that is invoked when the remote ability state changes in the collaboration scenario.
......@@ -639,7 +650,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
## Caller.on
on(type: 'release', callback: OnReleaseCallback): void;
on(type: 'release', callback: OnReleaseCallback): void;
Registers a callback that is invoked when the stub on the target ability is disconnected.
......@@ -656,6 +667,7 @@ Registers a callback that is invoked when the stub on the target ability is disc
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
| 16200001 | Caller released. The caller has been released. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
......@@ -701,6 +713,12 @@ Deregisters a callback that is invoked when the stub on the target ability is di
| type | string | Yes| Event type. The value is fixed at **release**.|
| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
**Example**
```ts
......@@ -892,7 +910,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
| -------- | -------- | -------- | -------- | -------- |
| (msg: string) | Yes| No| function | Prototype of the listener function registered by the caller.|
## OnRemoteStateChangeCallback
## OnRemoteStateChangeCallback<sup>10+</sup>
(msg: string): void;
......
......@@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want';
| entities | Array\<string> | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.|
| uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | string | No| MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.|
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files.|
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files.<br>- **ability.params.backToOtherMissionStack**: whether to support redirection back across mission stacks.|
| [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.<br>For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.|
**Example**
......@@ -34,7 +34,8 @@ import Want from '@ohos.app.ability.Want';
- Basic usage: called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability).
```ts
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
'deviceId': '', // An empty deviceId indicates the local device.
'bundleName': 'com.example.myapplication',
......@@ -52,7 +53,8 @@ import Want from '@ohos.app.ability.Want';
* String
```ts
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -67,7 +69,8 @@ import Want from '@ohos.app.ability.Want';
```
* Number
```ts
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -83,7 +86,8 @@ import Want from '@ohos.app.ability.Want';
```
* Boolean
```ts
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -98,7 +102,8 @@ import Want from '@ohos.app.ability.Want';
```
* Object
```ts
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -118,7 +123,8 @@ import Want from '@ohos.app.ability.Want';
```
* Array
```ts
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -138,7 +144,8 @@ import Want from '@ohos.app.ability.Want';
```ts
import fs from '@ohos.file.fs';
let context = ...; // UIAbilityContext
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let fd;
try {
......@@ -160,3 +167,33 @@ import Want from '@ohos.app.ability.Want';
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
- Usage of **parameters**: The following uses **ability.params.backToOtherMissionStack** as an example. When a ServiceExtensionAbility starts a UIAbility, redirection back across mission stacks is supported.
```ts
// (1) UIAbility1 starts a ServiceExtensionAbility.
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication1',
abilityName: 'ServiceExtensionAbility',
};
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
// (2) The ServiceExtensionAbility starts UIAbility2, carrying **"ability.params.backToOtherMissionStack": true** during the startup.
let context = ...; // ServiceExtensionContext
let want = {
bundleName: 'com.example.myapplication2',
abilityName: 'MainAbility',
parameters: {
"ability.params.backToOtherMissionStack": true,
},
};
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
Note: In the preceding example, when the ServiceExtensionAbility starts UIAbility2, **"ability.params.backToOtherMissionStack": true** is carried, indicating that redirection back across mission stacks is supported. Therefore, when you press **Back** on the page of UIAbility 2, the page of UIAbility1 page is displayed. However, if **ability.params.backToOtherMissionStack** is not carried or if **"ability.params.backToOtherMissionStack": false** is carried, the page of UIAbility1 is not displayed when you press **Back** on the page of UIAbility 2.
......@@ -118,6 +118,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
let wantAgent;
// WantAgentInfo object
let wantAgentInfo = {
wants: [
......@@ -1181,7 +1182,7 @@ function getWantAgentCallback(err, data) {
}
}
try {
WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback);
WantAgent.getOperationType(wantAgent, getOperationTypeCallback);
} catch(err) {
console.error('getOperationTypeCallback failed! ${err.code} ${err.message}');
}
......
......@@ -16,6 +16,8 @@ import wantConstant from '@ohos.app.ability.wantConstant';
Defines **Params** (specifying the action that can be performed) in the Want.
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Value | Description |
| ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------ |
| DLP_PARAMS_SANDBOX | ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.<br>**System API**: This is a system API and cannot be called by third-party applications.|
......@@ -23,10 +25,11 @@ Defines **Params** (specifying the action that can be performed) in the Want.
| DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | Action of obtaining the DLP module name.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | Action of obtaining the DLP ability name.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| DLP_PARAMS_INDEX | ohos.dlp.params.index | Action of obtaining the DLP index.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| ABILITY_RECOVERY_RESTART | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.|
| CONTENT_TITLE_KEY | ohos.extra.param.key.contentTitle | Action of sharing the content title.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| SHARE_ABSTRACT_KEY | ohos.extra.param.key.shareAbstract | Action of sharing the abstract.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| SHARE_URL_KEY | ohos.extra.param.key.shareUrl | Action of sharing the URL.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | Whether to support redirection back across mission stacks.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| ABILITY_RECOVERY_RESTART<sup>10+</sup> | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.|
| CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | Action of sharing the content title. |
| SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | Action of sharing the abstract. |
| SHARE_URL_KEY<sup>10+</sup> | ohos.extra.param.key.shareUrl | Action of sharing the URL. |
## wantConstant.Flags
......
......@@ -18,6 +18,8 @@ Describes widget information.
**System capability**: SystemCapability.Ability.Form
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Name of the bundle to which the widget belongs. |
......@@ -100,8 +102,10 @@ Enumerates the widget parameters.
| HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height. |
| TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget. |
| ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name. |
| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' | Device ID. |
| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' <br>**System API**: This is a system API and cannot be called by third-party applications. | Device ID. |
| BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Key that specifies the target bundle name.|
| LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | Reason for creating the widget. |
| PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | Custom data. |
## FormDimension
......@@ -136,5 +140,47 @@ Enumerates the visibility types of the widget.
| Name | Value | Description |
| ----------- | ---- | ------------ |
| UNKNOWN | 0 | The visibility type of the widget is unknown.|
| FORM_VISIBLE | 1 | The widget is visible.|
| FORM_INVISIBLE | 2 | The widget is invisible.|
## RunningFormInfo<sup>10+</sup>
Defines the information about the widget host.
**System capability**: SystemCapability.Ability.Form
| Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| formId | string | Yes | No | Widget ID. |
| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. |
| hostBundleName | string | Yes | No | Name of the bundle to which the widget host belongs. |
| visibilityType | [VisibilityType](#visibilitytype) | Yes | No | Visibility types of the widget. |
| moduleName | string | Yes | No | Name of the module to which the widget belongs. |
| abilityName | string | Yes | No | Name of the ability to which the widget belongs. |
| formName | string | Yes | No | Widget name. |
| dimension | number | Yes | No | Widget specifications. |
## formProviderFilter<sup>10+</sup>
Defines the information about the widget provider.
**System capability**: SystemCapability.Ability.Form
| Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. |
| formName | string | Yes | No | Widget name. |
| moduleName | string | Yes | No | Name of the module to which the widget belongs. |
| abilityName | string | Yes | No | Name of the ability to which the widget belongs. |
## LaunchReason<sup>10+</sup>
Enumerates the reasons for creating a widget.
**System capability**: SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| FORM_DEFAULT | 1 | The widget is created by default.|
| FORM_SHARE | 2 | The widget is created for sharing.|
......@@ -39,13 +39,12 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback
| 16501001 | The ID of the form to be operated does not exist. |
| 16501002 | The number of forms exceeds upper bound. |
| 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288';
try {
formProvider.setFormNextRefreshTime(formId, 5, (error) => {
......@@ -93,13 +92,12 @@ Sets the next refresh time for a widget. This API uses a promise to return the r
| 16501001 | The ID of the form to be operated does not exist. |
| 16501002 | The number of forms exceeds upper bound. |
| 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288';
try {
formProvider.setFormNextRefreshTime(formId, 5).then(() => {
......@@ -139,13 +137,13 @@ Updates a widget. This API uses an asynchronous callback to return the result.
| 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formBindingData from '@ohos.app.form.formBindingData';
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288';
try {
......@@ -194,13 +192,13 @@ Updates a widget. This API uses a promise to return the result.
| 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formBindingData from '@ohos.app.form.formBindingData';
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288';
let obj = formBindingData.createFormBindingData({ temperature: '22c', time: '22:00' });
......@@ -236,14 +234,13 @@ Obtains the application's widget information on the device. This API uses an asy
| 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
try {
formProvider.getFormsInfo((error, data) => {
if (error) {
......@@ -279,13 +276,13 @@ Obtains the application's widget information that meets a filter criterion on th
| 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formInfo from '@ohos.app.form.formInfo';
import formProvider from '@ohos.app.form.formProvider';
const filter: formInfo.FormInfoFilter = {
// get info of forms belong to module entry.
......@@ -332,13 +329,13 @@ Obtains the application's widget information on the device. This API uses a prom
| 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formInfo from '@ohos.app.form.formInfo';
import formProvider from '@ohos.app.form.formProvider';
const filter: formInfo.FormInfoFilter = {
// get info of forms belong to module entry.
......@@ -382,13 +379,13 @@ Requests to publish a widget carrying data to the widget host. This API uses an
| 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formBindingData from '@ohos.app.form.formBindingData';
import formProvider from '@ohos.app.form.formProvider';
let want = {
abilityName: 'FormAbility',
......@@ -438,13 +435,12 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c
| 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
let want = {
abilityName: 'FormAbility',
parameters: {
......@@ -498,13 +494,12 @@ Requests to publish a widget to the widget host. This API uses a promise to retu
| 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
let want = {
abilityName: 'FormAbility',
parameters: {
......@@ -548,13 +543,12 @@ Checks whether a widget can be published to the widget host. This API uses an as
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
try {
formProvider.isRequestPublishFormSupported((error, isSupported) => {
if (error) {
......@@ -611,13 +605,12 @@ Checks whether a widget can be published to the widget host. This API uses a pro
| 202 | The application is not a system application. |
| 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example**
```ts
import formProvider from '@ohos.app.form.formProvider';
try {
formProvider.isRequestPublishFormSupported().then((isSupported) => {
if (isSupported) {
......
......@@ -400,7 +400,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
Kills a process by bundle name and account ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
> **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -434,11 +438,15 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**Parameters**
......
......@@ -3,9 +3,16 @@
The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead.
## Modules to Import
```ts
import Configuration from '@ohos.app.application.Configuration';
```
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description|
......
......@@ -39,7 +39,7 @@ Enumerates the types of business abilities.
Describes the criteria for filtering business abilities.
**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System API**: This is a system API.
......
......@@ -2,6 +2,10 @@
The **ContinueCallback** module defines the callback function that indicates the result of mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission).
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## ContinueCallback.onContinueDone
onContinueDone(result: number): void;
......
......@@ -2,6 +2,10 @@
The **ContinueDeviceInfo** module defines the parameters required for initiating mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission).
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
......
......@@ -2,6 +2,10 @@
The **MissionCallback** module defines the callbacks invoked after synchronization starts. These callbacks can be used as input parameters in [registerMissionListener](js-apis-distributedMissionManager.md#distributedmissionmanagerregistermissionlistener).
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Template | Readable| Writable| Description |
......
......@@ -2,6 +2,10 @@
The **MissionParameter** module defines the parameters required for mission synchronization. It can be used an input parameter in [startSyncRemoteMissions](js-apis-distributedMissionManager.md#distributedmissionmanagerstartsyncremotemissions).
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
......
......@@ -11,7 +11,7 @@ The **uriPermissionManager** module provides APIs for granting permissions on a
```js
import UriPermissionManager from '@ohos.application.uriPermissionManager';
import uriPermissionManager from '@ohos.application.uriPermissionManager';
```
......
......@@ -20,6 +20,8 @@ Obtains the Want in a **WantAgent** object. This API uses an asynchronous callba
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -91,6 +93,8 @@ Obtains the Want in a **WantAgent** object. This API uses a promise to return th
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type | Mandatory| Description |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册