提交 95d2e4b5 编写于 作者: L LiAn 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

Signed-off-by: NLiAn <lian15@huawei.com>
......@@ -21,6 +21,7 @@
- [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md)
- [InputMethodExtensionAbility](inputmethodextentionability.md)
- [WindowExtensionAbility (for System Applications Only)](windowextensionability.md)
- [DriverExtensionAbility](driverextensionability.md)
- Service Widget Development in Stage Model
- [Service Widget Overview](service-widget-overview.md)
- Developing an ArkTS Widget
......@@ -43,6 +44,7 @@
- Widget Data Interaction
- [Widget Data Interaction Overview](arkts-ui-widget-interaction-overview.md)
- [Configuring a Widget to Update Periodically](arkts-ui-widget-update-by-time.md)
- [Updating Widget Content Through a Proxy](arkts-ui-widget-update-by-proxy.md)
- [Updating Local and Online Images in the Widget](arkts-ui-widget-image-update.md)
- [Updating Widget Content by State](arkts-ui-widget-update-by-status.md)
- [Updating Widget Content by Widget Host (for System Applications Only)](arkts-ui-widget-content-update.md)
......@@ -62,7 +64,6 @@
- [Cross-Device Migration (for System Applications Only)](hop-cross-device-migration.md)
- [Multi-device Collaboration (for System Applications Only)](hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](subscribe-system-environment-variable-changes.md)
- [Setting Atomic Services to Support Sharing](atomic-services-support-sharing.md)
- Process Model
- [Process Model Overview](process-model-stage.md)
- Common Events
......
# Setting Atomic Services to Support Sharing
## How to Develop
1. An application calls [UIAbility.onShare()](../reference/apis/js-apis-app-ability-uiAbility.md#onshare), a lifecycle callback provided by the UIAbility component, to set the data to share. In this lifecycle callback, **ohos.extra.param.key.contentTitle** indicates the title of the content to share in the sharing box, **ohos.extra.param.key.shareAbstract** provides an abstract description of the content, and **ohos.extra.param.key.shareUrl** indicates the online address of the service. You need to set these three items as objects, with the key set to **title**, **abstract**, and **url**, respectively.
```ts
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
class MyUIAbility extends UIAbility {
onShare(wantParams) {
console.log('onShare');
wantParams['ohos.extra.param.key.contentTitle'] = {title: "OA"};
wantParams['ohos.extra.param.key.shareAbstract'] = {abstract: "communication for company employee"};
wantParams['ohos.extra.param.key.shareUrl'] = {url: "oa.example.com"};
}
}
```
2. A system dialog box calls [abilityManager.acquireShareData()](../reference/apis/js-apis-app-ability-abilityManager.md#acquiresharedata) to obtain data shared through atomic service sharing. Specifically, the system finds the UIAbility based on the mission ID and calls the **OnShare()** lifecycle of the UIAbility to obtain the shared data.
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
try {
abilityManager.acquireShareData(1, (err, wantParam) => {
if (err) {
console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`);
} else {
console.log(`acquireShareData success, data: ${JSON.stringify(wantParam)}`);
}
});
} catch (paramError) {
console.error(`error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}`);
}
```
# Native APIs
- [Using Native APIs in Application Projects](napi-guidelines.md)
- [Drawing Development](drawing-guidelines.md)
- [Raw File Development](rawfile-guidelines.md)
- [Native Window Development](native-window-guidelines.md)
- [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
- [Using MindSpore Lite for Offline Model Conversion and Inference](mindspore-lite-offline-model-guidelines.md)
- [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
- [Purgeable Memory Development](purgeable-memory-guidelines.md)
- [USB DDK Development](usb-ddk-guidelines.md)
\ No newline at end of file
- Graphics
- [Drawing Development](drawing-guidelines.md)
- [NativeBuffer Development](native-buffer-guidelines.md)
- [NativeImage Development](native-image-guidelines.md)
- [NativeVsync Development](native-vsync-guidelines.md)
- [NativeWindow Development](native-window-guidelines.md)
- [Vulkan Development](vulkan-guidelines.md)
- Resource Management
- [Raw File Development](rawfile-guidelines.md)
- AI
- [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
- [Using MindSpore Lite for Offline Model Conversion and Inference](mindspore-lite-offline-model-guidelines.md)
- [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
- Memory Management
- [Purgeable Memory Development](purgeable-memory-guidelines.md)
- Device Management
- [USB DDK Development](usb-ddk-guidelines.md)
......@@ -1674,7 +1674,7 @@ between the GUI components.
The following example provides a complete ArkUI-based application as an
illustration of GUI programming capabilities. For more details about ArkUI
features, please refer to the ArkUI
[tutorial](../arkts-get-started.md).
[tutorial](arkts-get-started.md).
```typescript
// ViewModel classes ---------------------------
......
......@@ -8,6 +8,7 @@
- [@ohos.app.ability.AbilityConstant (AbilityConstant)](js-apis-app-ability-abilityConstant.md)
- [@ohos.app.ability.abilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-app-ability-abilityLifecycleCallback.md)
- [@ohos.app.ability.AbilityStage (AbilityStage)](js-apis-app-ability-abilityStage.md)
- [@ohos.app.ability.ApplicationStateChangeCallback (ApplicationStateChangeCallback)](js-apis-app-ability-applicationStateChangeCallback.md)
- [@ohos.app.ability.common (Context)](js-apis-app-ability-common.md)
- [@ohos.app.ability.contextConstant (ContextConstant)](js-apis-app-ability-contextConstant.md)
- [@ohos.app.ability.EnvironmentCallback (EnvironmentCallback)](js-apis-app-ability-environmentCallback.md)
......@@ -151,8 +152,19 @@
- [Common Events of the Bundle Management Subsystem](common_event/commonEvent-bundleManager.md)
- [Common Events of the Notification Service](common_event/commonEvent-ans.md)
- [Common Events of the Resource Scheduler Subsystem](common_event/commonEvent-resourceschedule.md)
- [Common Events of the Window Management Subsystem](common_event/commonEvent-window.md)
- [Common Events of the Network Management Subsystem](common_event/commonEvent-netmanager.md)
- [Common Events of the SMS Application](common_event/commonEvent-mms.md)
- [Common Events of the Telephony Subsystem](common_event/commonEvent-telephony.md)
- [Common Events of the Power Management Subsystem](common_event/commonEvent-powermgr.md)
- [Common Events of the NFC Subsystem](common_event/commonEvent-nfc.md)
- [Common Events of the Wi-Fi Subsystem](common_event/commonEvent-wifi.md)
- [Common Events of the USB Subsystem](common_event/commonEvent-usb.md)
- [Common Events of the File Management Subsystem](common_event/commonEvent-filemanagement.md)
- [Common Events of the Theme Framework - Lock Screen](common_event/commonEvent-screenlock.md)
- [Common Events of the Time and Time Zone Subsystem](common_event/commonEvent-time.md)
- [Common Events of the Account Subsystem](common_event/commonEvent-account.md)
- Bundle Management
- [@ohos.bundle.appControl (appControl)](js-apis-appControl.md)
- [@ohos.bundle.bundleManager (bundleManager)](js-apis-bundleManager.md)
......@@ -186,7 +198,10 @@
- UI Page
- [@ohos.animator (Animator)](js-apis-animator.md)
- [@ohos.arkui.componentSnapshot (Component Snapshot)](js-apis-arkui-componentSnapshot.md)
- [@ohos.arkui.dragController (DragController)](js-apis-arkui-dragController.md)
- [@ohos.arkui.drawableDescriptor (DrawableDescriptor)](js-apis-arkui-drawableDescriptor.md)
- [@ohos.arkui.inspector (Layout Callback)](js-apis-arkui-inspector.md)
- [@ohos.arkui.UIContext (UIContext)](js-apis-arkui-UIContext.md)
- [@ohos.curves (Interpolation Calculation)](js-apis-curve.md)
- [@ohos.font (Custom Font Registration)](js-apis-font.md)
- [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md)
......@@ -208,6 +223,7 @@
- webgl
- [WebGL](js-apis-webgl.md)
- [WebGL2](js-apis-webgl2.md)
- Multimedia
- [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md)
......@@ -267,6 +283,7 @@
- [@ohos.file.fileuri (File URI)](js-apis-file-fileuri.md)
- [@ohos.file.fs (File Management)](js-apis-file-fs.md)
- [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md)
- [@ohos.file.photoAccessHelper (Album Management)](js-apis-photoAccessHelper.md)
- [@ohos.file.picker (File Picker)](js-apis-file-picker.md)
- [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md)
- [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md)
......@@ -275,6 +292,9 @@
- [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md)
- [@ohos.fileshare (File Sharing)](js-apis-fileShare.md)
- AI
- [@ohos.ai.mindSporeLite (Inference)](js-apis-mindSporeLite.md)
- Telephony Service
- [@ohos.contact (Contacts)](js-apis-contact.md)
- [@ohos.telephony.call (Call)](js-apis-call.md)
......@@ -288,6 +308,7 @@
- [@ohos.net.connection (Network Connection Management)](js-apis-net-connection.md)
- [@ohos.net.ethernet (Ethernet Connection Management)](js-apis-net-ethernet.md)
- [@ohos.net.http (Data Request)](js-apis-http.md)
- [@ohos.net.policy (Network Policy Management)](js-apis-net-policy.md)
- [@ohos.net.mdns (mDNS Management)](js-apis-net-mdns.md)
- [@ohos.net.sharing (Network Sharing)](js-apis-net-sharing.md)
- [@ohos.net.socket (Socket Connection)](js-apis-socket.md)
......@@ -296,14 +317,24 @@
- [@ohos.request (Upload and Download)](js-apis-request.md)
- Connectivity
- [@ohos.bluetooth.a2dp (Bluetooth a2dp Module)(Recommended)](js-apis-bluetooth-a2dp.md)
- [@ohos.bluetooth.access (Bluetooth access Module)(Recommended)](js-apis-bluetooth-access.md)
- [@ohos.bluetooth.baseProfile (Bluetooth baseProfile Module)(Recommended)](js-apis-bluetooth-baseProfile.md)
- [@ohos.bluetooth.ble (Bluetooth ble Module)(Recommended)](js-apis-bluetooth-ble.md)
- [@ohos.bluetooth.connection (Bluetooth connection Module)(Recommended)](js-apis-bluetooth-connection.md)
- [@ohos.bluetooth.constant (Bluetooth constant Module)(Recommended)](js-apis-bluetooth-constant.md)
- [@ohos.bluetooth.hfp (Bluetooth hfp Module)(Recommended)](js-apis-bluetooth-hfp.md)
- [@ohos.bluetooth.hid (Bluetooth hid Module)(Recommended)(js-apis-bluetooth-hid.md)
- [@ohos.bluetooth.pan (Bluetooth pan Module)(Recommended)](js-apis-bluetooth-pan.md)
- [@ohos.bluetooth.socket (Bluetooth socket Module)(Recommended)](js-apis-bluetooth-socket.md)
- [@ohos.bluetooth (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetooth.md)
- [@ohos.bluetoothManager (Bluetooth) (Recommended)](js-apis-bluetoothManager.md)
- [@ohos.bluetoothManager (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetoothManager.md)
- [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md)
- [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md)
- [@ohos.nfc.controller (Standard NFC)](js-apis-nfcController.md)
- [@ohos.nfc.tag (Standard NFC Tags)](js-apis-nfcTag.md)
- [@ohos.rpc (RPC)](js-apis-rpc.md)
- [@ohos.secureElement (SE Channel Management)](js-apis-secureElement.md)
- [@ohos.secureElement (SE Management)](js-apis-secureElement.md)
- [@ohos.wifiManager (WLAN) (Recommended)](js-apis-wifiManager.md)
- [@ohos.wifiManagerExt (WLAN Extension) (Recommended)](js-apis-wifiManagerExt.md)
- [@ohos.wifi (WLAN) (To Be Deprecated Soon)](js-apis-wifi.md)
......@@ -318,6 +349,7 @@
- [@ohos.accessibility.GesturePath (Gesture Path)](js-apis-accessibility-GesturePath.md)
- [@ohos.accessibility.GesturePoint (Gesture Point)](js-apis-accessibility-GesturePoint.md)
- [@ohos.application.AccessibilityExtensionAbility (AccessibilityExtensionAbility)](js-apis-application-accessibilityExtensionAbility.md)
- [@ohos.base (Public Callback Information)](js-apis-base.md)
- [@ohos.faultLogger (FaultLogger)](js-apis-faultLogger.md)
- [@ohos.hichecker (HiChecker)](js-apis-hichecker.md)
- [@ohos.hidebug (HiDebug)](js-apis-hidebug.md)
......@@ -337,6 +369,7 @@
- [@ohos.systemDateTime (System Time and Time Zone)](js-apis-system-date-time.md)
- [@ohos.systemTimer (System Timer)](js-apis-system-timer.md)
- [@ohos.wallpaper (Wallpaper)](js-apis-wallpaper.md)
- [@ohos.WallpaperExtensionAbility (WallpaperExtensionAbility)](js-apis-WallpaperExtensionAbility.md)
- [@ohos.web.webview (Webview)](js-apis-webview.md)
- [Console](js-apis-logs.md)
- [Timer](js-apis-timer.md)
......@@ -345,6 +378,7 @@
- [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md)
- Device Management
- [@ohos.app.ability.DriverExtensionAbility (DriverExtensionAbility)](js-apis-app-ability-driverExtensionAbility.md)
- [@ohos.batteryInfo (Battery Information)](js-apis-battery-info.md)
- [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md)
- [@ohos.brightness (Screen Brightness)](js-apis-brightness.md)
......@@ -356,6 +390,7 @@
- [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md)
- [@ohos.driver.deviceManager (Peripheral Management)](js-apis-driver-deviceManager.md)
- [@ohos.geoLocationManager (Geolocation Manager)](js-apis-geoLocationManager.md)
- [@ohos.multimodalInput.gestureEvent (Gesture Input Event)](js-apis-multimodalinput-gestureevent.md)
- [@ohos.multimodalInput.inputConsumer (Input Consumer)](js-apis-inputconsumer.md)
- [@ohos.multimodalInput.inputDevice (Input Device)](js-apis-inputdevice.md)
- [@ohos.multimodalInput.inputDeviceCooperate (Screen Hopping) (To Be Deprecated Soon)](js-apis-cooperate.md)
......@@ -380,10 +415,12 @@
- [@ohos.update (Update)](js-apis-update.md)
- [@ohos.usbManager (USB Manager)](js-apis-usbManager.md)
- [@ohos.vibrator (Vibrator)](js-apis-vibrator.md)
- application
- [DriverExtensionContext](js-apis-inner-application-driverExtensionContext.md)
- Account Management
- [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md)
- [@ohos.account.appAccount.AuthorizationExtensionAbility (App Account AuthorizationExtensionAbility)](js-apis-appAccount-authorizationExtensionAbility.md)
- [@ohos.account.appAccount.AuthorizationExtensionAbility (App AuthorizationExtensionAbility)](js-apis-appAccount-authorizationExtensionAbility.md)
- [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md)
......@@ -391,6 +428,7 @@
- [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md)
- Enterprise Device Management
- [Enterprise Device Management Overview (for System Applications Only)](enterpriseDeviceManagement-overview.md)
- [@ohos.enterprise.accountManager(Account Management)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager (Application Management)](js-apis-enterprise-applicationManager.md)
......
# @ohos.bluetooth.a2dp (Bluetooth A2DP Module)
The **a2dp** module provides APIs for using the Bluetooth Advanced Audio Distribution Profile (A2DP), which defines how to stream high quality audio from one device to another over a Bluetooth connection.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import a2dp from '@ohos.bluetooth.a2dp';
```
## a2dp.createA2dpSrcProfile<a name="createA2dpSrcProfile"></a>
createA2dpSrcProfile(): A2dpSourceProfile
Creates an **A2dpSrcProfile** instance.
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Return value**
| Type | Description |
| ----------------------------- | ---------- |
| A2dpSourceProfile | **A2dpSrcProfile** instance created.|
**Example**
```js
try {
let a2dpProfile = a2dp.createA2dpSrcProfile();
console.info('a2dp success');
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## A2dpSourceProfile
Provides APIs for using the A2DP. Before using any API of **A2dpSourceProfile**, you need to create an instance of this class by using **createA2dpSrcProfile()**.
### connect<a name="a2dp-connect"></a>
connect(deviceId: string): void
Connects to an A2DP device.
**System API**: This is a system API.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
| deviceId | string | Yes | Address of the device to connect. |
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
a2dpSrc.connect('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
### disconnect<a name="a2dp-disconnect"></a>
disconnect(deviceId: string): void
Disconnects from an A2DP device.
**System API**: This is a system API.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
| deviceId | string | Yes | Address of the device to disconnect. |
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
### getPlayingState
getPlayingState(deviceId: string): PlayingState
Obtains the playing state of a device.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
| device | string | Yes | Address of the remote device.|
**Return value**
| Type | Description |
| ----------------------------- | ---------- |
| [PlayingState](#PlayingState) | Playing state of the remote device obtained.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## PlayingState<a name="PlayingState"></a>
Enumerates the A2DP playing states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
| ----------------- | ------ | ------- |
| STATE_NOT_PLAYING | 0x0000 | Not playing. |
| STATE_PLAYING | 0x0001 | Playing.|
# @ohos.bluetooth.access (Bluetooth Access Module)
The **access** module provides APIs for enabling and disabling Bluetooth and obtaining the Bluetooth status.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import access from '@ohos.bluetooth.access';
```
## access.enableBluetooth<a name="enableBluetooth"></a>
enableBluetooth(): void
Enables Bluetooth.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message |
| -------- | ------------------ |
|2900001 | Service stopped. |
|2900099 | Operation failed. |
**Example**
```js
try {
access.enableBluetooth();
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## access.disableBluetooth<a name="disableBluetooth"></a>
disableBluetooth(): void
Disables Bluetooth.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
|ID | Error Message |
| -------- | ------------------ |
|2900001 | Service stopped. |
|2900099 | Operation failed. |
**Example**
```js
try {
access.disableBluetooth();
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## access.getState<a name="getState"></a>
getState(): BluetoothState
Obtains the Bluetooth state.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [BluetoothState](#bluetoothstate) | Bluetooth state obtained.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
|ID | Error Message |
| -------- | ------------------ |
|2900001 | Service stopped. |
|2900099 | Operation failed. |
**Example**
```js
try {
let state = access.getState();
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## access.on('stateChange')<a name="stateChange"></a>
on(type: "stateChange", callback: Callback&lt;BluetoothState&gt;): void
Subscribes to Bluetooth state changes.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------------------------------- | ----- | ---------------------------------------------------------- |
| type | string | Yes | Event type. The value is **stateChange**, which indicates a Bluetooth state change event. |
| callback | Callback&lt;[BluetoothState](#bluetoothstate)&gt; | Yes | Callback invoked to return the Bluetooth state. You need to implement this callback.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
|ID | Error Message |
| -------- | ------------------ |
|2900099 | Operation failed. |
**Example**
```js
function onReceiveEvent(data) {
console.info('bluetooth state = '+ JSON.stringify(data));
}
try {
access.on('stateChange', onReceiveEvent);
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## access.off('stateChange')<a name="stateChange"></a>
off(type: "stateChange", callback?: Callback&lt;BluetoothState&gt;): void
Unsubscribes from Bluetooth state changes.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value is **stateChange**, which indicates a Bluetooth state change event. |
| callback | Callback&lt;[BluetoothState](#bluetoothstate)&gt; | No | Callback for the Bluetooth state change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900099 | Operation failed. |
**Example**
```js
function onReceiveEvent(data) {
console.info('bluetooth state = '+ JSON.stringify(data));
}
try {
access.on('stateChange', onReceiveEvent);
access.off('stateChange', onReceiveEvent);
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## BluetoothState<a name="BluetoothState"></a>
Enumerates the Bluetooth states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
| --------------------- | ---- | ------------------ |
| STATE_OFF | 0 | Bluetooth is turned off. |
| STATE_TURNING_ON | 1 | Bluetooth is being turned on. |
| STATE_ON | 2 | Bluetooth is turned on. |
| STATE_TURNING_OFF | 3 | Bluetooth is being turned off. |
| STATE_BLE_TURNING_ON | 4 | The LE-only mode is being turned on for Bluetooth.|
| STATE_BLE_ON | 5 | Bluetooth is in LE-only mode. |
| STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.|
# @ohos.bluetooth.baseProfile (Bluetooth baseProfile Module)
The **baseProfile** module provides APIs for using basic Bluetooth profiles.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import baseProfile from '@ohos.bluetooth.baseProfile';
```
## ConnectionStrategy<a name="ConnectionStrategy"></a>
Enumerates the profile connection strategies.
**System API**: This is a system API.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Value | Description |
| -------------------------------- | ------ | --------------- |
| CONNECTION_STRATEGY_UNSUPPORTED | 0 | Default connection strategy to use when the device is not paired.<br>This is a system API.|
| CONNECTION_STRATEGY_ALLOWED | 1 | Connection strategy to use when the device is allowed to accept or initiate pairing.<br>This is a system API.|
| CONNECTION_STRATEGY_FORBIDDEN | 2 | Connection strategy to use when the device is not allowed to accept or initiate pairing.<br>This is a system API. |
## StateChangeParam<a name="StateChangeParam"></a>
Represents the profile state change parameters.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Type | Readable| Writable| Description |
| -------- | ----------------------------- | ---- | ---- | ------------------------------- |
| deviceId | string | Yes | No | Address of the Bluetooth device. |
| state | ProfileConnectionState | Yes | No | Profile connection state of the device.|
## baseProfile.setConnectionStrategy<a name="setConnectionStrategy"></a>
setConnectionStrategy(deviceId: string, strategy: ConnectionStrategy, callback: AsyncCallback&lt;void&gt;): void
Sets the profile connection strategy for this device. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
| strategy | [ConnectionStrategy](#connectionstrategy) | Yes |Profile connection strategy to set.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let setRet = a2dpSrc.setConnectionStrategy('XX:XX:XX:XX:XX:XX', 0, (err, data) => {
console.info('setConnectionStrategy, err: ' + JSON.stringify(err) + ', data: ' + JSON.stringify(data));
});
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## baseProfile.setConnectionStrategy<a name="setConnectionStrategy"></a>
setConnectionStrategy(deviceId: string, strategy: ConnectionStrategy): Promise&lt;void&gt;
Sets the profile connection strategy for this device. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
| strategy | [ConnectionStrategy](#connectionstrategy) | Yes |Profile connection strategy to set.|
**Return value**
| Type | Description |
| ------------------- | ------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let setRet = a2dpSrc.setConnectionStrategy('XX:XX:XX:XX:XX:XX', 1).then((data) => {
console.info('setConnectionStrategy');
}, (err) => {
console.error('setConnectionStrategy errCode: ' + err.code + ', errMessage: ' + err.message);
});
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## baseProfile.getConnectionStrategy<a name="getConnectionStrategy"></a>
getConnectionStrategy(deviceId: string, callback: AsyncCallback&lt;ConnectionStrategy&gt;): void
Obtains the profile connection strategy. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
| callback | AsyncCallback&lt;[ConnectionStrategy](#connectionstrategy)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let setRet = a2dpSrc.getConnectionStrategy('XX:XX:XX:XX:XX:XX', 0, (err, data) => {
console.info('getConnectionStrategy, err: ' + JSON.stringify(err) + ', data: ' + JSON.stringify(data));
});
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## baseProfile.getConnectionStrategy<a name="getConnectionStrategy"></a>
getConnectionStrategy(deviceId: string): Promise&lt;ConnectionStrategy&gt;
Obtains the profile connection strategy. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ----------------------------------- |
| deviceId | string | Yes | Address of the device to pair, for example, XX:XX:XX:XX:XX:XX. |
**Return value**
| Type | Description |
| ------------------- | ------------- |
| Promise&lt;[ConnectionStrategy](#connectionstrategy)&gt; | Promise used to return the profile connection strategy obtained.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let setRet = a2dpSrc.getConnectionStrategy('XX:XX:XX:XX:XX:XX', 1).then((data) => {
console.info('getConnectionStrategy');
}, (error) => {
console.error('getConnectionStrategy errCode: ' + err.code + ', errMessage: ' + err.message);
});
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## baseProfile.getConnectedDevices<a name="getConnectedDevices"></a>
getConnectedDevices(): Array&lt;string&gt;
Obtains the connected devices.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Return value**
| Type | Description |
| ------------------- | ------------------- |
| Array&lt;string&gt; | Addresses of the connected devices.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let retArray = a2dpSrc.getConnectedDevices();
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## baseProfile.getConnectionState<a name="getConnectionState"></a>
getConnectionState(deviceId: string): ProfileConnectionState
Obtains the profile connection state of a device.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
| deviceId | string | Yes | Address of the remote device.|
**Return value**
| Type | Description |
| ------------------------------------------------- | ----------------------- |
| [ProfileConnectionState](js-apis-bluetooth-constant.md#profileconnectionstate) | Profile connection state obtained.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
let a2dpSrc = a2dp.createA2dpSrcProfile();
let ret = a2dpSrc.getConnectionState('XX:XX:XX:XX:XX:XX');
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## baseProfile.on('connectionStateChange')
on(type: 'connectionStateChange', callback: Callback&lt;StateChangeParam&gt;): void
Subscribes to profile connection state changes.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value is **connectionStateChange**, which indicates a profile connection state change event.|
| callback | Callback&lt;[StateChangeParam](#statechangeparam)&gt; | Yes | Callback invoked to return the profile connection state change. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
function onReceiveEvent(data) {
console.info('a2dp state = '+ JSON.stringify(data));
}
let a2dpSrc = a2dp.createA2dpSrcProfile();
a2dpSrc.on('connectionStateChange', onReceiveEvent);
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
## baseProfile.off('connectionStateChange')
off(type: 'connectionStateChange', callback?: Callback&lt;[StateChangeParam](#StateChangeParam)&gt;): void
Unsubscribes from profile connection state changes.
**Required permissions**: ohos.permission.ACCESS_BLUETOOTH
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value is **connectionStateChange**, which indicates a profile connection state change event.|
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the profile connection state change. |
**Example**
```js
import a2dp from '@ohos.bluetooth.a2dp';
try {
function onReceiveEvent(data) {
console.info('a2dp state = '+ JSON.stringify(data));
}
let a2dpSrc = a2dp.createA2dpSrcProfile();
a2dpSrc.on('connectionStateChange', onReceiveEvent);
a2dpSrc.off('connectionStateChange', onReceiveEvent);
} catch (err) {
console.error('errCode: ' + err.code + ', errMessage: ' + err.message);
}
```
此差异已折叠。
......@@ -15,7 +15,7 @@
- [formBindingData](../reference/apis/js-apis-app-form-formBindingData.md):提供卡片数据绑定的能力,包括FormBindingData对象的创建、相关信息的描述。
- [页面布局(Card.ets)](arkts-ui-widget-page-overview.md):提供声明式范式的UI接口能力。
- [页面布局(WidgetCard.ets)](arkts-ui-widget-page-overview.md):提供声明式范式的UI接口能力。
- [ArkTS卡片特有能力](arkts-ui-widget-event-overview.md):postCardAction用于卡片内部和提供方应用间的交互,仅在卡片中可以调用。
- [ArkTS卡片能力列表](arkts-ui-widget-page-overview.md#arkts卡片支持的页面能力):列举了能在ArkTS卡片中使用的API、组件、事件、属性和生命周期调度。
......
......@@ -18,7 +18,7 @@
| action | string | 否 | 否 | 系统匹配时将忽略该参数,但仍可作为参数传递给目标应用组件。 |
| entities | Array&lt;string&gt; | 否 | 否 | 系统匹配时将忽略该参数,但仍可作为参数传递给目标应用组件。 |
| flags | number | 否 | 否 | 不参与匹配,直接传递给系统处理,一般用来设置运行态信息,例如URI数据授权等。 |
| parameters | {[key:&nbsp;string]:&nbsp;any} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
| parameters | {[key:&nbsp;string]:&nbsp;Object} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
## 隐式Want匹配原理
......@@ -35,7 +35,7 @@
| action | string | 是 | 否 | |
| entities | Array&lt;string&gt; | 是 | 否 | |
| flags | number | 否 | 否 | 不参与匹配,直接传递给系统处理,一般用来设置运行态信息,例如URI数据授权等。 |
| parameters | {[key:&nbsp;string]:&nbsp;any} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
| parameters | {[key:&nbsp;string]:&nbsp;Object} | 否 | 否 | 不参与匹配,应用自定义数据将直接传递给目标应用组件。 |
从隐式Want的定义,可得知:
......
......@@ -46,7 +46,7 @@
| **接口名** | **描述** |
| -------- | -------- |
| onContinue(wantParam&nbsp;:&nbsp;{[key:&nbsp;string]:&nbsp;any}):&nbsp;OnContinueResult | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:<br/>-&nbsp;AGREE:表示同意。<br/>-&nbsp;REJECT:表示拒绝:如应用在onContinue中异常可以直接REJECT。<br/>-&nbsp;MISMATCH:表示版本不匹配:迁移发起端应用可以在onContinue中获取到迁移接收端应用的版本号,进行协商后,如果版本不匹配导致无法迁移,可以返回该错误。 |
| onContinue(wantParam&nbsp;:&nbsp;{[key:&nbsp;string]:&nbsp;Object}):&nbsp;OnContinueResult | 迁移发起端在该回调中保存迁移所需要的数据,同时返回是否同意迁移:<br/>-&nbsp;AGREE:表示同意。<br/>-&nbsp;REJECT:表示拒绝:如应用在onContinue中异常可以直接REJECT。<br/>-&nbsp;MISMATCH:表示版本不匹配:迁移发起端应用可以在onContinue中获取到迁移接收端应用的版本号,进行协商后,如果版本不匹配导致无法迁移,可以返回该错误。 |
| onCreate(want:&nbsp;Want,&nbsp;param:&nbsp;AbilityConstant.LaunchParam):&nbsp;void; | 应用迁移接收端为冷启动或多实例应用热启动时,在该回调中完成数据恢复,并触发页面恢复。详见[应用组件启动模式](uiability-launch-type.md) |
| onNewWant(want:&nbsp;Want,&nbsp;launchParams:&nbsp;AbilityConstant.LaunchParam):&nbsp;void; | 迁移接收端为单实例应用热启动时,在该回调中完成数据恢复,并触发页面恢复。详见[应用组件启动模式](uiability-launch-type.md) |
......
......@@ -55,7 +55,7 @@ FormExtensionAbility类拥有如下API接口,具体的API介绍详见[接口
| onFormEvent(formId:&nbsp;string,&nbsp;message:&nbsp;string):&nbsp;void | 卡片提供方接收处理卡片事件的通知接口。 |
| onRemoveForm(formId:&nbsp;string):&nbsp;void | 卡片提供方接收销毁卡片的通知接口。 |
| onConfigurationUpdate(config:&nbsp;Configuration):&nbsp;void | 当系统配置更新时调用。 |
| onShareForm?(formId:&nbsp;string):&nbsp;{&nbsp;[key:&nbsp;string]:&nbsp;any&nbsp;} | 卡片提供方接收卡片分享的通知接口。 |
| onShareForm?(formId:&nbsp;string):&nbsp;{&nbsp;[key:&nbsp;string]:&nbsp;Object&nbsp;} | 卡片提供方接收卡片分享的通知接口。 |
formProvider类有如下API接口,具体的API介绍详见[接口文档](../reference/apis/js-apis-app-form-formProvider.md)
......
......@@ -9,11 +9,11 @@
| onCreate?():&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want:&nbsp;Want,&nbsp;param:&nbsp;AbilityConstant.LaunchParam):&nbsp;void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) |
| onWindowDisplayModeChanged?(isShownInMultiWindow:&nbsp;boolean,&nbsp;newConfig:&nbsp;resourceManager.Configuration):&nbsp;void; | Stage模型无对应接口 | 暂时未提供对应接口 |
| onStartContinuation?():&nbsp;boolean; | Stage模型无对应接口 | Stage模型上,应用无需感知迁移是否成功(由应用发起迁移请求时感知),onStartContinuation废弃 |
| onSaveData?(data:&nbsp;Object):&nbsp;boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam&nbsp;:&nbsp;{[key:&nbsp;string]:&nbsp;any}):&nbsp;AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
| onSaveData?(data:&nbsp;Object):&nbsp;boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam&nbsp;:&nbsp;{[key:&nbsp;string]:&nbsp;Object}):&nbsp;AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
| onCompleteContinuation?(result:&nbsp;number):&nbsp;void; | application\ContinueCallback.d.ts | [onContinueDone(result:&nbsp;number):&nbsp;void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onRestoreData?(data:&nbsp;Object):&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want:&nbsp;Want,&nbsp;param:&nbsp;AbilityConstant.LaunchParam):&nbsp;void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)<br/>[onNewWant(want:&nbsp;Want,&nbsp;launchParams:&nbsp;AbilityConstant.LaunchParam):&nbsp;void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)<br/>多实例模式Ability迁移目标端在onCreate回调中完成数据恢复,单实例模式应用迁移目标端在onCreate回调中完成数据恢复,回调中通过判断launchParam.launchReason可获取迁移启动的场景,从而可以从Want中获取迁移前保存的数据 |
| onRemoteTerminated?():&nbsp;void; | application\ContinueCallback.d.ts | [onContinueDone(result:&nbsp;number):&nbsp;void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onSaveAbilityState?(outState:&nbsp;PacMap):&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason:&nbsp;AbilityConstant.StateType,&nbsp;wantParam&nbsp;:&nbsp;{[key:&nbsp;string]:&nbsp;any}):&nbsp;AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
| onSaveAbilityState?(outState:&nbsp;PacMap):&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason:&nbsp;AbilityConstant.StateType,&nbsp;wantParam&nbsp;:&nbsp;{[key:&nbsp;string]:&nbsp;Object}):&nbsp;AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
| onRestoreAbilityState?(inState:&nbsp;PacMap):&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want:&nbsp;Want,&nbsp;param:&nbsp;AbilityConstant.LaunchParam):&nbsp;void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)<br/>应用重启后会触发Ability的onCreate方法,通过判断launchParam.launchReason可获取自恢复的场景,从而可以从Want中获取重启前保存的数据 |
| onInactive?():&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onBackground():&nbsp;void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonbackground) |
| onActive?():&nbsp;void; | \@ohos.app.ability.UIAbility.d.ts | [onForeground():&nbsp;void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonforeground) |
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册