未验证 提交 52aaa3ff 编写于 作者: O openharmony_ci 提交者: Gitee

!1877 Done! 1760:运行管理资料syscap改造

Merge pull request !1877 from wusongqing/TR1760
......@@ -25,12 +25,16 @@ Obtains the local root directory of the application. This method uses a callback
If this method is called for the first time, a root directory is created.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------- |
| callback | AsyncCallback\<string> | Yes| Callback used to return the local root directory of the application.|
| callback | AsyncCallback\<string> | Yes | Callback used to return the local root directory of the application.|
**Example**
......@@ -52,9 +56,13 @@ Obtains the local root directory of the application. This method uses a promise
If this method is called for the first time, a root directory is created.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| ---------------- | ---------------------- |
| Promise\<string> | Promise used to return the local root directory of the application.|
......@@ -76,14 +84,18 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async
Verifies whether a specific PID and UID have the given permission. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | ------------------------------------- |
| permission | string | Yes| Name of the permission to verify.|
| options | [PermissionOptions](#permissionoptions) | Yes| Permission options.|
| callback | AsyncCallback\<number> | Yes| Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
| permission | string | Yes | Name of the permission to verify. |
| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
**Example**
......@@ -107,10 +119,10 @@ Verifies whether the current PID and UID have the given permission. This method
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| ---------- | ---------------------- | ---- | ------------------------------------- |
| permission | string | Yes| Name of the permission to verify.|
| callback | AsyncCallback\<number> | Yes| Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
| permission | string | Yes | Name of the permission to verify. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
**Example**
......@@ -126,17 +138,21 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\<numb
Verifies whether a specific PID and UID have the given permission. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | ---------------- |
| permission | string | Yes| Name of the permission to verify.|
| options | [PermissionOptions](#permissionoptions) | No| Permission options.|
| permission | string | Yes | Name of the permission to verify.|
| options | [PermissionOptions](#permissionoptions) | No | Permission options. |
**Return value**
| Type| Description|
| Type | Description |
| ---------------- | ----------------------------------------------------------- |
| Promise\<number> | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
......@@ -160,14 +176,18 @@ requestPermissionsFromUser(permissions: Array\<string>, requestCode: number, res
Requests certain permissions from the system. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- |
| permissions | Array\<string> | Yes| Permissions to request. This parameter cannot be **null**.|
| requestCode | number | Yes| Request code to be passed to **PermissionRequestResult**.|
| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes| Permission request result.|
| permissions | Array\<string> | Yes | Permissions to request. This parameter cannot be **null**. |
| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.|
| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. |
**Example**
```js
......@@ -194,11 +214,15 @@ getApplicationInfo(callback: AsyncCallback\<ApplicationInfo>)
Obtains information about the current application. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------ |
| callback | AsyncCallback\<ApplicationInfo> | Yes| Callback used to return the application information.|
| callback | AsyncCallback\<ApplicationInfo> | Yes | Callback used to return the application information.|
**Example**
......@@ -216,9 +240,13 @@ getApplicationInfo(): Promise\<ApplicationInfo>
Obtains information about the current application. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| ------------------------- | ------------------ |
| Promise\<ApplicationInfo> | Promise used to return the application information.|
......@@ -241,11 +269,15 @@ getBundleName(callback: AsyncCallback\<string>): void
Obtains the bundle name of the current ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ----------------------------- |
| callback | AsyncCallback\<string> | Yes| Callback used to return the bundle name.|
| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.|
**Example**
......@@ -263,9 +295,13 @@ getBundleName(): Promise\<string>
Obtains the bundle name of the current ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| ---------------- | ------------------------- |
| Promise\<string> | Promise used to return the bundle name.|
......@@ -288,11 +324,15 @@ getProcessInfo(callback: AsyncCallback\<ProcessInfo>)
Obtains information about the current process, including the PID and process name. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------- |
| callback | AsyncCallback\<ProcessInfo> | Yes| Callback used to return the process information.|
| callback | AsyncCallback\<ProcessInfo> | Yes | Callback used to return the process information.|
**Example**
......@@ -310,9 +350,13 @@ getProcessInfo(): Promise\<ProcessInfo>
Obtains information about the current process, including the PID and process name. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| --------------------- | -------------- |
| Promise\<ProcessInfo> | Promise used to return the process information.|
......@@ -337,11 +381,15 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth
This method is available only to Page abilities.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------------------------- |
| callback | AsyncCallback\<ElementName> | Yes| Callback used to return the **ohos.bundle.ElementName** object.|
| callback | AsyncCallback\<ElementName> | Yes | Callback used to return the **ohos.bundle.ElementName** object.|
**Example**
......@@ -361,9 +409,13 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth
This method is available only to Page abilities.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| --------------------- | ------------------------------------------ |
| Promise\<ElementName> | Promise used to return the **ohos.bundle.ElementName** object.|
......@@ -384,9 +436,13 @@ getProcessName(callback: AsyncCallback\<string>): void
Obtains the name of the current process. This method uses a callback to return the result.
| Name| Type| Mandatory| Description|
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------- |
| callback | AsyncCallback\<string> | Yes| Callback used to return the process name.|
| callback | AsyncCallback\<string> | Yes | Callback used to return the process name.|
**Example**
......@@ -404,9 +460,13 @@ getProcessName(): Promise\<string>
Obtains the name of the current process. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| ---------------- | -------------------- |
| Promise\<string> | Promise used to return the process name.|
......@@ -429,11 +489,15 @@ getCallingBundle(callback: AsyncCallback\<string>): void
Obtains the bundle name of the calling ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------- |
| callback | AsyncCallback\<string> | Yes| Callback used to return the bundle name.|
| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.|
**Example**
......@@ -451,9 +515,13 @@ getCallingBundle(): Promise\<string>
Obtains the bundle name of the calling ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| Type | Description |
| --------------- | ------------------------- |
| Promise\<string> | Promise used to return the bundle name.|
......@@ -470,15 +538,15 @@ context.getCallingBundle().then((data) => {
## PermissionOptions
| Name| Readable/Writable| Type| Mandatory| Description|
| Name| Readable/Writable| Type | Mandatory| Description |
| ---- | -------- | ------ | ---- | ------ |
| pid | Read-only| number | No| PID.|
| uid | Read-only| number | No| UID.|
| pid | Read-only | number | No | PID.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
| uid | Read-only | number | No | UID.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
## PermissionRequestResult
| Name| Readable/Writable| Type| Mandatory| Description|
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------- | ---- | ------------------ |
| requestCode | Read-only| number | Yes| Request code passed.|
| permissions | Read-only| Array\<string> | Yes| Permissions passed.|
| authResults | Read-only| Array\<number> | Yes| Permission request result.|
| requestCode | Read-only | number | Yes | Request code passed.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
| permissions | Read-only | Array\<string> | Yes | Permissions passed.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core |
| authResults | Read-only | Array\<number> | Yes | Permission request result.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core |
# AbilityContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Implements the ability context. This module is inherited from **Context**.
## Usage
Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**.
```
import Ability from '@ohos.application.Ability'
class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
let context = this.context;
}
}
```
## Attributes
| Name| Type| Readable| Writable| Description|
......@@ -21,6 +38,10 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void
Starts an ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -42,14 +63,53 @@ Starts an ability. This method uses a callback to return the result.
## startAbility
startAbility(want: Want): Promise&lt;void&gt;;
startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void&gt;): void
Starts an ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
- Example
```
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
var options = {
windowMode: 0,
};
this.context.startAbility(want, options, (error) => {
console.log("error.code = " + error.code)
})
```
## startAbility
startAbility(want: Want, options: StartOptions): Promise&lt;void&gt;;
Starts an ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.|
- Return value
| Type| Description|
......@@ -63,7 +123,10 @@ Starts an ability. This method uses a promise to return the result.
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
this.context.startAbility(want)
var options = {
windowMode: 0,
};
this.context.startAbility(want, options)
.then((data) => {
console.log('Operation successful.')
}).catch((error) => {
......@@ -78,11 +141,15 @@ startAbilityForResult(want: Want, callback: AsyncCallback&lt;AbilityResult&gt;):
Starts an ability. This method uses a callback to return the execution result when the ability is terminated.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
| callback | Callback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.|
| callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.|
- Example
......@@ -96,17 +163,55 @@ Starts an ability. This method uses a callback to return the execution result wh
);
```
## startAbilityForResult
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback&lt;AbilityResult&gt;): void;
Starts an ability. This method uses a callback to return the execution result when the ability is terminated.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.|
| callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.|
- Example
```
var options = {
windowMode: 0,
};
this.context.startAbilityForResult(
{bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options,
(error, result) => {
console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code)
console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode)
}
);
```
## startAbilityForResult
startAbilityForResult(want: Want): Promise&lt;AbilityResult&gt;;
startAbilityForResult(want: Want, options: StartOptions): Promise&lt;AbilityResult&gt;;
Starts an ability. This method uses a promise to return the execution result when the ability is terminated.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.|
- Return value
| Type| Description|
......@@ -115,7 +220,10 @@ Starts an ability. This method uses a promise to return the execution result whe
- Example
```
this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}).then((result) => {
var options = {
windowMode: 0,
};
this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options).then((result) => {
console.log("startAbilityForResult Promise.resolve is called, result.resultCode = " + result.resultCode)
}, (error) => {
console.log("startAbilityForResult Promise.Reject is called, error.code = " + error.code)
......@@ -129,16 +237,20 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
Terminates this ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the method is successfully called.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringfy(err);
}
console.log('terminateSelf result:' + JSON.stringfy(err));
});
```
......@@ -148,6 +260,10 @@ terminateSelf(): Promise&lt;void&gt;;
Terminates this ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Return value
| Type| Description|
| -------- | -------- |
......@@ -157,7 +273,7 @@ Terminates this ability. This method uses a promise to return the result.
```
this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
)).catch((error) => {
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
......@@ -169,11 +285,15 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback&lt;voi
Terminates this ability. This method uses a callback to return the information to the caller of **startAbilityForResult**.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
| callback | Callback&lt;void&gt; | No| Callback used to return the information.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
- Example
```
......@@ -194,6 +314,10 @@ terminateSelfWithResult(parameter: AbilityResult): Promise&lt;void&gt;;
Terminates this ability. This method uses a promise to return information to the caller of **startAbilityForResult**.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -215,3 +339,157 @@ Terminates this ability. This method uses a promise to return information to the
}
)
```
## startAbilityByCall
startAbilityByCall(want: Want): Promise&lt;Caller&gt;;
Obtains the caller interface of the specified ability, and if the specified ability is not started, starts the ability in the background.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;&gt; | Promise used to return the caller object to communicate with.|
- Example
```
import Ability from '@ohos.application.Ability';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
}).then((obj) => {
caller = obj;
console.log('Caller GetCaller Get ' + call);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
}
}
```
## requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array&lt;string&gt;, requestCallback: AsyncCallback&lt;PermissionRequestResult&gt;) : void;
Requests permissions from the user by displaying a pop-up window. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | Yes| Permissions to request.|
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.requestPermissionsFromUser(permissions,(result) => {
console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
});
```
## requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array&lt;string&gt;) : Promise&lt;PermissionRequestResult&gt;;
Requests permissions from the user by displaying a pop-up window. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | Yes| Permissions to request.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Promise used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.requestPermissionsFromUser(permissions).then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## setMissionLabel
setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void;
Sets the label of the ability displayed in the task. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| label | string | Yes| Label of the ability to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.setMissionLabel("test",(result) => {
console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
});
```
## setMissionLabel
setMissionLabel(label: string): Promise&lt;void&gt;
Sets the label of the ability displayed in the task. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| label | string | Yes| Label of the ability to set.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.setMissionLabel("test").then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
......@@ -11,4 +11,4 @@ Implements the extension context. This module is inherited from **Context**.
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.|
| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
......@@ -16,13 +16,17 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\<void>: v
Starts a particle ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.FAModel
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------- | ---- | ----------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. |
**Example**
......@@ -53,17 +57,25 @@ particleAbility.startAbility(
## particleAbility.startAbility
**System capabilities**
SystemCapability.Ability.AbilityRuntime.FAModel
startAbility(parameter: StartAbilityParameter): Promise\<number>
Starts a particle ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.FAModel
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------- | ---- | ----------------- |
| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.|
| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.|
**Return value**
| Type| Description|
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
......@@ -99,11 +111,15 @@ terminateSelf(callback: AsyncCallback\<void>): void
Terminates this particle ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.FAModel
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example**
......@@ -124,8 +140,12 @@ terminateSelf(): Promise\<void>
Terminates this particle ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.FAModel
**Return value**
| Type| Description|
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
......@@ -146,15 +166,19 @@ acquireDataAbilityHelper(uri: string): DataAbilityHelper
Obtains a **dataAbilityHelper** object.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.FAModel
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type | Mandatory| Description |
| :--- | ------ | ---- | ------------------------ |
| uri | string | Yes| URI of the file to open.|
| uri | string | Yes | URI of the file to open.|
**Return value**
| Type| Description|
| Type | Description |
| ----------------- | -------------------------------------------- |
| DataAbilityHelper | A utility class used to help other abilities access a Data ability.|
......@@ -168,45 +192,45 @@ particleAbility.acquireDataAbilityHelper(uri)
## StartAbilityParameter
| Name| Readable/Writable| Type| Mandatory| Description|
| Name | Readable/Writable| Type | Mandatory| Description |
| ------------------- | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| want | Read-only| [Want](#want) | Yes| Information about the ability to start.|
| abilityStartSetting | Read-only| {[key: string]: any} | No| Special attribute of the ability to start. This attribute can be passed in the method call.|
| want | Read-only | [Want](#want) | Yes | Information about the ability to start.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel |
| abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel|
## Want
| Name| Readable/Writable| Type| Mandatory| Description|
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | Read-only| string | No| ID of the device running the ability to start.|
| bundleName | Read-only| string | No| Bundle name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.|
| abilityName | Read-only| string | No| Name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.|
| uri | Read-only| string | No| URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | Read-only| string | No| MIME type, for example, **text/plain** or **image/***.|
| flags | Read-only| number | No| How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](#flags).|
| action | Read-only| string | No| Action option.|
| parameters | Read-only| {[key: string]: any} | No| List of parameters in the **Want** object.|
| entities | Read-only| Array\<string> | No| List of entities.|
| deviceId | Read-only | string | No | ID of the device running the ability to start.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| bundleName | Read-only | string | No | Bundle name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase|
| abilityName | Read-only | string | No | Name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase|
| uri | Read-only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase|
| type | Read-only | string | No | MIME type, for example, **text/plain** or **image/***.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| flags | Read-only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](#flags).<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase|
| action | Read-only | string | No | Action option.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| parameters | Read-only | {[key: string]: any} | No | List of parameters in the **Want** object.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| entities | Read-only | Array\<string> | No | List of entities.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
## flags
| Name| Value| Description|
| Name | Value | Description |
| ------------------------------------ | ---------- | ------------------------------------------------------------ |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI.|
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI.|
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability.|
| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be migrated to a remote device.|
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS.|
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates whether to enable an ability.|
| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent.|
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching.|
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler.|
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started.|
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible.|
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed.|
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed.|
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object passed to **ohos.app.Context#startAbility** and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the historical mission stack.|
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.|
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be migrated to a remote device.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates whether to enable an ability.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object passed to **ohos.app.Context#startAbility** and must be used together with **flag_ABILITY_NEW_MISSION**.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the historical mission stack.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityBase|
## AbilityStartSetting
......@@ -214,23 +238,23 @@ The **AbilityStartSetting** attribute is an object defined as [key: string]: any
Defines special attributes of an ability, for example, **featureAbility.AbilityStartSetting.BOUNDS_KEY**.
| Name| Value| Description|
| Name | Value | Description |
| --------------- | --------------- | -------------------------- |
| BOUNDS_KEY | "abilityBounds" | Ability window size.|
| WINDOW_MODE_KEY | "windowMode" | Ability window display mode.|
| DISPLAY_ID_KEY | "displayId" | Display device ID.|
| BOUNDS_KEY | "abilityBounds" | Ability window size.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel |
| WINDOW_MODE_KEY | "windowMode" | Ability window display mode.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel |
| DISPLAY_ID_KEY | "displayId" | Display device ID.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel|
## AbilityWindowConfiguration
Defines the window display modes of a Page ability, for example, **featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED**.
| Name| Value| Description|
| Name | Value| Description |
| --------------------------- | ---- | ---------- |
| WINDOW_MODE_UNDEFINED | 0 | The Page ability is in an undefined window display mode.|
| WINDOW_MODE_FULLSCREEN | 1 | The Page ability is in full screen mode.|
| WINDOW_MODE_SPLIT_PRIMARY | 100 | The Page ability is displayed in the primary window when it is in split-screen mode.|
| WINDOW_MODE_SPLIT_SECONDARY | 101 | The Page ability is displayed in the secondary window when it is in split-screen mode.|
| WINDOW_MODE_FLOATING | 102 | The Page ability is displayed in floating window mode.|
| WINDOW_MODE_UNDEFINED | 0 | The Page ability is in an undefined window display mode.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel |
| WINDOW_MODE_FULLSCREEN | 1 | The Page ability is in full screen mode.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel |
| WINDOW_MODE_SPLIT_PRIMARY | 100 | The Page ability is displayed in the primary window when it is in split-screen mode.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel|
| WINDOW_MODE_SPLIT_SECONDARY | 101 | The Page ability is displayed in the secondary window when it is in split-screen mode.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel|
| WINDOW_MODE_FLOATING | 102 | The Page ability is displayed in floating window mode.<br><b>System capabilities:</b> SystemCapability.Ability.AbilityRuntime.FAModel |
## particleAbility.startBackgroundRunning
......@@ -239,6 +263,10 @@ startBackgroundRunning(id: number, request: NotificationRequest, callback: Async
Requests a continuous task from the system. This method uses an asynchronous callback to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.)
**System capabilities**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
- **Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -295,6 +323,10 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
startBackgroundRunning(id: number, request: NotificationRequest): Promise&lt;void&gt;
**System capabilities**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
Requests a continuous task from the system. This method uses a promise to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.)
**Parameters**
......@@ -304,7 +336,7 @@ Requests a continuous task from the system. This method uses a promise to return
| request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.|
**Return value**
| Type| Description|
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
......@@ -355,6 +387,10 @@ cancelBackgroundRunning(callback: AsyncCallback&lt;void&gt;): void;
Requests to cancel a continuous task from the system. This method uses an asynchronous callback to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.)
**System capabilities**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
- **Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -382,8 +418,12 @@ cancelBackgroundRunning(): Promise&lt;void&gt;;
Requests to cancel a continuous task from the system. This method uses a promise to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.)
**System capabilities**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**Return value**
| Type| Description|
| Type | Description |
| -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result.|
......
......@@ -16,10 +16,14 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
Starts an ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.|
| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to start, such as the ability name and bundle name.|
| callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the method is successfully called.|
- Example
......@@ -40,10 +44,14 @@ startAbility(want: Want): Promise&lt;void&gt;;
Starts an ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.|
| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to start, such as the ability name and bundle name.|
- Return value
| Type| Description|
......@@ -70,6 +78,10 @@ terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
Terminates this ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -89,6 +101,10 @@ terminateSelf(): Promise&lt;void&gt;;
Terminates this ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Return value
| Type| Description|
| -------- | -------- |
......@@ -110,10 +126,14 @@ connectAbility(want: Want, options: ConnectOptions): number;
Connects this ability to a Service ability.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to connect to, such as the ability name and bundle name.|
| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to connect to, such as the ability name and bundle name.|
| options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.|
- Return value
......@@ -142,6 +162,10 @@ disconnectAbility(connection: number, callback:AsyncCallback&lt;void&gt;): void;
Disconnects this ability from the Service ability. This method uses a callback to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -162,6 +186,10 @@ disconnectAbility(connection: number): Promise&lt;void&gt;;
Disconnects this ability from the Service ability. This method uses a promise to return the result.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -171,7 +199,7 @@ Disconnects this ability from the Service ability. This method uses a promise to
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.disconnectAbility(connection).then((data) => { // connection is the return value of connectAbility.
......@@ -188,6 +216,6 @@ Defines the **ConnectOptions** data structure.
| Name| Description|
| -------- | -------- |
| onConnect(elementName:ElementName,&nbsp;remote:IRemoteObject) | Called when this ability is connected to a Service ability.|
| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.|
| onFailed(code:&nbsp;number) | Called when the connection fails.|
| onConnect(elementName:ElementName,&nbsp;remote:IRemoteObject) | Called when this ability is connected to a Service ability.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
| onFailed(code:&nbsp;number) | Called when the connection fails.<br><b>System capabilities: </b>SystemCapability.Ability.AbilityRuntime.Core|
......@@ -32,6 +32,10 @@ onCreate(want: Want): void;
Called when an extension is created to initialize the service logic.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -53,6 +57,10 @@ onDestroy(): void;
Called when this extension is destroyed to clear resources.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Example
```
class ServiceExt extends ServiceExtension {
......@@ -69,6 +77,10 @@ onRequest(want: Want, startId: number): void;
Called after **onCreate** is invoked when an ability is started by calling **startAbility**. The value of **startId** is incremented for each ability that is started.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -91,6 +103,10 @@ onConnect(want: Want): rpc.RemoteObject;
Called after **onCreate** is invoked when an ability is started by calling **connectAbility**. A **RemoteObject** object is returned for communication with the client.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......@@ -126,6 +142,10 @@ onDisconnect(want: Want): void;
Called when the ability is disconnected.
**System capabilities**
SystemCapability.Ability.AbilityRuntime.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
......
# AbilityContext
- [使用说明](#使用说明)
- [属性](#属性)
- [startAbility](#startAbility)
- [startAbility](#startAbility)
- [startAbility](#startAbility)
- [startAbilityForResult](#startAbilityForResult)
- [startAbilityForResult](#startAbilityForResult)
- [startAbilityForResult](#startAbilityForResult)
- [terminateSelf](#terminateSelf)
- [terminateSelf](#terminateSelf)
- [terminateSelfWithResult](#terminateSelfWithResult)
- [terminateSelfWithResult](#terminateSelfWithResult)
- [startAbilityByCall](#startAbilityByCall)
- [requestPermissionsFromUser](#requestPermissionsFromUser)
- [requestPermissionsFromUser](#requestPermissionsFromUser)
- [setMissionLabel](#setMissionLabel)
- [setMissionLabel](#setMissionLabel)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -485,7 +466,7 @@ SystemCapability.Ability.AbilityRuntime.Core
## setMissionLabel
setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void;
setMissionLabel(label: string): Promise&lt;void&gt;
设置ability在任务中显示的名称。
......
......@@ -788,7 +788,7 @@ SystemCapability.Ability.AbilityRuntime.FAModel
**返回值:**
| 类型 | 说明 |
| ---------------- | -------------------------------------------- |
| Promise\<number> | 返回值为Promise对象,Promise中包含应用信息。 |
| Promise\<number> | Promise中包含更新的数据记录数。 。 |
**示例:**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册