提交 3340cd39 编写于 作者: Z zengyawen 提交者: Gitee

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

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
......@@ -384,7 +384,7 @@ zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md @gongjunsong @ge-
zh-cn/application-dev/reference/apis/js-apis-lightweightset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-linkedlist.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-list.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-logs.md @huaweimaxuchu @ningningW @niulihua @tomatodevboy
zh-cn/application-dev/reference/apis/js-apis-logs.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-media.md @liuyuehua1 @zengyawen @xxb-wzy @currydavids
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @panqinxu @zengyawen @bubble_mao @jinhaihw
zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy
......@@ -456,7 +456,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @hellohyh001 @nin
zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785
zh-cn/application-dev/reference/apis/js-apis-testRunner.md @inter515 @littlejerry1 @RayShih @inter515 @jiyong
zh-cn/application-dev/reference/apis/js-apis-thermal.md @aqxyjay @zengyawen @aqxyjay @alien0208
zh-cn/application-dev/reference/apis/js-apis-timer.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy
zh-cn/application-dev/reference/apis/js-apis-timer.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-touchevent.md @mayunteng_1 @ningningW @cococoler @alien0208
zh-cn/application-dev/reference/apis/js-apis-treemap.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
zh-cn/application-dev/reference/apis/js-apis-treeset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone
......
......@@ -63,7 +63,7 @@ For details about how to use DevEco Studio to start the test framework, see [Ope
**Example**
```javascript
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function onAbilityCreateCallback(data) {
console.info("onAbilityCreateCallback");
......@@ -87,11 +87,11 @@ abilityDelegator.addAbilityMonitor(monitor).then(() => {
**Modules to Import**
```javascript
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
```javascript
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
```
### Starting an Ability and Listening for the Ability State
......
......@@ -154,7 +154,7 @@ The basic dependency packages include:
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataAbility'
import ohos_data_rdb from '@ohos.data.rdb'
var urivar = "dataability:///com.ix.DataAbility"
var DAHelper = featureAbility.acquireDataAbilityHelper(
urivar
......
......@@ -25,7 +25,7 @@ Carry out the following operations to develop the widget provider based on the [
1. Implement lifecycle callbacks by using the **LifecycleForm** APIs.
2. Create a **FormBindingData** instance.
3. Update a widget by using the **FormProvider** APIs.
4. Develop the widget UI pages.
4. Develop the widget UI page.
## Available APIs
......@@ -231,7 +231,7 @@ You should override **onDestroy** to implement widget data deletion.
}
```
For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md).
For details about how to implement persistent data storage, see [Data Persistence by User Preferences](../database/data-persistence-by-preferences.md).
The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary.
......@@ -402,3 +402,5 @@ The code snippet is as follows:
}
}
```
<!--no_check-->
\ No newline at end of file
......@@ -47,7 +47,7 @@ You can specify the launch type by setting **launchType** in the **config.json**
| Launch Type | Description |Description |
| ----------- | ------- |---------------- |
| standard | Multi-instance | A new instance is started each time an ability starts.|
| standard | Multi-instance | A new instance is started each time an ability starts.|
| singleton | Singleton | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.|
By default, **singleton** is used.
......
......@@ -6,7 +6,7 @@ Ability continuation is to continue the current mission of an application, inclu
## Available APIs
The following table lists the APIs used for ability continuation. For details about the APIs, see [Ability](../reference/apis/js-apis-application-ability.md).
The following table lists the APIs used for ability continuation. For details about the APIs, see [UIAbility](../reference/apis/js-apis-app-ability-uiAbility.md).
**Table 1** Ability continuation APIs
......@@ -48,96 +48,88 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar
}
```
- Configure the application startup type.
If **launchType** is set to **standard** in the **module.json5** file, the application is of the multi-instance launch type. During ability continuation, regardless of whether the application is already open, the target starts the application and restores the UI page. If **launchType** is set to **singleton**, the application is of the singleton launch type. If the application is already open, the target clears the existing page stack and restores the UI page. For more information, see "Launch Type" in [Ability Development](./stage-ability.md).
If **launchType** is set to **multiton** in the **module.json5** file, the application is of the multi-instance launch type. During ability continuation, regardless of whether the application is already open, the target starts the application and restores the UI page. If **launchType** is set to **singleton**, the application is of the singleton launch type. If the application is already open, the target clears the existing page stack and restores the UI page. For more information, see "Launch Type" in [Ability Development](./stage-ability.md).
Configure a multi-instance application as follows:
```javascript
{
"module": {
"abilities": [
{
"launchType": "multiton"
}
]
}
}
```
Configure a singleton application as follows or retain the default settings of **launchType**:
```javascript
{
"module": {
"abilities": [
{
"launchType": "singleton"
}
]
}
}
```
- Apply for the distributed permissions.
Configure a multi-instance application as follows:
Declare the **DISTRIBUTED_DATASYNC** permission in the **module.json5** file for the application.
```javascript
{
"module": {
"abilities": [
{
"launchType": "standard"
}
]
}
}
```
```javascript
"requestPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
},
```
Configure a singleton application as follows or retain the default settings of **launchType**:
This permission must be granted by the user in a dialog box when the application is started for the first time. To enable the application to display a dialog box to ask for the permission, add the following code to **onWindowStageCreate** of the **Ability** class:
```javascript
{
"module": {
"abilities": [
{
"launchType": "singleton"
```javascript
requestPermissions = async () => {
let permissions: Array<string> = [
"ohos.permission.DISTRIBUTED_DATASYNC"
];
let needGrantPermission = false
let accessManger = accessControl.createAtManager()
Logger.info("app permission get bundle info")
let bundleInfo = await bundle.getApplicationInfo(BUNDLE_NAME, 0, 100)
Logger.info(`app permission query permission ${bundleInfo.accessTokenId.toString()}`)
for (const permission of permissions) {
Logger.info(`app permission query grant status ${permission}`)
try {
let grantStatus = await accessManger.verifyAccessToken(bundleInfo.accessTokenId, permission)
if (grantStatus === PERMISSION_REJECT) {
needGrantPermission = true
break;
}
} catch (err) {
Logger.error(`app permission query grant status error ${permission} ${JSON.stringify(err)}`)
needGrantPermission = true
break;
}
}
if (needGrantPermission) {
Logger.info("app permission needGrantPermission")
try {
await accessManger.requestPermissionsFromUser(this.context, permissions)
} catch (err) {
Logger.error(`app permission ${JSON.stringify(err)}`)
}
} else {
Logger.info("app permission already granted")
}
}
]
}
}
```
- Apply for the distributed permissions.
Declare the **DISTRIBUTED_DATASYNC** permission in the **module.json5** file for the application.
```javascript
"requestPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
},
```
This permission must be granted by the user in a dialog box when the application is started for the first time. To enable the application to display a dialog box to ask for the permission, add the following code to **onWindowStageCreate** of the **Ability** class:
```javascript
requestPermissions = async () => {
let permissions: Array<string> = [
"ohos.permission.DISTRIBUTED_DATASYNC"
];
let needGrantPermission = false
let accessManger = accessControl.createAtManager()
Logger.info("app permission get bundle info")
let bundleInfo = await bundle.getApplicationInfo(BUNDLE_NAME, 0, 100)
Logger.info(`app permission query permission ${bundleInfo.accessTokenId.toString()}`)
for (const permission of permissions) {
Logger.info(`app permission query grant status ${permission}`)
try {
let grantStatus = await accessManger.verifyAccessToken(bundleInfo.accessTokenId, permission)
if (grantStatus === PERMISSION_REJECT) {
needGrantPermission = true
break;
}
} catch (err) {
Logger.error(`app permission query grant status error ${permission} ${JSON.stringify(err)}`)
needGrantPermission = true
break;
}
}
if (needGrantPermission) {
Logger.info("app permission needGrantPermission")
try {
await accessManger.requestPermissionsFromUser(this.context, permissions)
} catch (err) {
Logger.error(`app permission ${JSON.stringify(err)}`)
}
} else {
Logger.info("app permission already granted")
}
}
```
```
2. Implement the **onContinue()** API.
......@@ -155,7 +147,7 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar
You can obtain the target device ID (identified by the key **targetDevice**) and the version number (identified by the key **version**) of the application installed on the target device from the **wantParam** parameter of this API. The version number can be used for compatibility check. If the current application version is incompatible with that on the target device, **OnContinueResult.MISMATCH** can be returned to reject the continuation request.
Example
Example:
```javascript
onContinue(wantParam : {[key: string]: any}) {
......@@ -168,8 +160,6 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar
}
```
3. Implement the continuation logic in the **onCreate()** or **onNewWant()** API.
The **onCreate()** API is called by the target. When the ability is started on the target device, this API is called to instruct the application to synchronize the memory data and UI component state, and triggers page restoration after the synchronization is complete. If the continuation logic is not implemented, the ability will be started in common startup mode and the page cannot be restored.
......@@ -178,11 +168,9 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar
After data restore is complete, call **restoreWindowStage** to trigger page restoration.
You can also use **want.parameters.version** in the **want** parameter to obtain the application version number of the initiator.
Example
Example:
```javascript
import UIAbility from '@ohos.app.ability.UIAbility';
......@@ -190,7 +178,7 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar
export default class EntryAbility extends UIAbility {
storage : LocalStorag;
onCreate(want, launchParam) {
Logger.info(`EntryAbility onCreate ${AbilityConstant.LaunchReason.CONTINUATION}`)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
......@@ -211,7 +199,7 @@ For a singleton ability, use **onNewWant()** to achieve the same implementation.
Use distributed objects.
Distributed objects allow cross-device data synchronization like local variables. For two devices that form a Super Device, when data in the distributed data object of an application is added, deleted, or modified on a device, the data for the same application is also updated on the other device. Both devices can listen for the data changes and online and offline states of the other. For details, see [Distributed Data Object Development](../database/database-distributedobject-guidelines.md).
Distributed objects allow cross-device data synchronization like local variables. For two devices that form a Super Device, when data in the distributed data object of an application is added, deleted, or modified on a device, the data for the same application is also updated on the other device. Both devices can listen for the data changes and online and offline states of the other. For details, see [Sharing Distributed Data Objects](../database/data-sync-of-distributed-data-object.md).
In the ability continuation scenario, the distributed data object is used to synchronize the memory data from the local device to the target device.
......@@ -249,8 +237,6 @@ In the ability continuation scenario, the distributed data object is used to syn
});
```
- The target device obtains the session ID from **onCreate()**, creates a distributed object, and associates the distributed object with the session ID. In this way, the distributed object can be synchronized. Before calling **restoreWindowStage**, ensure that all distributed objects required for continuation have been associated.
```javascript
......@@ -283,8 +269,6 @@ In the ability continuation scenario, the distributed data object is used to syn
}
```
### More Information
1. Timeout
......@@ -294,15 +278,13 @@ In the ability continuation scenario, the distributed data object is used to syn
2. By default, the system supports page stack information migration, which means that the page stack of the initiator will be automatically migrated to the target device. No adaptation is required.
### Restrictions
1. The continuation must be performed between the same ability, which means the same bundle name, module name, and ability name. For details, see [Application Package Structure Configuration File](../quick-start/module-configuration-file.md).
2. Currently, the application can only implement the continuation capability. The continuation action must be initiated by the system.
### Best Practice
For better user experience, you are advised to use the **wantParam** parameter to transmit data smaller than 100 KB and use distributed objects to transmit data larger than 100 KB.
<!--no_check-->
\ No newline at end of file
......@@ -12,8 +12,8 @@ An ability can be launched in the **standard**, **singleton**, or **specified**
| Launch Type | Description |Action |
| ----------- | ------- |---------------- |
| standard | Standard mode | A new instance is started each time an ability starts.|
| singleton | Singleton mode | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.|
| multiton | Multi-instance mode| A new instance is started each time an ability starts.|
| singleton | Singleton mode | Default type. The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.|
| specified | Instance-specific| The internal service of an ability determines whether to create multiple instances during running.|
By default, the singleton mode is used. The following is an example of the **module.json5** file:
......@@ -39,7 +39,7 @@ The table below describes the APIs provided by the **AbilityStage** class, which
|onAcceptWant(want: Want): string|Called when a specified ability is started.|
|onConfigurationUpdated(config: Configuration): void|Called when the global configuration is updated.|
The table below describes the APIs provided by the **Ability** class. For details about the APIs, see [Ability](../reference/apis/js-apis-application-ability.md).
The table below describes the APIs provided by the **Ability** class. For details about the APIs, see [UIAbility](../reference/apis/js-apis-app-ability-uiAbility.md).
**Table 2** Ability APIs
......@@ -190,7 +190,7 @@ export default class EntryAbility extends UIAbility {
```
## Starting an Ability
### Available APIs
The **Ability** class has the **context** attribute, which belongs to the **AbilityContext** class. The **AbilityContext** class has the **abilityInfo**, **currentHapModuleInfo**, and other attributes as well as the APIs used for starting abilities. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md).
The **Ability** class has the **context** attribute, which belongs to the **AbilityContext** class. The **AbilityContext** class has the **abilityInfo**, **currentHapModuleInfo**, and other attributes as well as the APIs used for starting abilities. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md).
**Table 3** AbilityContext APIs
|API|Description|
......@@ -207,7 +207,7 @@ The **Ability** class has the **context** attribute, which belongs to the **Abil
An application can obtain the context of an **Ability** instance through **this.context** and then use the **startAbility** API in the **AbilityContext** class to start the ability. The ability can be started by specifying **Want**, **StartOptions**, and **accountId**, and the operation result can be returned using a callback or **Promise** instance. The sample code is as follows:
```ts
let context = this.context
var want = {
let want = {
"deviceId": "",
"bundleName": "com.example.MyApplication",
"abilityName": "EntryAbility"
......@@ -224,7 +224,7 @@ context.startAbility(want).then(() => {
In the cross-device scenario, you must specify the ID of the remote device. The sample code is as follows:
```ts
let context = this.context
var want = {
let want = {
"deviceId": getRemoteDeviceId(),
"bundleName": "com.example.MyApplication",
"abilityName": "EntryAbility"
......@@ -239,9 +239,9 @@ Obtain the ID of a specified device from **DeviceManager**. The sample code is a
```ts
import deviceManager from '@ohos.distributedHardware.deviceManager';
function getRemoteDeviceId() {
if (typeof dmClass === 'object' && dmClass != null) {
var list = dmClass.getTrustedDeviceListSync();
if (typeof (list) == 'undefined' || typeof (list.length) == 'undefined') {
if (typeof dmClass === 'object' && dmClass !== null) {
let list = dmClass.getTrustedDeviceListSync();
if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') {
console.log("EntryAbility onButtonClick getRemoteDeviceId err: list is null");
return;
}
......
......@@ -135,7 +135,7 @@ To create a widget in the stage model, you need to implement lifecycle callbacks
| Name | Description | Data Type | Default Value Allowed |
| ----------- | ------------------------------------------------------------ | ---------- | -------------------- |
| name | Name of the Extension ability. This field must be specified. | String | No |
| srcEntrance | Path of the Extension ability lifecycle code. This field must be specified.| String | No |
| srcEntry | Path of the Extension ability lifecycle code. This field must be specified.| String | No |
| description | Description of the Extension ability. The value can be a string or a resource index to descriptions in multiple languages.| String | Yes (initial value: left empty)|
| icon | Index of the Extension ability icon file. | String | Yes (initial value: left empty)|
| label | Descriptive information about the Extension ability presented externally. The value can be a string or a resource index to the description.| String | Yes (initial value: left empty)|
......@@ -150,7 +150,7 @@ To create a widget in the stage model, you need to implement lifecycle callbacks
```json
"extensionAbilities": [{
"name": "FormAbility",
"srcEntrance": "./ets/FormAbility/FormAbility.ts",
"srcEntry": "./ets/FormAbility/FormAbility.ts",
"label": "$string:form_FormAbility_label",
"description": "$string:form_FormAbility_desc",
"type": "form",
......@@ -242,7 +242,7 @@ You should override **onDestroy** to implement widget data deletion.
}
```
For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md).
For details about how to implement persistent data storage, see [Application Data Persistence Overview](../database/app-data-persistence-overview.md).
The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary.
......@@ -366,7 +366,7 @@ You can set router and message events for components on a widget. The router eve
1. Set the **onclick** field in the HML file to **routerEvent** or **messageEvent**, depending on the **actions** settings in the JSON file.
2. Set the router event.
- **action**: **"router"**, which indicates a router event.
- **abilityName**: target ability name, for example, **EntryAbility**, which is the default UIAbility name in DevEco Studio for the stage model.
- **abilityName**: target ability name, for example, **EntryAbility**, which is the default main ability name in DevEco Studio for the stage model.
- **params**: custom parameters of the target ability. Set them as required. The value can be obtained from **parameters** in **want** used for starting the target ability. For example, in the lifecycle function **onCreate** of the EntryAbility in the stage model, you can obtain **want** and its **parameters** field.
3. Set the message event.
- **action**: **"message"**, which indicates a message event.
......@@ -413,3 +413,5 @@ The code snippet is as follows:
}
}
```
<!--no_check-->
\ No newline at end of file
......@@ -33,8 +33,8 @@ OpenHarmony does not support creation of a Service Extension ability for third-p
"icon": "$media:icon",
"description": "service",
"type": "service",
"visible": true,
"srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts"
"exported": true,
"srcEntry": "./ets/ServiceExtAbility/ServiceExtAbility.ts"
}]
```
......
......@@ -24,6 +24,8 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O
All applications should be developed on top of these frameworks.
Then, equip yourself for developing the key features, with the following guidelines:
- [Web](web/web-component-overview.md)
- [Notification](notification/Readme-EN.md)
- [Window Manager](windowmanager/Readme-EN.md)
- [WebGL](webgl/Readme-EN.md)
......@@ -32,6 +34,7 @@ Then, equip yourself for developing the key features, with the following guideli
- [Connectivity](connectivity/Readme-EN.md)
- [Telephony Service](telephony/Readme-EN.md)
- [Data Management](database/Readme-EN.md)
- [File Management](file-management/Readme-EN.md)
- [Task Management](task-management/Readme-EN.md)
- [Device Management](device/Readme-EN.md)
- [Device Usage Statistics](device-usage-statistics/Readme-EN.md)
......@@ -40,7 +43,6 @@ Then, equip yourself for developing the key features, with the following guideli
- [Application Test](application-test/Readme-EN.md)
- [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/Readme-EN.md)
- [File Management](file-management/medialibrary-overview.md)
### Tools
......@@ -70,3 +72,5 @@ They are organized as follows:
### Readme
For details about the principles and basic information of each subsystem, see the README file in [docs/en/readme](../readme).
<!--no_check-->
\ No newline at end of file
......@@ -4,7 +4,7 @@ The application development documents provide reference for you to develop appli
The documents are carefully organized as follows:
### Getting Started
## Getting Started
[Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development.
......@@ -12,7 +12,7 @@ Browse the documents on the instructions for quickly building your first applica
Check out the development fundamentals, which comprise descriptions of the package structure configuration file for OpenHarmony applications and the instructions for use of resource files.
### Development
## Development
To facilitate your application development, we provide development guidelines for key features.
......@@ -24,14 +24,17 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O
All applications should be developed on top of these frameworks.
Then, equip yourself for developing the key features, with the following guidelines:
- [Web](web/web-component-overview.md)
- [Notification](notification/notification-overview.md)
- [Window Manager](windowmanager/window-overview.md)
- [WebGL](webgl/webgl-overview.md)
- [Media](media/audio-overview.md)
- [Media](media/media-application-overview.md)
- [Security](security/userauth-overview.md)
- [Connectivity](connectivity/ipc-rpc-overview.md)
- [Telephony Service](telephony/telephony-overview.md)
- [Data Management](database/database-mdds-overview.md)
- [Data Management](database/data-mgmt-overview.md)
- [File Management](file-management/file-management-overview.md)
- [Task Management](task-management/background-task-overview.md)
- [Device](device/usb-overview.md)
- [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md)
......@@ -40,32 +43,29 @@ Then, equip yourself for developing the key features, with the following guideli
- [Application Test](application-test/arkxtest-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md)
- [File Management](file-management/medialibrary-overview.md)
### Tools
## Tools
DevEco Studio is a high-performance integrated development environment (IDE) recommended for developing OpenHarmony applications.
[Here](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-deveco-studio-overview-0000001263280421) you can learn everything about DevEco Studio, including how to use this tool to create a project and sign, debug, and run an application.
### Hands-On Tutorials
## Hands-On Tutorials
To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs).
### API References
## API References
API references encompass all components and APIs available in OpenHarmony, helping you use and integrate APIs more effectively.
They are organized as follows:
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md)
- [JS and TS APIs](reference/apis/js-apis-ability-dataUriUtils.md)
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Full)](reference/arkui-js/js-components-common-attributes.md)
- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Lite)](reference/arkui-js-lite/js-framework-file.md)
- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md)
- [JS and TS APIs](reference/apis/development-intro.md)
- Native APIs
- [Standard Library](reference/native-lib/third_party_libc/musl.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
- [Node_API](reference/native-lib/third_party_napi/napi.md)
<!--no_check-->
\ No newline at end of file
......@@ -189,7 +189,7 @@ The following steps describe how to use the text drawing and display feature of
OH_Drawing_CreateFontCollection());
OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle);
// Set the text content.
const char* text = "OpenHarmony\n";
const char* text = "Hello World\n";
OH_Drawing_TypographyHandlerAddText(handler, text);
OH_Drawing_TypographyHandlerPopTextStyle(handler);
OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler);
......
......@@ -3,14 +3,13 @@
The **BundleStatusCallback** module provides callbacks for bundle status changes. The changes can be obtained through [innerBundleManager.on](js-apis-Bundle-InnerBundleManager.md).
> **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.
## BundleStatusCallback<sup>(deprecated)<sup>
> This API is deprecated since API version 9. You are advised to use [bundleMonitor](js-apis-bundleMonitor.md) instead.
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**System capability**: SystemCapability.BundleManager.BundleFramework
......
......@@ -34,7 +34,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -62,7 +62,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -94,7 +94,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -153,7 +153,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -179,7 +179,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -210,7 +210,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -236,7 +236,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -267,7 +267,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -293,7 +293,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......
......@@ -42,7 +42,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -71,7 +71,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -103,7 +103,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -132,7 +132,7 @@ SystemCapability.BundleManager.DistributedBundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......
......@@ -426,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Return value**
......@@ -462,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -499,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -540,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -584,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -626,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -671,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -699,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -754,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......@@ -794,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework
**System API**
This is a system API and cannot be called by third-party applications.
This is a system API.
**Parameters**
......
......@@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want';
| entities | Array\<string> | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.|
| uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | string | No| MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.|
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files.|
| [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.<br>For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.|
**Example**
......@@ -34,6 +34,7 @@ import Want from '@ohos.app.ability.Want';
- Basic usage: called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability).
```ts
let context = ...; // UIAbilityContext
let want = {
'deviceId': '', // An empty deviceId indicates the local device.
'bundleName': 'com.example.myapplication',
......@@ -41,16 +42,17 @@ import Want from '@ohos.app.ability.Want';
'moduleName': 'entry' // moduleName is optional.
};
this.context.startAbility(want, (err) => {
context.startAbility(want, (err) => {
// Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability.
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
- Data is transferred through user-defined fields. The following data types are supported (called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability).)
- Currently, the following data types are supported: string, number, Boolean, object, array, and file descriptor (FD).
* String
```ts
let context = ...; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -59,12 +61,13 @@ import Want from '@ohos.app.ability.Want';
},
};
this.context.startAbility(want, (err) => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
* Number
```ts
let context = ...; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -74,12 +77,13 @@ import Want from '@ohos.app.ability.Want';
},
};
this.context.startAbility(want, (err) => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
* Boolean
```ts
let context = ...; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -88,12 +92,13 @@ import Want from '@ohos.app.ability.Want';
},
};
this.context.startAbility(want, (err) => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
* Object
```ts
let context = ...; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -107,12 +112,13 @@ import Want from '@ohos.app.ability.Want';
},
};
this.context.startAbility(want, (err) => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
* Array
```ts
let context = ...; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility',
......@@ -124,19 +130,21 @@ import Want from '@ohos.app.ability.Want';
},
};
this.context.startAbility(want, (err) => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
* File descriptor (FD)
* FD
```ts
import fileio from '@ohos.fileio';
import fs from '@ohos.file.fs';
let context = ...; // UIAbilityContext
let fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
console.error('openSync fail: ${JSON.stringify(e)}');
fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd;
} catch(err) {
console.error(`Failed to openSync. Code: ${err.code}, message: ${err.message}`);
}
let want = {
'deviceId': '', // An empty deviceId indicates the local device.
......@@ -148,7 +156,7 @@ import Want from '@ohos.app.ability.Want';
}
};
this.context.startAbility(want, (err) => {
console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`);
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -24,7 +24,7 @@ Sets the disposed status for an application. This API uses a promise to return t
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -75,7 +75,7 @@ Sets the disposed status for an application. This API uses an asynchronous callb
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -122,7 +122,7 @@ Obtains the disposed status of an application. This API uses a promise to return
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -171,7 +171,7 @@ Obtains the disposed status of an application. This API uses an asynchronous cal
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -216,7 +216,7 @@ Deletes the disposed status for an application. This API uses a promise to retur
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -265,7 +265,7 @@ Deletes the disposed status for an application. This API uses an asynchronous ca
**System capability**: SystemCapability.BundleManager.BundleFramework.AppControl
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......
......@@ -24,9 +24,9 @@ import Want from '@ohos.application.Want';
| uri | 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 | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags).|
| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). |
| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-ability-wantConstant.md#wantconstantentity). |
**Example**
......@@ -108,10 +108,10 @@ import Want from '@ohos.application.Want';
```
* File descriptor (FD)
```ts
import fileio from '@ohos.fileio';
import fs from '@ohos.file.fs';
let fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd;
} catch(e) {
console.error('openSync fail: ${JSON.stringify(e)}');
}
......
# @ohos.arkui.drawableDescriptor (DrawableDescriptor)
The **DrawableDescriptor** module provides APIs for obtaining **pixelMap** objects, including the foreground, background, mask, and layered icons.
> **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.
>
> You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer.
## Modules to Import
```js
import { DrawableDescriptor, LayeredDrawableDescriptor } from '@ohos.arkui.drawableDescriptor';
```
## DrawableDescriptor.constructor
constructor()
Creates a **DrawableDescriptor** or **LayeredDrawableDescriptor** object. The globalization API [getDrawableDescriptor](js-apis-resource-manager.md##getdrawabledescriptor) or [getDrawableDescriptorByName](js-apis-resource-manager.md##getdrawabledescriptorbyname) is required for object construction.
**System API**: This is a system API.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
### DrawableDescriptor
Creates a **DrawableDescriptor** object when the passed resource ID or name belongs to a common image.
### LayeredDrawableDescriptor
Creates a **LayeredDrawableDescriptor** object when the passed resource ID or name belongs to a JSON file that contains foreground and background resources.
**Example**
```js
@Entry
@Component
struct Index {
private resManager = getContext().resourceManager
let drawable1 = resManager.getDrawableDescriptor($r('app.media.icon').id)
let drawable2 = resManager.getDrawableDescriptorByName(icon)
let layeredDrawable1 = resManager.getDrawableDescriptor($r('app.media.file').id)
let layeredDrawable1 = resManager.getDrawableDescriptor(file)
}
```
## DrawableDescriptor.getPixelMap
getPixelMap(): image.PixelMap;
Obtains this **pixelMap** object.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | **pixelMap** object.|
**Example**
```js
@State pixmap: PixelMap = drawable1.getPixelMap();
```
## LayeredDrawableDescriptor.getPixelMap
getPixelMap(): image.PixelMap;
Obtains the **pixelMap** object where the foreground, background, and mask are blended and cropped.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | **pixelMap** object.|
**Example**
```js
@State pixmap: PixelMap = layeredDrawable1.getPixelMap();
```
## LayeredDrawableDescriptor.getForeground
getForeground(): DrawableDescriptor;
Obtains the **DrawableDescriptor** object of the foreground.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.|
**Example**
```js
@State drawable: DrawableDescriptor = layeredDrawable1.getForeground();
```
## LayeredDrawableDescriptor.getBackground
getBackground(): DrawableDescriptor;
Obtains the **DrawableDescriptor** object of the background.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.|
**Example**
```js
@State drawable: DrawableDescriptor = layeredDrawable1.getBackground();
```
## LayeredDrawableDescriptor.getMask
getMask(): DrawableDescriptor;
Obtains the **DrawableDescriptor** object of the mask.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Return value**
| Type | Description |
| --------------------------------- | ---------------- |
| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.|
**Example**
```js
@State drawable: DrawableDescriptor = layeredDrawable1.getMask();
```
<!--no_check-->
\ No newline at end of file
......@@ -3,7 +3,7 @@
The **BundleInstaller** module provides APIs for you to install, uninstall, and recover bundles on devices.
> **NOTE**
>
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## BundleInstaller.install<sup>(deprecated)<sup>
......@@ -22,7 +22,7 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -72,7 +72,7 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -121,7 +121,7 @@ ohos.permission.INSTALL_BUNDLE
SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -162,7 +162,7 @@ Describes the parameters required for bundle installation, recovery, or uninstal
**System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| ----------- | ------- | ---- | ---- | ------------------ |
......@@ -176,12 +176,12 @@ Describes the bundle installation or uninstall status.
**System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ |
| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. The value must be defined in [InstallErrorCode](js-apis-Bundle.md#installerrorcode)|
| statusMessage | string | Yes | No | Installation or uninstall status message. <br>**SUCCESS**: install_succeed<br>**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).<br>**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.<br>**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.<br>**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)<br>**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.<br>**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)<br>**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)<br>**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.<br>**STATUS_ABILITY_NOT_FOUND**: Ability not found.<br>**STATUS_BMS_SERVICE_ERROR**: BMS service error.<br>**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.<br>**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.<br>**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.<br>**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission. |
| statusMessage | string | Yes | No | Installation or uninstall status message. <br>**SUCCESS**: install_succeed<br>**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).<br>**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.<br>**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.<br>**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)<br>**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.<br>**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)<br>**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)<br>**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)<br>**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)<br>**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.<br>**STATUS_ABILITY_NOT_FOUND**: Ability not found.<br>**STATUS_BMS_SERVICE_ERROR**: BMS service error.<br>**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.<br>**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.<br>**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.<br>**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission.|
## Obtaining the Sandbox Path
For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the stage model, the sandbox path can be obtained using the attribute in [Context](js-apis-inner-application-uiAbilityContext.md#abilitycontext). The following describes how to obtain the sandbox path.
......
......@@ -3,7 +3,7 @@
The **LauncherAbilityInfo** module provides information about the launcher ability, which is obtained through [innerBundleManager.getLauncherAbilityInfos](js-apis-Bundle-InnerBundleManager.md).
> **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.
## LauncherAbilityInfo<sup>(deprecated)<sup>
......@@ -12,7 +12,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili
**System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- |
......
......@@ -12,11 +12,11 @@ The **PermissionDef** module provides permission details defined in the configur
**System capability**: SystemCapability.BundleManager.BundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| -------------- | ------ | ---- | ---- | -------------- |
| permissionName | string | Yes | No | Name of the permission. |
| grantMode | number | Yes | No | Grant mode of the permission. The value **0** means that the system automatically grants the permission after the application installation, and **1** means that the application needs to dynamically request the permission from the user.|
| labelId | number | Yes | No | ID of the permission label. |
| descriptionId | number | Yes | No | ID of the permission description. |
| labelId | number | Yes | No | ID of the permission label. |
| descriptionId | number | Yes | No | ID of the permission description. |
......@@ -12,11 +12,10 @@ The **RemoteAbilityInfo** module provides information about a remote ability.
**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| ----------- | -------------------------------------------- | ---- | ---- | ----------------------- |
| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name information of the ability. |
| label | string | Yes | No | Ability name. |
| icon | string | Yes | No | Icon of the ability.|
......@@ -10,7 +10,7 @@ The **LauncherAbilityInfo** module defines the ability information of the home s
**System capability**: SystemCapability.BundleManager.BundleFramework.Launcher
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ |
......
......@@ -98,12 +98,12 @@ Enumerates the types of Extension abilities.
| Name| Value| Description|
|:----------------:|:---:|-----|
| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md): provides APIs for widget development.|
| FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md): provides APIs for widget development.|
| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md): enables applications to execute non-real-time tasks when the system is idle.|
| INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md): provides APIs for developing input method applications.|
| SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md): enables applications to run in the background and provide services.|
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.|
| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md): enables applications to read and write data.|
| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/share-data-by-datashareextensionability.md): enables applications to read and write data.|
| FILE_SHARE | 6 | FileShareExtensionAbility: enables file sharing between applications. This ability is reserved.|
| STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md): provides APIs for processing static events, such as the startup event.|
| WALLPAPER | 8 | WallpaperExtensionAbility: provides APIs to implement the home screen wallpaper. This ability is reserved.|
......@@ -113,6 +113,7 @@ Enumerates the types of Extension abilities.
| THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.|
| PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.|
| PRINT<sup>10+</sup> | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.|
| DRIVER<sup>10+</sup> | 18 | DriverExtensionAbility: provides APIs for the peripheral driver. This type of ability is not supported yet.|
| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.|
......@@ -187,7 +188,7 @@ Enumerates the display orientations of the ability. This attribute applies only
| AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.|
| LOCKED |12|Locked.|
### CompatiblePolicy
### CompatiblePolicy<sup>10+</sup>
Defines the version compatibility type of the shared library.
......@@ -3069,3 +3070,167 @@ try {
hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message);
}
```
### bundleManager.getAppProvisionInfo<sup>10+</sup>
getAppProvisionInfo(bundleName: string, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void;
Obtains the provision configuration file information based on the given bundle name. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name.|
| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the provision configuration file information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleName = "com.ohos.myapplication";
try {
bundleManager.getAppProvisionInfo(bundleName, (err, data) => {
if (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
} else {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data));
}
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
}
```
### bundleManager.getAppProvisionInfo<sup>10+</sup>
getAppProvisionInfo(bundleName: string, userId: number, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void;
Obtains the provision configuration file information based on the given bundle name and user ID. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name.|
| userId | number | Yes| User ID, which can be obtained by calling [getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9).|
| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the provision configuration file information obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleName = "com.ohos.myapplication";
let userId = 100;
try {
bundleManager.getAppProvisionInfo(bundleName, userId, (err, data) => {
if (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
} else {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data));
}
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message);
}
```
### bundleManager.getAppProvisionInfo<sup>10+</sup>
getAppProvisionInfo(bundleName: string, userId?: number): Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>;
Obtains the provision configuration file information based on the given bundle name and user ID. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes| Bundle name.|
| userId | number | No| User ID, which can be obtained by calling [getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9).|
**Return value**
| Type | Description |
| ------------------------------------------------------------ | ----------------------------------- |
| Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Promise used to return the provision configuration file obtained.|
**Error codes**
For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
| ID| Error Message |
| -------- | -------------------------------------- |
| 17700001 | The specified bundleName is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
```ts
import bundleManager from '@ohos.bundle.bundleManager';
import hilog from '@ohos.hilog';
let bundleName = "com.ohos.myapplication";
let userId = 100;
try {
bundleManager.getAppProvisionInfo(bundleName).then((data) => {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data));
}).catch(err => {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
}
try {
bundleManager.getAppProvisionInfo(bundleName, userId).then((data) => {
hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data));
}).catch(err => {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
});
} catch (err) {
hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message);
}
```
<!--no_check-->
\ No newline at end of file
......@@ -24,7 +24,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md).
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
| Name | Template | Readable| Writable| Description |
| ---------- | ------ | ---- | ---- | -------------------------- |
......@@ -39,7 +39,7 @@ Subscribes to bundle installation, uninstall, and update events.
**Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......@@ -72,7 +72,7 @@ Unsubscribes from bundle installation, uninstall, and update events.
**Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
......
......@@ -109,7 +109,7 @@ Obtains the default application based on a system-defined application type or a
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -165,7 +165,7 @@ Obtains the default application of a user based on a system-defined application
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -217,7 +217,7 @@ Obtains the default application based on a system-defined application type or a
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -266,7 +266,7 @@ Sets the default application based on a system-defined application type or a fil
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -338,7 +338,7 @@ Sets the default application for a user based on a system-defined application ty
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -399,7 +399,7 @@ Sets the default application based on a system-defined application type or a fil
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -458,7 +458,7 @@ Resets the default application based on a system-defined application type or a f
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -508,7 +508,7 @@ Resets the default application for a user based on a system-defined application
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......@@ -559,7 +559,7 @@ Resets the default application based on a system-defined application type or a f
**System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**Parameters**
......
......@@ -291,6 +291,63 @@ try {
}
```
## display.on('privateModeChange')<sup>10+</sup>
on(type: 'privateModeChange', callback: Callback&lt;boolean&gt;): void
Subscribes to privacy mode changes of this display. When there is a privacy window in the foreground of the display, the display is in privacy mode, and the content in the privacy window cannot be captured or recorded.
**System API**: This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at 'privateModeChange', indicating the event of display privacy mode changes.|
| callback | Callback&lt;boolean&gt; | Yes | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.|
**Example**
```js
let callback = (data) => {
console.info('Listening enabled. Data: ' + JSON.stringify(data));
};
try {
display.on("privateModeChange", callback);
} catch (exception) {
console.error('Failed to register callback. Code: ' + JSON.stringify(exception));
}
```
## display.off('privateModeChange')<sup>10+</sup>
off(type: 'privateModeChange', callback?: Callback&lt;boolean&gt;): void
Unsubscribes from privacy mode changes of this display. When there is a privacy window in the foreground of the display, the display is in privacy mode, and the content in the privacy window cannot be captured or recorded.
**System API**: This is a system API.
**System capability**: SystemCapability.WindowManager.WindowManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- |------------------------------------------| ---- | ------------------------------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'privateModeChange'**, indicating the event of display private mode changes.|
| callback | Callback&lt;boolean&gt; | No | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.|
**Example**
```js
try {
display.off("privateModeChange");
} catch (exception) {
console.error('Failed to unregister callback. Code: ' + JSON.stringify(exception));
}
```
## display.getDefaultDisplay<sup>(deprecated)</sup>
getDefaultDisplay(callback: AsyncCallback&lt;Display&gt;): void
......
......@@ -80,9 +80,9 @@ image.createPixelMap(color, opts, (error, pixelmap) => {
## PixelMap<sup>7+</sup>
Provides APIs to read or write image pixel map data and obtain image pixel map information. Before calling any API in **PixelMap**, you must use **createPixelMap** to create a **PixelMap** object.
Provides APIs to read or write image pixel map data and obtain image pixel map information. Before calling any API in **PixelMap**, you must use **createPixelMap** to create a **PixelMap** object. Currently, the maximum size of a serialized pixel map is 128 MB. A larger size will cause a display failure. The size is calculated as follows: Width * Height * Number of bytes occupied by each pixel.
### Attributes
### Attributes
**System capability**: SystemCapability.Multimedia.Image.Core
......@@ -950,7 +950,7 @@ Creates an **ImageSource** instance based on the URI.
```js
// Stage model
const context = getContext(this);
const path = context.getCacheDir() + "/test.jpg";
const path = context.cacheDir() + "/test.jpg";
const imageSourceApi = image.createImageSource(path);
```
......@@ -2227,7 +2227,7 @@ Creates an **ImageCreator** instance by specifying the image width, height, form
| Type | Description |
| ------------------------------ | --------------------------------------- |
| [ImageCreator](#imagecreator9) | Returns an **ImageCreator** instance if the operation is successful.|
| [ImageCreator](#imagecreator9) | Returns an **ImageCreator** instance if the operation is successful.|
**Example**
......@@ -2729,7 +2729,7 @@ Describes image properties.
## PropertyKey<sup>7+</sup>
Describes the exchangeable image file format (EXIF) information of an image.
Describes the exchangeable image file format (EXIF) data of an image.
**System capability**: SystemCapability.Multimedia.Image.Core
......
......@@ -15,10 +15,10 @@ Want is a carrier for information transfer between objects (application componen
| abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.|
| uri | string | No | URI. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags). |
| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: Object} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>**ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags).|
| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: Object} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). |
| moduleName<sup>9+</sup> | string | No | Module to which the ability belongs.|
**Example**
......@@ -41,12 +41,12 @@ Want is a carrier for information transfer between objects (application componen
- Passing a file descriptor (FD) (called in the UIAbility object, where context in the example is the context object of the UIAbility):
```ts
import fileio from '@ohos.fileio';
import fs from '@ohos.file.fs';
// ...
let fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd;
} catch(e) {
console.error('openSync fail: ${JSON.stringify(e)}');
}
......
......@@ -14,16 +14,19 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype';
## Attributes
**System capability**: SystemCapability.MiscServices.InputMethodFramework
**System capability**: SystemCapability.MiscServices.InputMethodFramework
| Name| Type| Readable| Writable| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- |
| label | string | Yes| No| No| Label of the input method subtype.|
| name | string | Yes| No| Yes| Name of the input method subtype.|
| labelId<sup>10+</sup> | string | Yes| No| No| Label ID of the input method subtype.|
| name | string | Yes| No| Yes| Bundle name of the input method.|
| id | string | Yes| No| Yes| ID of the input method subtype.|
| mode | string | Yes| No| No| Mode of the input method subtype, including **upper** (uppercase) and **lower** (lowercase).|
| locale | string | Yes| No| Yes| Locale of the input method subtype.|
| language | string | Yes| No| Yes| Language of the input method subtype.|
| icon | string | Yes| No| No| Icon of the input method subtype.|
| iconId | number | Yes| No| No| Icon ID of the input method subtype.|
| extra | object | Yes| Yes| Yes| Extra information of the input method subtype.|
| extra | object | Yes| Yes| No| Extra information of the input method subtype.<br>**NOTE**<br>This parameter is optional since API version 10.|
# @ohos.inputMethod (Input Method Framework)
The **inputMethod** module provides an input method framework, which can be used to hide the keyboard, obtain the list of installed input methods, display the dialog box for input method selection, and more.
The **inputMethod** module is oriented to common foreground applications (third-party applications and system applications such as Notes, Messaging, and Settings). It provides input method control and management capabilities, including displaying or hiding the soft keyboard, switching between input methods, and obtaining the list of all input methods.
> **NOTE**
>
......@@ -33,10 +33,11 @@ Describes the input method application attributes.
| -------- | -------- | -------- | -------- | -------- |
| name<sup>9+</sup> | string | Yes| No| Internal name of the input method. Mandatory.|
| id<sup>9+</sup> | string | Yes| No| Unique ID of the input method. Mandatory.|
| label<sup>9+</sup> | string | Yes| No| External display name of the input method. Optional.|
| label<sup>9+</sup> | string | Yes| No| External name of the input method. Optional.|
| labelId<sup>10+</sup> | string | Yes| No| External ID of the input method. Optional.|
| icon<sup>9+</sup> | string | Yes| No| Icon of the input method. Optional.|
| iconId<sup>9+</sup> | number | Yes| No| Icon ID of the input method. Optional.|
| extra<sup>9+</sup> | object | Yes| Yes| Extra information about the input method. Mandatory.|
| extra<sup>9+</sup> | object | Yes| Yes| Extra information about the input method. Optional.<br>**NOTE**<br>This parameter is optional since API version 10.|
| packageName<sup>(deprecated)</sup> | string | Yes| No| Name of the input method package. Mandatory.<br>**NOTE**<br>This API is supported since API version 8 and deprecated since API version 9. You are advised to use **name**.|
| methodId<sup>(deprecated)</sup> | string | Yes| No| Unique ID of the input method. Mandatory.<br>**NOTE**<br>This API is supported since API version 8 and deprecated since API version 9. You are advised to use **id**.|
......@@ -231,7 +232,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb
Switches to another subtype of the current input method. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications)
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) <br>**NOTE**<br>Since API version 10, this permission is not required if the caller is the current input method.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -239,7 +240,7 @@ Switches to another subtype of the current input method. This API uses an asynch
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.|
| target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -256,9 +257,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js
try {
inputMethod.switchCurrentInputMethodSubtype({
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
id: "ServiceExtAbility",
label: "",
name: "com.example.kikakeyboard",
mode: "upper",
locale: "",
language: "",
......@@ -287,7 +288,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise&lt;boolean&
Switches to another subtype of the current input method. This API uses a promise to return the result.
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications)
**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) <br>**NOTE**<br>Since API version 10, this permission is not required if the caller is the current input method.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -295,7 +296,7 @@ Switches to another subtype of the current input method. This API uses a promise
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
|target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.|
|target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
**Return value**
......@@ -317,9 +318,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js
try {
inputMethod.switchCurrentInputMethodSubtype({
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
id: "ServiceExtAbility",
label: "",
name: "com.example.kikakeyboard",
mode: "upper",
locale: "",
language: "",
......@@ -352,7 +353,7 @@ Obtains the current input method subtype.
| Type | Description |
| -------------------------------------------- | ------------------------ |
| [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype) | Current input method subtype.|
| [InputMethodSubtype](./js-apis-inputmethod-subtype.md) | Current input method subtype.|
**Example**
......@@ -375,7 +376,7 @@ Switches to a specified subtype of a specified input method. This API uses an as
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
| callback | AsyncCallback&lt;boolean&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -391,25 +392,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js
let im = inputMethod.getCurrentInputMethod();
let inputMethodProperty = {
packageName: im.packageName,
methodId: im.methodId,
name: im.packageName,
id: im.methodId,
extra: {}
}
let imSubType = inputMethod.getCurrentInputMethodSubtype();
try {
inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, {
id: "com.example.kikakeyboard",
label: "ServiceExtAbility",
name: "",
mode: "upper",
locale: "",
language: "",
icon: "",
iconId: 0,
extra: {}
}, (err,result) => {
inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType, (err,result) => {
if (err !== undefined) {
console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err));
return;
......@@ -440,7 +425,7 @@ Switches to a specified subtype of a specified input method. This API uses a pro
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
|inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.|
|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.|
**Return value**
......@@ -461,25 +446,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e
```js
let im = inputMethod.getCurrentInputMethod();
let inputMethodProperty = {
packageName: im.packageName,
methodId: im.methodId,
name: im.packageName,
id: im.methodId,
extra: {}
}
let imSubType = inputMethod.getCurrentInputMethodSubtype();
try {
inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, {
id: im.packageName,
label: im.methodId,
name: "",
mode: "upper",
locale: "",
language: "",
icon: "",
iconId: 0,
extra: {}
}).then((result) => {
inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType).then((result) => {
if (result) {
console.info('Succeeded in switching currentInputMethodAndSubtype.');
} else {
......@@ -886,7 +855,7 @@ inputMethodController.off('selectByRange');
on(type: 'selectByMovement', callback: Callback&lt;Movement&gt;): void
Enables listening for the selection-by-cursor-movement event. This API uses an asynchronous callback to return the result.
Enables listening for the select-by-cursor-movement event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -894,7 +863,7 @@ Enables listening for the selection-by-cursor-movement event. This API uses an a
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the selection-by-cursor-movement event.|
| type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the select-by-cursor-movement event.|
| callback | Callback&lt;[Movement](./js-apis-inputmethod-InputMethodCommon.md#movement)&gt; | Yes | Callback used to return the range of the text to be selected.<br>Your application needs to select the text in the returned range in the text box.|
**Example**
......@@ -909,7 +878,7 @@ inputMethodController.on('selectByMovement', (movement) => {
off(type: 'selectByMovement'): void
Disables listening for the selection-by-cursor-movement event.
Disables listening for the select-by-cursor-movement event.
**System capability**: SystemCapability.MiscServices.InputMethodFramework
......@@ -917,7 +886,7 @@ Disables listening for the selection-by-cursor-movement event.
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the selection-by-cursor-movement event.|
| type | string | Yes | Listening type.<br>The value **selectByMovement** indicates the select-by-cursor-movement event.|
**Example**
......@@ -942,7 +911,7 @@ Enables listening for the input method and subtype change event. This API uses a
| Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | Yes| Callback used to return the input method attributes and subtype.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | Yes| Callback used to return the input method attributes and subtype.|
**Example**
......@@ -965,7 +934,7 @@ Disables listening for the input method and subtype change event. This API uses
| Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>The value **'imeChange'** indicates the input method and subtype change event.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | No| Callback used to return the input method attributes and subtype.|
| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | No| Callback used to return the input method attributes and subtype.|
**Example**
......@@ -986,7 +955,7 @@ Obtains all subtypes of a specified input method. This API uses an asynchronous
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| inputMethodProperty | InputMethodProperty| Yes| Input method to which the subtypes belong.|
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>&gt; | Yes| Callback used to return all subtypes of the specified input method.|
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>&gt; | Yes| Callback used to return all subtypes of the specified input method.|
**Error codes**
......@@ -1038,7 +1007,7 @@ Obtains all subtypes of a specified input method. This API uses a promise to ret
| Type | Description |
| ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Promise used to return all subtypes of the specified input method.|
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Promise used to return all subtypes of the specified input method.|
**Error codes**
......@@ -1082,7 +1051,7 @@ Obtains all subtypes of this input method. This API uses an asynchronous callbac
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>&gt; | Yes | Callback used to return all subtypes of the current input method.|
| callback | AsyncCallback&lt;Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>&gt; | Yes | Callback used to return all subtypes of the current input method.|
**Error codes**
......@@ -1121,7 +1090,7 @@ Obtains all subtypes of this input method. This API uses a promise to return the
| Type | Description |
| ----------------------------------------------------------- | ---------------------- |
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Promise used to return all subtypes of the current input method.|
| Promise<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Promise used to return all subtypes of the current input method.|
**Error codes**
......
......@@ -29,7 +29,7 @@ Obtains the launcher ability information based on the given bundle name and user
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.|
| bundleName | string | Yes | Bundle name.|
| userId | number | Yes | User ID.|
**Return value**
......@@ -45,7 +45,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17700001 | The specified bundle name is not found. |
| 17700004 | The specified userId is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
......@@ -55,12 +55,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
try {
launcherBundleManager.getLauncherAbilityInfo('com.example.demo', 100, (errData, data) => {
if (errData !== null) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else {
console.log("data is " + JSON.stringify(data));
}
console.log("data is " + JSON.stringify(data));
})
} catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}
```
......@@ -80,7 +81,7 @@ Obtains the launcher ability information based on the given bundle name and user
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.|
| bundleName | string | Yes | Bundle name.|
| userId | number | Yes | User ID.|
**Return value**
......@@ -96,7 +97,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17700001 | The specified bundle name is not found. |
| 17700004 | The specified userId is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
......@@ -107,10 +108,10 @@ try {
launcherBundleManager.getLauncherAbilityInfo("com.example.demo", 100).then(data => {
console.log("data is " + JSON.stringify(data));
}).catch (errData => {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
})
} catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}
```
......@@ -144,7 +145,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17700004 | The specified userId is not found. |
| 17700004 | The specified user ID is not found. |
Example
......@@ -154,12 +155,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
try {
launcherBundleManager.getAllLauncherAbilityInfo(100, (errData, data) => {
if (errData !== null) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else {
console.log("data is " + JSON.stringify(data));
}
console.log("data is " + JSON.stringify(data));
});
} catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}
```
## launcherBundlemanager.getAllLauncherAbilityInfo<sup>9+</sup>
......@@ -192,7 +194,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17700004 | The specified userId is not found. |
| 17700004 | The specified user ID is not found. |
**Example**
......@@ -203,10 +205,10 @@ try {
launcherBundleManager.getAllLauncherAbilityInfo(100).then(data => {
console.log("data is " + JSON.stringify(data));
}).catch (errData => {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
});
} catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}
```
......@@ -224,7 +226,7 @@ Obtains the shortcut information of the current user based on the given bundle n
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.|
| bundleName | string | Yes | Bundle name.|
**Return value**
......@@ -248,12 +250,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
try {
launcherBundleManager.getShortcutInfo("com.example.demo", (errData, data) => {
if (errData !== null) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
} else {
console.log("data is " + JSON.stringify(data));
}
console.log("data is " + JSON.stringify(data));
});
} catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}
```
......@@ -271,7 +274,7 @@ Obtains the shortcut information of the current user based on the given bundle n
| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the application.|
| bundleName | string | Yes | Bundle name.|
**Return value**
......@@ -296,9 +299,9 @@ try {
launcherBundleManager.getShortcutInfo("com.example.demo").then(data => {
console.log("data is " + JSON.stringify(data));
}).catch (errData => {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
});
} catch (errData) {
console.log(`errData is errCode:${errData.code} message:${errData.message}`);
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
}
```
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册