未验证 提交 8b758064 编写于 作者: O openharmony_ci 提交者: Gitee

!3242 api文档同步3.1release

Merge pull request !3242 from zengyawen/OpenHarmony-3.1-Release
# APIs
- Ability Framework
- [FeatureAbility Module](js-apis-featureAbility.md)
- [ParticleAbility Module](js-apis-particleAbility.md)
- [DataAbilityHelper Module](js-apis-dataAbilityHelper.md)
- [DataUriUtils Module](js-apis-DataUriUtils.md)
- [Bundle Module](js-apis-Bundle.md)
- [Context Module](js-apis-Context.md)
- Event Notification
- [CommonEvent Module](js-apis-commonEvent.md)
- [Notification Module](js-apis-notification.md)
- [Reminder Agent](js-apis-reminderAgent.md)
- Resource Management
- [Resource Manager](js-apis-resource-manager.md)
- [Internationalization \(intl\) ](js-apis-intl.md)
- [Internationalization \(i18n\) ](js-apis-i18n.md)
- [@ohos.ability.dataUriUtils](js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode](js-apis-ability-errorCode.md)
- [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md)
- [@ohos.application.abilityDelegatorRegistry](js-apis-abilityDelegatorRegistry.md)
- [@ohos.application.appManager](js-apis-appmanager.md)
- [@ohos.application.Configuration](js-apis-configuration.md)
- [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md)
- [@ohos.ability.featureAbility](js-apis-featureAbility.md)
- [@ohos.application.formBindingData](js-apis-formbindingdata.md)
- [@ohos.application.formError](js-apis-formerror.md)
- [@ohos.application.formHost](js-apis-formhost.md)
- [@ohos.application.formInfo](js-apis-formInfo.md)
- [@ohos.application.missionManager](js-apis-missionManager.md)
- [@ohos.application.formProvider](js-apis-formprovider.md)
- [@ohos.ability.particleAbility](js-apis-particleAbility.md)
- [@ohos.application.Want](js-apis-application-Want.md)
- [@ohos.wantAgent](js-apis-wantAgent.md)
- ability/[dataAbilityHelper](js-apis-dataAbilityHelper.md)
- app/[context](js-apis-Context.md)
- application/[abilityDelegator](js-apis-application-abilityDelegator.md)
- application/[abilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md)
- application/[AbilityRunningInfo](js-apis-abilityrunninginfo.md)
- application/[ExtensionContext](js-apis-extension-context.md)
- application/[ExtensionRunningInfo](js-apis-extensionrunninginfo.md)
- application/[FormExtensionContext](js-apis-formextensioncontext.md)
- application/[MissionSnapshot](js-apis-application-MissionSnapshot.md)
- application/[ProcessRunningInfo](js-apis-processrunninginfo.md)
- application/[ServiceExtensionContext](js-apis-service-extension-context.md)
- application/[shellCmdResult](js-apis-application-shellCmdResult.md)
- Common Event and Notification
- [@ohos.commonEvent](js-apis-commonEvent.md)
- [@ohos.events.emitter](js-apis-emitter.md)
- [@ohos.notification](js-apis-notification.md)
- [@ohos.reminderAgent](js-apis-reminderAgent.md)
- Bundle Management
- [@ohos.bundle](js-apis-Bundle.md)
- [@ohos.bundleState ](js-apis-deviceUsageStatistics.md)
- [@ohos.zlib](js-apis-zlib.md)
- UI Page
- [@ohos.animator](js-apis-animator.md)
- [@ohos.mediaquery](js-apis-mediaquery.md)
- [@ohos.prompt](js-apis-prompt.md)
- [@ohos.router](js-apis-router.md)
- Graphics
- [@ohos.display ](js-apis-display.md)
- [@ohos.screenshot](js-apis-screenshot.md)
- [@ohos.window](js-apis-window.md)
- [webgl](js-apis-webgl.md)
- [webgl2](js-apis-webgl2.md)
- Media
- [Audio Management](js-apis-audio.md)
- [Media](js-apis-media.md)
- [Image Processing](js-apis-image.md)
- [Camera](js-apis-camera.md)
- [@ohos.multimedia.audio](js-apis-audio.md)
- [@ohos.multimedia.image](js-apis-image.md)
- [@ohos.multimedia.media](js-apis-media.md)
- [@ohos.multimedia.medialibrary](js-apis-medialibrary.md)
- Resource Management
- [@ohos.i18n](js-apis-i18n.md)
- [@ohos.intl](js-apis-intl.md)
- [@ohos.resourceManager](js-apis-resource-manager.md)
- Resource Scheduling
- [@ohos.backgroundTaskManager](js-apis-backgroundTaskManager.md)
- Custom Management
- [@ohos.configPolicy](js-apis-config-policy.md)
- Security
- [User Authentication](js-apis-useriam-userauth.md)
- [Access Control](js-apis-abilityAccessCtrl.md)
- [@ohos.abilityAccessCtrl](js-apis-abilityAccessCtrl.md)
- [@ohos.security.huks ](js-apis-huks.md)
- [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md)
- [@system.cipher](js-apis-system-cipher.md)
- Data Management
- [Lightweight Storage](js-apis-data-storage.md)
- [Distributed Data Management](js-apis-distributed-data.md)
- [Relational Database](js-apis-data-rdb.md)
- [Result Set](js-apis-data-resultset.md)
- [DataAbilityPredicates](js-apis-data-ability.md)
- [Settings](js-apis-settings.md)
- [@ohos.data.dataAbility ](js-apis-data-ability.md)
- [@ohos.data.distributedData](js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject](js-apis-data-distributedobject.md)
- [@ohos.data.rdb](js-apis-data-rdb.md)
- [@ohos.settings](js-apis-settings.md)
- data/rdb/[resultSet](js-apis-data-resultset.md)
- File Management
- [File Management](js-apis-fileio.md)
- [Statfs](js-apis-statfs.md)
- [Environment](js-apis-environment.md)
- [Public File Access and Management](js-apis-filemanager.md)
- [App Storage Statistics](js-apis-storage-statistics.md)
- Account Management
- [OS Account Management](js-apis-osAccount.md)
- [Distributed Account Management](js-apis-distributed-account.md)
- [App Account Management](js-apis-appAccount.md)
- [@ohos.environment](js-apis-environment.md)
- [@ohos.fileio](js-apis-fileio.md)
- [@ohos.fileManager](js-apis-filemanager.md)
- [@ohos.statfs](js-apis-statfs.md)
- [@ohos.storageStatistics](js-apis-storage-statistics.md)
- Telephony Service
- [Call](js-apis-call.md)
- [SMS](js-apis-sms.md)
- [SIM Management](js-apis-sim.md)
- [Radio](js-apis-radio.md)
- [Observer](js-apis-observer.md)
- [Cellular Data](js-apis-telephony-data.md)
- [@ohos.contact](js-apis-contact.md)
- [@ohos.telephony.call](js-apis-call.md)
- [@ohos.telephony.observer](js-apis-observer.md)
- [@ohos.telephony.radio](js-apis-radio.md)
- [@ohos.telephony.sim](js-apis-sim.md)
- [@ohos.telephony.sms](js-apis-sms.md)
- [@ohos.telephony.data](js-apis-telephony-data.md)
- Network Management
- [Network Connection Management](js-apis-net-connection.md)
- [Socket Connection](js-apis-socket.md)
- [WebSocket Connection](js-apis-webSocket.md)
- [Data Request](js-apis-http.md)
- Network and Connectivity
- [WLAN](js-apis-wifi.md)
- [Bluetooth](js-apis-bluetooth.md)
- [RPC](js-apis-rpc.md)
- [Upload and Download](js-apis-request.md)
- Device Management
- [Sensor](js-apis-sensor.md)
- [Vibrator](js-apis-vibrator.md)
- [Brightness](js-apis-brightness.md)
- [Battery Info](js-apis-battery-info.md)
- [Power Management](js-apis-power.md)
- [Thermal Management](js-apis-thermal.md)
- [Running Lock](js-apis-runninglock.md)
- [Device Info](js-apis-device-info.md)
- [systemParameter](js-apis-system-parameter.md)
- [Device Management](js-apis-device-manager.md)
- [Window](js-apis-window.md)
- [Display](js-apis-display.md)
- [Update](js-apis-update.md)
- [USB](js-apis-usb.md)
- [Location](js-apis-geolocation.md)
- [@ohos.net.connection](js-apis-net-connection.md)
- [@ohos.net.http](js-apis-http.md)
- [@ohos.request](js-apis-request.md)
- [@ohos.net.socket](js-apis-socket.md)
- [@ohos.net.webSocket](js-apis-webSocket.md)
- Connectivity
- [@ohos.bluetooth](js-apis-bluetooth.md)
- [@ohos.connectedTag](js-apis-connectedTag.md)
- [@ohos.rpc](js-apis-rpc.md)
- [@ohos.wifi](js-apis-wifi.md)
- [@ohos.wifiext](js-apis-wifiext.md)
- Basic Features
- [Application Context](js-apis-basic-features-app-context.md)
- [Console Logs](js-apis-basic-features-logs.md)
- [Page Routing](js-apis-basic-features-routes.md)
- [Timer](js-apis-basic-features-timer.md)
- [Screen Lock Management](js-apis-screen-lock.md)
- [Setting the System Time](js-apis-system-time.md)
- [Wallpaper](js-apis-wallpaper.md)
- [Pasteboard](js-apis-pasteboard.md)
- [Animation](js-apis-basic-features-animator.md)
- [WebGL](js-apis-webgl.md)
- [WebGL2](js-apis-webgl2.md)
- [Screenshot](js-apis-screenshot.md)
- [Accessibility](js-apis-accessibility.md)
- DFX
- [HiAppEvent](js-apis-hiappevent.md)
- [Performance Tracing](js-apis-hitracemeter.md)
- [Fault Logger](js-apis-faultLogger.md)
- [Distributed Call Chain Tracing](js-apis-hitracechain.md)
- [HiLog](js-apis-hilog.md)
- [HiChecker](js-apis-hichecker.md)
- [HiDebug](js-apis-hidebug.md)
- [@ohos.accessibility](js-apis-accessibility.md)
- [@ohos.faultLogger](js-apis-faultLogger.md)
- [@ohos.hiAppEvent](js-apis-hiappevent.md)
- [@ohos.hichecker](js-apis-hichecker.md)
- [@ohos.hidebug](js-apis-hidebug.md)
- [@ohos.hilog](js-apis-hilog.md)
- [@ohos.hiTraceChain](js-apis-hitracechain.md)
- [@ohos.hiTraceMeter](js-apis-hitracemeter.md)
- [@ohos.inputMethod](js-apis-inputmethod.md)
- [@ohos.inputMethodEngine](js-apis-inputmethodengine.md)
- [@ohos.pasteboard](js-apis-pasteboard.md)
- [@ohos.screenLock](js-apis-screen-lock.md)
- [@ohos.systemTime](js-apis-system-time.md)
- [@ohos.wallpaper](js-apis-wallpaper.md)
- [Timer](js-apis-timer.md)
- Device Management
- [@ohos.batteryInfo ](js-apis-battery-info.md)
- [@ohos.brightness](js-apis-brightness.md)
- [@ohos.deviceInfo](js-apis-device-info.md)
- [@ohos.distributedHardware.deviceManager](js-apis-device-manager.md)
- [@ohos.geolocation](js-apis-geolocation.md)
- [@ohos.multimodalInput.inputConsumer](js-apis-inputconsumer.md)
- [@ohos.multimodalInput.inputDevice](js-apis-inputdevice.md)
- [@ohos.multimodalInput.inputEventClient](js-apis-inputeventclient.md)
- [@ohos.multimodalInput.inputMonitor](js-apis-inputmonitor.md)
- [@ohos.power](js-apis-power.md)
- [@ohos.runningLock](js-apis-runninglock.md)
- [@ohos.sensor](js-apis-sensor.md)
- [@ohos.systemParameter](js-apis-system-parameter.md)
- [@ohos.thermal](js-apis-thermal.md)
- [@ohos.update](js-apis-update.md)
- [@ohos.usb](js-apis-usb.md)
- [@ohos.vibrator](js-apis-vibrator.md)
- Account Management
- [@ohos.account.appAccount](js-apis-appAccount.md)
- [@ohos.account.distributedAccount](js-apis-distributed-account.md)
- [@ohos.account.osAccount](js-apis-osAccount.md)
- Language Base Class Library
- [Obtaining Process Information](js-apis-process.md)
- [URL String Parsing](js-apis-url.md)
- [URI String Parsing](js-apis-uri.md)
- [Util](js-apis-util.md)
- [XML Parsing and Generation](js-apis-xml.md)
- [XML-to-JavaScript Conversion](js-apis-convertxml.md)
- [Worker Startup](js-apis-worker.md)
- [Linear Container ArrayList](js-apis-arraylist.md)
- [Linear Container Deque](js-apis-deque.md)
- [Linear Container List](js-apis-list.md)
- [Linear Container LinkedList](js-apis-linkedlist.md)
- [Linear Container Queue](js-apis-queue.md)
- [Linear Container Stack](js-apis-stack.md)
- [Linear Container Vector](js-apis-vector.md)
- [Nonlinear Container HashSet](js-apis-hashset.md)
- [Nonlinear Container HashMap](js-apis-hashmap.md)
- [Nonlinear Container PlainArray](js-apis-plainarray.md)
- [Nonlinear Container TreeMap](js-apis-treemap.md)
- [Nonlinear Container TreeSet](js-apis-treeset.md)
- [Nonlinear Container LightWeightMap](js-apis-lightweightmap.md)
- [Nonlinear Container LightWeightSet](js-apis-lightweightset.md)
- Custom Management
- [Configuration Policy](js-apis-config-policy.md)
- [@ohos.convertxml](js-apis-convertxml.md)
- [@ohos.process](js-apis-process.md)
- [@ohos.uri](js-apis-uri.md)
- [@ohos.url](js-apis-url.md)
- [@ohos.util](js-apis-util.md)
- [@ohos.util.ArrayList](js-apis-arraylist.md)
- [@ohos.util.Deque](js-apis-deque.md)
- [@ohos.util.HashMap](js-apis-hashmap.md)
- [@ohos.util.HashSet](js-apis-hashset.md)
- [@ohos.util.LightWeightMap](js-apis-lightweightmap.md)
- [@ohos.util.LightWeightSet](js-apis-lightweightset.md)
- [@ohos.util.LinkedList](js-apis-linkedlist.md)
- [@ohos.util.List](js-apis-list.md)
- [@ohos.util.PlainArray](js-apis-plainarray.md)
- [@ohos.util.Queue](js-apis-queue.md)
- [@ohos.util.Stack](js-apis-stack.md)
- [@ohos.util.TreeMap](js-apis-treemap.md)
- [@ohos.util.TreeSet](js-apis-treeset.md)
- [@ohos.util.Vector](js-apis-vector.md)
- [@ohos.worker](js-apis-worker.md)
- [@ohos.xml](js-apis-xml.md)
- Test
- [@ohos.application.testRunner](js-apis-testRunner.md)
- [@ohos.uitest](js-apis-uitest.md)
- APIs No Longer Maintained
- [@ohos.bytrace](js-apis-bytrace.md)
- [@system.app](js-apis-system-app.md)
- [@system.battery](js-apis-system-battery.md)
- [@system.brightness](js-apis-system-brightness.md)
- [@system.configuration](js-apis-system-configuration.md)
- [@system.device](js-apis-system-device.md)
- [@system.fetch](js-apis-system-fetch.md)
- [@system.file](js-apis-system-file.md)
- [@system.geolocation](js-apis-system-location.md)
- [@system.mediaquery](js-apis-system-mediaquery.md)
- [@system.network](js-apis-system-network.md)
- [@system.package](js-apis-system-package.md)
- [@system.prompt](js-apis-system-prompt.md)
- [@system.request](js-apis-system-request.md)
- [@system.router](js-apis-system-router.md)
- [@system.sensor](js-apis-system-sensor.md)
- [@system.storage](js-apis-system-storage.md)
- [@system.vibrator](js-apis-system-vibrate.md)
- [console](js-apis-logs.md)
\ No newline at end of file
......@@ -880,9 +880,9 @@ Obtains the context of the application.
**Return value**
| Parameters | Type | Description |
| --------------- | ------------------------- |------ |
| Context | Context |Application context.|
| Type | Description |
| --------- |------ |
| Context |Application context.|
**Example**
......@@ -908,7 +908,7 @@ var context = featureAbility.getContext().getApplicationContext();
| ----------- | -------- | -------------- | ---- | ------------------ |
| requestCode | Read-only | number | Yes | Request code passed.|
| permissions | Read-only | Array\<string> | Yes | Permissions requested. |
| authResults | Read-only | Array\<number> | Yes | Permission request result. |
| authResults | Read-only | Array\<number> | Yes | Permission request result. |
## HapModuleInfo
......
# AbilityContext
> ![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**.
```js
import Ability from '@ohos.application.Ability'
class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
let context = this.context;
}
}
```
## Attributes
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| abilityInfo | AbilityInfo | Yes| No| Ability information.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityContext.startAbility
startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void
Starts an ability. This API uses a callback to return the result.
**System capability**: 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 | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
```js
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
this.context.startAbility(want, (error) => {
console.log("error.code = " + error.code)
})
```
## AbilityContext.startAbility
startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void&gt;): void
Starts an ability. This API uses a callback to return the result.
**System capability**: 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**
```js
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)
})
```
## AbilityContext.startAbility
startAbility(want: Want, options?: StartOptions): Promise&lt;void&gt;;
Starts an ability. This API uses a promise to return the result.
**System capability**: 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 | No| Parameters used for starting the ability.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```js
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
var options = {
windowMode: 0,
};
this.context.startAbility(want, options)
.then((data) => {
console.log('Operation successful.')
}).catch((error) => {
console.log('Operation failed.');
})
```
## AbilityContext.startAbilityForResult
startAbilityForResult(want: Want, callback: AsyncCallback&lt;AbilityResult&gt;): void;
Starts an ability. This API uses a callback to return the execution result when the ability is terminated.
**System capability**: 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 | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.|
**Example**
```js
this.context.startAbilityForResult(
{bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"},
(error, result) => {
console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code)
console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode)
}
);
```
## AbilityContext.startAbilityForResult
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback&lt;AbilityResult&gt;): void;
Starts an ability. This API uses a callback to return the execution result when the ability is terminated.
**System capability**: 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**
```js
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)
}
);
```
## AbilityContext.startAbilityForResult
startAbilityForResult(want: Want, options?: StartOptions): Promise&lt;AbilityResult&gt;;
Starts an ability. This API uses a promise to return the execution result when the ability is terminated.
**System capability**: 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 | No| Parameters used for starting the ability.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Promise used to return the result.|
**Example**
```js
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)
})
```
## AbilityContext.terminateSelf
terminateSelf(callback: AsyncCallback&lt;void&gt;): void;
Terminates this ability. This API uses a callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.|
**Example**
```js
this.context.terminateSelf((err) => {
console.log('terminateSelf result:' + JSON.stringfy(err));
});
```
## AbilityContext.terminateSelf
terminateSelf(): Promise&lt;void&gt;;
Terminates this ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example**
```js
this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## AbilityContext.terminateSelfWithResult
terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback&lt;void&gt;): void;
Terminates this ability. This API uses a callback to return the information to the caller of **startAbilityForResult**.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example**
```js
this.context.terminateSelfWithResult(
{
want: {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo"},
resultCode: 100
}, (error) => {
console.log("terminateSelfWithResult is called = " + error.code)
}
);
```
## AbilityContext.terminateSelfWithResult
terminateSelfWithResult(parameter: AbilityResult): Promise&lt;void&gt;;
Terminates this ability. This API uses a promise to return information to the caller of **startAbilityForResult**.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```js
this.context.terminateSelfWithResult(
{
want: {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo"},
resultCode: 100
}).then((result) => {
console.log("terminateSelfWithResult")
}
)
```
## AbilityContext.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 capability**: 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;Caller&gt; | Promise used to return the caller object to communicate with.|
**Example**
```js
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);
});
}
}
```
## AbilityContext.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 API uses a callback to return the result.
**System capability**: 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 API is successfully called.|
**Example**
```
this.context.requestPermissionsFromUser(permissions,(result) => {
console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
});
```
## AbilityContext.requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array&lt;string&gt;) : Promise&lt;PermissionRequestResult&gt;;
Requests permissions from the user by displaying a pop-up window. This API uses a promise to return the result.
**System capability**: 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 API is successfully called.|
**Example**
```
this.context.requestPermissionsFromUser(permissions).then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
## AbilityContext.setMissionLabel
setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void;
Sets the label of the ability displayed in the task. This API uses a callback to return the result.
**System capability**: 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 API is successfully called.|
**Example**
```js
this.context.setMissionLabel("test",(result) => {
console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
});
```
## AbilityContext.setMissionLabel
setMissionLabel(label: string): Promise&lt;void&gt;
Sets the label of the ability displayed in the task. This API uses a promise to return the result.
**System capability**: 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 API is successfully called.|
**Example**
```js
this.context.setMissionLabel("test").then((data) => {
console.log('success:' + JSON.stringfy(data));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
# ErrorCode
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
import errorCode from '@ohos.ability.errorCode'
```
## ErrorCode
Defines the error code used when the ability is started.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description |
| ------------------------------ | ---- | ---------------------------------------- |
| NO_ERROR | 0 | No error occurs. |
| INVALID_PARAMETER | -1 | Invalid parameter.|
| ABILITY_NOT_FOUND | -2 | The ability is not found.|
| PERMISSION_DENY | -3 | Permission denied. |
# wantConstant
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
import wantConstant from '@ohos.ability.wantConstant'
```
## wantConstant.Action
**System capability**: SystemCapability.Ability.AbilityBase
Lists the permissions.
| Common Event Macro | Common Event Name | Subscriber Permission |
| ------------ | ------------------ | ---------------------- |
| ACTION_HOME | ohos.want.action.home | None |
| ACTION_DIAL | ohos.want.action.dial | None |
| ACTION_SEARCH | ohos.want.action.search | None |
| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None |
| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None |
| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None |
| ACTION_SET_ALARM | ohos.want.action.setAlarm | None |
| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None |
| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None |
| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None |
| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None |
| ACTION_SEND_SMS | ohos.want.action.sendSms | None |
| ACTION_CHOOSE | ohos.want.action.choose | None |
| ACTION_IMAGE_CAPTURE<sup>8+</sup> | ohos.want.action.imageCapture | None |
| ACTION_VIDEO_CAPTUR<sup>8+</sup> | ohos.want.action.videoCapture | None |
| ACTION_SELECT | ohos.want.action.select | None |
| ACTION_SEND_DATA | ohos.want.action.sendData | None |
| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None |
| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None |
| ACTION_VIEW_DATA | ohos.want.action.viewData | None |
| ACTION_EDIT_DATA | ohos.want.action.editData | None |
| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None |
| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None |
| ACTION_FILE_SELECT<sup>7+</sup> | ohos.action.fileSelect | None |
| PARAMS_STREAM<sup>7+</sup> | ability.params.stream | None |
| ACTION_APP_ACCOUNT_OAUTH <sup>8+</sup> | ohos.account.appAccount.action.oauth | None |
## wantConstant.Entity
**System capability**: SystemCapability.Ability.AbilityBase
Lists the permissions.
| Common Event Macro | Common Event Name | Subscriber Permission |
| ------------ | ------------------ | ---------------------- |
| ENTITY_DEFAULT | entity.system.default | None |
| ENTITY_HOME | entity.system.homel | None |
| ENTITY_VOICE | ENTITY_VOICE | None |
| ENTITY_BROWSABLE | entity.system.browsable | None |
| ENTITY_VIDEO | entity.system.video | None |
| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None |
## flags
**System capability**: SystemCapability.Ability.AbilityBase
| 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 continued on a remote device. |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. |
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. |
| 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 ability continuation 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 in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history 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.|
......@@ -204,6 +204,8 @@ getPermissionFlags(tokenID: number, permissionName: string): Promise&lt;number&g
Obtains the flags of the specified permission of a given application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_SENSITIVE_PERMISSIONS, GRANT_SENSITIVE_PERMISSIONS, or REVOKE_SENSITIVE_PERMISSIONS
**System capability**: SystemCapability.Security.AccessToken
**Parameters**
......@@ -234,7 +236,7 @@ promise.then(data => {
Enumerates the permission grant states.
**System capability:** SystemCapability.Security.AccessToken
**System capability**: SystemCapability.Security.AccessToken
| Name | Default Value | Description |
| ----------------------------- | ---------------------- | ----------------------- |
......
# AbilityDelegatorRegistry
> **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.
## Modules to Import
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
## AbilityLifecycleState
Enumerates the ability lifecycle states.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description |
| ------------- | ---- | --------------------------- |
| UNINITIALIZED | 0 | The ability is in an invalid state. |
| CREATE | 1 | The ability is created.|
| FOREGROUND | 2 | The ability is running in the foreground. |
| BACKGROUND | 3 | The ability is running in the background. |
| DESTROY | 4 | The ability is destroyed.|
## AbilityDelegatorRegistry.getAbilityDelegator
getAbilityDelegator(): AbilityDelegator
Obtains the **AbilityDelegator** object of the application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework.|
**Example**
```js
var abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
```
## AbilityDelegatorRegistry.getArguments
getArguments(): AbilityDelegatorArgs
Obtains the **AbilityDelegatorArgs** object of the application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters.|
**Example**
```js
var args = AbilityDelegatorRegistry.getArguments();
console.info("getArguments bundleName:" + args.bundleName);
console.info("getArguments testCaseNames:" + args.testCaseNames);
console.info("getArguments testRunnerClassName:" + args.testRunnerClassName);
```
......@@ -22,6 +22,7 @@ abilitymanager.getAbilityRunningInfos((err,data) => {
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
......@@ -31,10 +32,11 @@ abilitymanager.getAbilityRunningInfos((err,data) => {
| uid | number | Yes| No| User ID. |
| processName | string | Yes| No| Process name. |
| startTime | number | Yes| No| Ability start time. |
| abilityState | [abilityManager.AbilityState](#abilitymanager-abilitystate) | Yes| No| Ability state. |
| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. |
## abilityManager.AbilityState
Enumerates the ability states.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
# AbilityStageContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md).
## Usage
The ability stage context is obtained through an **AbilityStage** instance.
```js
import AbilityStage from '@ohos.application.AbilityStage';
class MyAbilityStage extends AbilityStage {
onCreate() {
let abilityStageContext = this.context;
}
}
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| currentHapModuleInfo | HapModuleInfo | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.|
| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running.|
# MissionSnapshot
> **NOTE**
> The initial APIs of this module are supported since API 8.
> ![icon-note.gif](public_sys-resources/icon-note.gif)**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.
Provides snapshot of a mission.
......@@ -10,8 +10,6 @@ Provides snapshot of a mission.
## Modules to Import
Import ElementName and image before use.
```
import { ElementName } from '../bundle/elementName';
......
# Want
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
**Want** is the basic communication component of the system.
## Modules to Import
```
import Want from '@ohos.application.Want';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | Read only | string | No | ID of the device running the ability. |
| bundleName | Read only | string | No | Bundle name of the ability. 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. 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](js-apis-featureAbility.md#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. | |
# Ability
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The 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.
Manages the ability lifecycle and context.
## Modules to Import
```
import Ability from '@ohos.application.Ability';
```
## Attributes
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore|
| launchWant | [Want](js-apis-featureAbility.md#Want)| Yes| No| Parameters for starting the ability.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore|
| lastRequestWant | [Want](js-apis-featureAbility.md#Want)| Yes| No| Parameters used when the ability was started last time.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore|
## Ability.onCreate
onCreate(want: Want, param: AbilityConstant.LaunchParam): void;
Called to initialize the service logic when an ability is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this ability, including the ability name and bundle name.|
| param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
**Example**
```js
class myAbility extends Ability {
onCreate(want, param) {
console.log('onCreate, want:' + want.abilityName);
}
}
```
## Ability.onWindowStageCreate
onWindowStageCreate(windowStage: window.WindowStage): void
Called when a **WindowStage** is created for this ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example**
```js
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
}
}
```
## Ability.onWindowStageDestroy
onWindowStageDestroy(): void
Called when the **WindowStage** is destroyed for this ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example**
```js
class myAbility extends Ability {
onWindowStageDestroy() {
console.log('onWindowStageDestroy');
}
}
```
## Ability.onWindowStageRestore
onWindowStageRestore(windowStage: window.WindowStage): void
Called when the **WindowStage** is restored during the migration of this ability, which is a multi-instance ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example**
```js
class myAbility extends Ability {
onWindowStageRestore(windowStage) {
console.log('onWindowStageRestore');
}
}
```
## Ability.onDestroy
onDestroy(): void;
Called when this ability is destroyed to clear resources.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example**
```js
class myAbility extends Ability {
onDestroy() {
console.log('onDestroy');
}
}
```
## Ability.onForeground
onForeground(): void;
Called when this ability is running in the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example**
```js
class myAbility extends Ability {
onForeground() {
console.log('onForeground');
}
}
```
## Ability.onBackground
onBackground(): void;
Callback when this ability is switched to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example**
```js
class myAbility extends Ability {
onBackground() {
console.log('onBackground');
}
}
```
## Ability.onContinue
onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;
Called to save data during the ability migration preparation process.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes| **want** parameter.|
**Return value**
| Type| Description|
| -------- | -------- |
| AbilityConstant.OnContinueResult | Continuation result.|
**Example**
```js
class myAbility extends Ability {
onContinue(wantParams) {
console.log('onContinue');
wantParams["myData"] = "my1234567";
return true;
}
}
```
## Ability.onNewWant
onNewWant(want: Want): void;
Called when the ability startup mode is set to singleton.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Want parameters, such as the ability name and bundle name.|
**Example**
```js
class myAbility extends Ability {
onNewWant(want) {
console.log('onNewWant, want:' + want.abilityName);
}
}
```
## Ability.onConfigurationUpdated
onConfigurationUpdated(config: Configuration): void;
Called when the configuration of the environment where the ability is running is updated.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| config | [Configuration](#section188911144124715) | Yes| New configuration.|
**Example**
```js
class myAbility extends Ability {
onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, config:' + JSON.stringify(config));
}
}
```
## Caller
Implements sending of sequenceable data to the target ability when an ability (caller) invokes the target ability (callee).
## Caller.call
call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;;
Sends sequenceable data to the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return a response.|
**Example**
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{ // Custom sequenceable data structure
constructor(name, str) {
this.name = name;
this.str = str;
}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
var method = 'call_Function'; // Notification message string negotiated by the two abilities
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;
let msg = new MyMessageAble(1, "world"); // See the definition of Sequenceable.
caller.call(method, msg)
.then(() => {
console.log('Caller call() called');
}).catch((e) => {
console.log('Caller call() catch error ' + e);
});
console.log('Caller GetCaller Get ' + caller);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
}
}
```
## Caller.callWithResult
callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessageParcel&gt;;
Sends sequenceable data to the target ability and obtains the sequenceable data returned by the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability.|
**Example**
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{
constructor(name, str) {
this.name = name;
this.str = str;
}
constructor() {}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
var method = 'call_Function';
var caller;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
abilityName: "com.example.myservice.MainAbility",
deviceId: ""
}).then((obj) => {
caller = obj;
let msg = new MyMessageAble(1, "world");
caller.callWithResult(method, msg)
.then((data) => {
console.log('Caller callWithResult() called');
let retmsg = new MyMessageAble(0, "");
data.readSequenceable(retmsg);
}).catch((e) => {
console.log('Caller callWithResult() catch error ' + e);
});
console.log('Caller GetCaller Get ' + caller);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
}
}
```
## Caller.release
release(): void;
Releases the caller interface of the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example**
```js
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;
try {
caller.release();
} catch (e) {
console.log('Caller Release error ' + e);
}
console.log('Caller GetCaller Get ' + caller);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
}
}
```
## Caller.onRelease
onRelease(callback: OnReleaseCallBack): void;
Registers a callback that is invoked when the Stub on the target ability is disconnected.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
**Example**
```js
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;
try {
caller.onRelease((str) => {
console.log(' Caller OnRelease CallBack is called ' + str);
});
} catch (e) {
console.log('Caller Release error ' + e);
}
console.log('Caller GetCaller Get ' + caller);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
}
}
```
## Callee
Implements callbacks for caller notification registration and unregistration.
## Callee.on
on(method: string, callback: CaleeCallBack): void;
Registers a caller notification callback, which is invoked when the target ability registers a function.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities.|
| callback | CaleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
**Example**
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{
constructor(name, str) {
this.name = name;
this.str = str;
}
marshalling(messageParcel) {
messageParcel.writeInt(this.num);
messageParcel.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
unmarshalling(messageParcel) {
this.num = messageParcel.readInt();
this.str = messageParcel.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
};
var method = 'call_Function';
function funcCallBack(pdata) {
console.log('Callee funcCallBack is called ' + pdata);
let msg = new MyMessageAble(0, "");
pdata.readSequenceable(msg);
return new MyMessageAble(10, "Callee test");
}
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
this.callee.on(method, funcCallBack);
}
}
```
## Callee.off
off(method: string): void;
Unregisters a caller notification callback, which is invoked when the target ability registers a function.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Registered notification message string.|
**Example**
```js
import Ability from '@ohos.application.Ability';
var method = 'call_Function';
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
this.callee.off(method);
}
}
```
## OnReleaseCallBack
(msg: string): void;
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore |
## CaleeCallBack
(indata: rpc.MessageParcel): rpc.Sequenceable;
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore |
# AbilityConstant
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 9.
Provides parameters related to ability launch.
## Modules to Import
```js
import AbilityConstant from '@ohos.application.AbilityConstant';
```
## Attributes
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| launchReason | LaunchReason| Yes| Yes| Ability launch reason.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityConstant.LaunchReason
Enumerates ability launch reasons.
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| START_ABILITY | 1 | Ability startup.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| CALL | 2 | Call.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| CONTINUATION | 3 | Ability continuation.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityConstant.LaunchReason
Enumerates reasons for the last exit.
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| NORMAL | 2 | Normal status.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityConstant.OnContinueResult
Enumerates ability continuation results.
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| AGREE | 0 | Continuation agreed.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| REJECT | 1 | Continuation denied.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| MISMATCH | 2 | Mismatch.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
# AbilityDelegator
> **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.
## Modules to Import
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
## AbilityDelegator
### startAbility
startAbility(want: Want, callback: AsyncCallback\<void>): void
Starts an ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------ |
| want | [Want](js-apis-featureAbility.md#Want) | Yes | **Want** parameter for starting the ability. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example**
```js
var abilityDelegator;
var want = {
bundleName: "bundleName",
abilityName: "abilityName"
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.startAbility(want, (err, data) => {
console.info("startAbility callback");
});
```
### startAbility
startAbility(want: Want): Promise\<void>
Starts an ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------- | ---- | --------------- |
| want | [Want](js-apis-featureAbility.md#Want) | Yes | **Want** parameter for starting the ability.|
**Return value**
| Type | Description |
| -------------- | ------------------- |
| Promise\<void> | Promise used to return the result.|
**Example**
```js
var abilityDelegator;
var want = {
bundleName: "bundleName",
abilityName: "abilityName"
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.startAbility(want).then((data: any) => {
console.info("startAbility promise");
});
```
### print
print(msg: string, callback: AsyncCallback\<void>): void
Prints log information to the unit test console. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ------------------ |
| msg | string | Yes | Log string. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example**
```js
var abilityDelegator;
var msg = "msg";
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.print(msg, (err) => {
console.info("print callback");
});
```
### print
print(msg: string): Promise\<void>
Prints log information to the unit test console. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------- |
| msg | string | Yes | Log string.|
**Return value**
| Type | Description |
| -------------- | ------------------- |
| Promise\<void> | Promise used to return the result.|
**Example**
```js
var abilityDelegator;
var msg = "msg";
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.print(msg).then(() => {
console.info("print promise");
});
```
### executeShellCommand
executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void
Executes a shell command. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------ |
| cmd | string | Yes | Shell command string. |
| callback | AsyncCallback\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Yes | Callback used to return a [ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult) object.|
**Example**
```js
var abilityDelegator;
var cmd = "cmd";
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info("executeShellCommand callback");
});
```
### executeShellCommand
executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<ShellCmdResult>): void
Executes a shell command with the timeout period specified. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------------------------------------------------ | ---- | ----------------------------- |
| cmd | string | Yes | Shell command string. |
| timeoutSecs | number | Yes | Command timeout period, in seconds.|
| callback | AsyncCallback\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Yes | Callback used to return a [ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult) object. |
**Example**
```js
var abilityDelegator;
var cmd = "cmd";
var timeout = 100;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, timeout, (err, data) => {
console.info("executeShellCommand callback");
});
```
### executeShellCommand
executeShellCommand(cmd: string, timeoutSecs: number): Promise\<ShellCmdResult>
Executes a shell command with the timeout period specified. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ----------------------------- |
| cmd | string | Yes | Shell command string. |
| timeoutSecs | number | No | Command timeout period, in seconds.|
**Return value**
| Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| Promise\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Promise used to return a [ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult) object.|
**Example**
```js
var abilityDelegator;
var cmd = "cmd";
var timeout = 100;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.executeShellCommand(cmd, timeout).then((data : any) => {
console.info("executeShellCommand promise");
});
```
# AbilityDelegatorArgs
> **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.
## Modules to Import
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
## AbilityDelegatorArgs
Describes the test parameters.
| Name | Type | Readable| Writable| Description |
| ------------------- | ---------------------- | ---- | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Yes | Bundle name of the application to test.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| parameters | {[key:string]: string} | Yes | Yes | Parameters of the unit test that is started currently.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| testCaseNames | string | Yes | Yes | Test case names.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| testRunnerClassName | string | Yes | Yes | Names of the test executors that execute the test cases.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
# AbilityStage
> ![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.
Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads.
## Modules to Import
```js
import AbilityStage from '@ohos.application.AbilityStage';
```
## AbilityStage.onCreate
onCreate(): void
Called when the application is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Example**
```js
class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage.onCreate is called")
}
}
```
## AbilityStage.onAcceptWant
onAcceptWant(want: Want): string;
Called when a specified ability is started.
**System capability**: 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.|
**Return value**
| Type| Description|
| -------- | -------- |
| string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started.|
**Example**
```js
class MyAbilityStage extends AbilityStage {
onAcceptWant(want) {
console.log("MyAbilityStage.onAcceptWant called");
return "com.example.test";
}
}
```
## AbilityStage.onConfigurationUpdated
onConfigurationUpdated(config: Configuration): void;
Called when the global configuration is updated.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.|
**Example**
```js
class MyAbilityStage extends AbilityStage {
onConfigurationUpdated(config) {
console.log('onConfigurationUpdated, language:' + config.language);
}
}
```
## AbilityStage.context
Describes the configuration information about the context.
| Name | Type | Description |
| ----------- | --------------------------- | ------------------------------------------------------------ |
| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
# Context
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
Provides the context for running code, including **applicationInfo** and **resourceManager**.
## Usage
You must extend **AbilityContext** to implement this module.
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | Yes| No| **ResourceManager** object.|
| applicationInfo | ApplicationInfo | Yes| No| Information about the application.|
| cacheDir | string | Yes| No| Cache directory of the application on the internal storage.|
| tempDir | string | Yes| No| Temporary file directory of the application.|
| filesDir | string | Yes| No| File directory of the application on the internal storage.|
| databaseDir | string | Yes| No| Storage directory of local data.|
| storageDir | string | Yes| No| Storage directory of lightweight data.|
| bundleCodeDir | string | Yes| No| Application installation path.|
| distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.|
| eventHub | [EventHub](js-apis-eventhub.md) | Yes| No| Event hub information.|
## Context.createBundleContext
createBundleContext(bundleName: string): Context;
Creates an application context.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Application bundle name.|
**Return value**
| Type| Description|
| -------- | -------- |
| Context | Context of the application created.|
**Example**
```js
let test = "com.example.test";
let context = this.context.createBundleContext(test);
```
## Context.getApplicationContext
getApplicationContext(): Context;
Obtains the context of this application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type| Description|
| -------- | -------- |
| Context | Context obtained.|
**Example**
```js
// This part is mandatory.
let context = this.context.getApplicationContext();
```
# ShellCmdResult
> **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.
## Modules to Import
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
## ShellCmdResult
Describes the shell command execution result.
| Name | Type | Readable| Writable| Description |
| --------- | ------ | ---- | ---- | ------------------------------------------------------------ |
| stdResult | string | Yes | Yes | Standard output content.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| exitCode | number | Yes | Yes | Result code.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册