diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md index 8484845fb47d82c6de79664c00d0d1c234b0e167..a627e1116a792c5d4fc885ae01aa6ccb172b7b1d 100644 --- a/en/application-dev/Readme-EN.md +++ b/en/application-dev/Readme-EN.md @@ -65,12 +65,13 @@ - [Internationalization](internationalization/Readme-EN.md) - [Application Test](application-test/Readme-EN.md) - [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - - [Using Native APIs in Application Projects](napi/Readme-EN.md) + - [Native APIs](napi/Readme-EN.md) - Tools - - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) + - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) + - [Debugging Tools](tools/Readme-EN.md) - Hands-On Tutorials - - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) - - [Codelabs](https://gitee.com/openharmony/codelabs) + - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) + - [Codelabs](https://gitee.com/openharmony/codelabs) - API References - [SystemCapability](reference/syscap.md) - [SystemCapability List](reference/syscap-list.md) diff --git a/en/application-dev/application-models/ability-startup-with-implicit-want.md b/en/application-dev/application-models/ability-startup-with-implicit-want.md index ab116c430cb7b248b947ccbee46cf5ac932f9fc9..6550e5c628c642cf227cfde5f74eef7b61c8a52b 100644 --- a/en/application-dev/application-models/ability-startup-with-implicit-want.md +++ b/en/application-dev/application-models/ability-startup-with-implicit-want.md @@ -60,13 +60,7 @@ The **module.json5** of a browser application is as follows: } catch (error) { console.info(`explicit start ability failed with ${error.code}`) } - let context = getContext(this) as common.UIAbilityContext; - await context.startAbility(want) - console.info(`explicit start ability succeed`) - } catch (error) { - console.info(`explicit start ability failed with ${error.code}`) - } - } + } ``` The matching process is as follows: @@ -79,4 +73,5 @@ The **module.json5** of a browser application is as follows: 4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills**, the matching is successful. 2. When there are multiple matching applications, a dialog box is displayed for you to select one of them. -stage-want1 + + ![stage-want1](figures/stage-want1.png) diff --git a/en/application-dev/application-models/application-context-stage.md b/en/application-dev/application-models/application-context-stage.md index 8d49b7369bb93e26f4407313f2d9352acd7380e1..0bd91dbd92d4621dbd59fe4bbb77d40a8fbaa77f 100644 --- a/en/application-dev/application-models/application-context-stage.md +++ b/en/application-dev/application-models/application-context-stage.md @@ -6,10 +6,12 @@ [Context](../reference/apis/js-apis-inner-application-context.md) is the context of an object in an application. It provides basic information about the application, for example, **resourceManager**, **applicationInfo**, **dir** (application development path), and **area** (encrypted area). It also provides basic methods such as **createBundleContext()** and **getApplicationContext()**. The UIAbility component and ExtensionAbility derived class components have their own **Context** classes, for example, the base class **Context**, **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, **ExtensionContext**, and **ServiceExtensionContext**. - The figure below illustrates the inheritance relationship of contexts. - context-inheritance + + ![context-inheritance](figures/context-inheritance.png) - The figure below illustrates the holding relationship of contexts. - context-holding + + ![context-holding](figures/context-holding.png) - The following describes the information provided by different contexts. - [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md): Each UIAbility has the **Context** attribute, which provides APIs to operate the ability, obtain the ability configuration, and more. @@ -89,7 +91,8 @@ The following table describes the application development paths obtained from co The capability of obtaining the application development path is provided by the base class **Context**. This capability is also provided by **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, and **ExtensionContext**. However, the paths obtained from different contexts may differ, as shown below. **Figure 1** Application development paths obtained from context -context-dir + +![context-dir](figures/context-dir.png) - Obtain the application-level path through **ApplicationContext**. It is recommended that global application information be stored in this path. Files stored in this path will be deleted only when the application is uninstalled. | Name| Path| @@ -174,7 +177,7 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] > > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). > -> - This is a system API and cannot be called by third-party applications. + > - This is a system API and cannot be called by third-party applications. For example, application information displayed on the home screen includes the application name and icon. The home screen application calls the foregoing method to obtain the context information, so as to obtain the resource information including the application name and icon. @@ -189,7 +192,7 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] // ... } } -``` + ``` - Call **createModuleContext(bundleName:string, moduleName:string)** to obtain the context of a specified module of another application. After obtaining the context, you can obtain the resource information of that module. > **NOTE** @@ -198,7 +201,7 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] > > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). > -> - This is a system API and cannot be called by third-party applications. + > - This is a system API and cannot be called by third-party applications. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; diff --git a/en/application-dev/application-models/data-share-via-want.md b/en/application-dev/application-models/data-share-via-want.md index 4ecdf35ead5482d4b4b2e0d0a2a4544e75686612..c04bea2916647804b51022cee1853f3b5d0a7d90 100644 --- a/en/application-dev/application-models/data-share-via-want.md +++ b/en/application-dev/application-models/data-share-via-want.md @@ -67,7 +67,7 @@ Users often need to share data (such as a text or an image) from one application For example, when **"ability.picker.type"** is **"application/pdf"**, **"ability.picker.fileNames"** is **"["APIs.pdf"]"**, and **"ability.picker.fileSizes"** is **"[350 \* 1024]"**, the application selector is displayed as follows: - stage-want2 + ![stage-want2](figures/stage-want2.png) In the preceding code, the **ability.want.params.INTENT** field is nested Want. In this field, **action** and **type** are used for implicit matching by the application selector. For details about implicit matching, see [Matching Rules of Implicit Want](explicit-implicit-want-mappings.md#matching-rules-of-implicit-want). After the user selects an application, the nested Want of the **ability.want.params.INTENT** field is passed to that application. diff --git a/en/application-dev/application-models/explicit-implicit-want-mappings.md b/en/application-dev/application-models/explicit-implicit-want-mappings.md index ccf33e07d1b389eb1246a89a377febb1e7d24a78..d2c44bb4b47eff6347d6b4a6c098feadb7a9eead 100644 --- a/en/application-dev/application-models/explicit-implicit-want-mappings.md +++ b/en/application-dev/application-models/explicit-implicit-want-mappings.md @@ -61,7 +61,8 @@ The system matches the [action](../reference/apis/js-apis-ability-wantConstant.m - If **action** in the passed **want** parameter is specified, and **actions** under **skills** of an ability is specified but does not contain **action** in the passed **want** parameter, the matching fails. **Figure 1** Matching rules of action in the want parameter - want-action + + ![want-action](figures/want-action.png) ### Matching Rules of entities in the want Parameter @@ -78,8 +79,9 @@ The system matches the [entities](../reference/apis/js-apis-ability-wantConstant - If **entities** in the passed **want** parameter is specified, and **entities** under **skills** of an ability is specified but does not contain **entities** in the passed **want** parameter, the matching fails. - Figure 2 Matching rule of entities in the want parameter -want-entities + Figure 2 Matching rule of entities in the want parameter + + ![want-entities](figures/want-entities.png) ### Matching Rules of uri and type in the want Parameter @@ -87,7 +89,8 @@ The system matches the [entities](../reference/apis/js-apis-ability-wantConstant When the **uri** and **type** parameters are specified in the **want** parameter to initiate a component startup request, the system traverses the list of installed components and matches the **uris** array under **skills** of the abilities one by one. If one of the **uris** arrays under **skills** matches the **uri** and **type** in the passed **want**, the matching is successful. Figure 3 Matching rules when uri and type are specified in the want parameter -want-uri-type1 + +![want-uri-type1](figures/want-uri-type1.png) There are four combinations of **uri** and **type** settings. The matching rules are as follows: @@ -113,7 +116,8 @@ To simplify the description, **uri** and **type** passed in the **want** paramet Figure 4 Matching rules of uri and type in the want parameter -want-uri-type2 + +![want-uri-type2](figures/want-uri-type2.png) ### Matching Rules of uri diff --git a/en/application-dev/application-models/inter-device-interaction-hop-overview.md b/en/application-dev/application-models/inter-device-interaction-hop-overview.md index 6b1fd28b489f0d6d891abd9dffa0bcaf0f1b9ead..8a6cb49f86ff60655037955aaba1b00a5ff40a17 100644 --- a/en/application-dev/application-models/inter-device-interaction-hop-overview.md +++ b/en/application-dev/application-models/inter-device-interaction-hop-overview.md @@ -35,8 +35,9 @@ OpenHarmony provides a set of APIs for you to implement continuation in your app The following figure shows the continuation architecture. - **Figure 1** Continuation architecture -hop-structure + **Figure 1** Continuation architecture + + ![hop-structure](figures/hop-structure.png) - Cross-device migration task management: The initiator accepts a migration request from the user, provides a migration entry, and displays the migration result. (This capability is unavailable yet.) diff --git a/en/application-dev/application-models/uiability-data-sync-with-ui.md b/en/application-dev/application-models/uiability-data-sync-with-ui.md index 981a9212892a8bc1a920ac929608685c3eafeb00..f53627e974a0f9b4b1323d7694f94e07ebf51753 100644 --- a/en/application-dev/application-models/uiability-data-sync-with-ui.md +++ b/en/application-dev/application-models/uiability-data-sync-with-ui.md @@ -92,7 +92,8 @@ Before using EventHub, you must obtain an EventHub object, which is provided by **globalThis** is a global object inside the [ArkTS engine instance](thread-model-stage.md) and can be used by UIAbility, ExtensionAbility, and Page inside the engine. Therefore, you can use **globalThis** for data synchronization. **Figure 1** Using globalThis for data synchronization -globalThis1 + + ![globalThis1](figures/globalThis1.png) The following describes how to use **globalThis** in three scenarios. Precautions are provided as well. @@ -209,6 +210,7 @@ To implement data synchronization between the UIAbility and ExtensionAbility com ### Precautions for Using globalThis **Figure 2** Precautions for globalThis + ![globalThis2](figures/globalThis2.png) - In the stage model, all the UIAbility components in a process share one ArkTS engine instance. When using **globalThis**, do not store objects with the same name. For example, if AbilityA and AbilityB use **globalThis** to store two objects with the same name, the object stored earlier will be overwritten. diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md index ea6b8bbecfa4a9a4f5434fb0aa5aad6184f38c9f..78363a3a2b65bee17a2ea7524b2fe7180de38909 100644 --- a/en/application-dev/application-models/uiability-intra-device-interaction.md +++ b/en/application-dev/application-models/uiability-intra-device-interaction.md @@ -197,7 +197,7 @@ This section describes how to start the UIAbility of another application through The following figure shows the effect. When you click **Open PDF**, a dialog box is displayed for you to select. - uiability-intra-device-interaction + ![uiability-intra-device-interaction](figures/uiability-intra-device-interaction.png) 3. To stop the **UIAbility** instance after the document application is used, call **terminateSelf()**. @@ -445,7 +445,7 @@ The following figure shows the ability call process. **Figure 1** Ability call process -call +![call](figures/call.png) - The caller ability uses **startAbilityByCall** to obtain a caller object and uses **call()** of the caller object to send data to the callee ability. diff --git a/en/application-dev/application-models/uiability-launch-type.md b/en/application-dev/application-models/uiability-launch-type.md index cda8307ddd3dae6f7cceac3fad134ef510d7383c..70c212ed46e769dbdf4e0c1fd347403c463f6004 100644 --- a/en/application-dev/application-models/uiability-launch-type.md +++ b/en/application-dev/application-models/uiability-launch-type.md @@ -19,7 +19,7 @@ Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbility **Figure 1** Demonstration effect in singleton mode -uiability-launch-type1 +![uiability-launch-type1](figures/uiability-launch-type1.png) > **NOTE** > @@ -49,7 +49,7 @@ In standard mode, each time [startAbility()](../reference/apis/js-apis-inner-app **Figure 2** Demonstration effect in standard mode -standard-mode +![standard-mode](figures/standard-mode.png) To use the standard mode, set **launchType** in the [module.json5 configuration file](../quick-start/module-configuration-file.md) to **standard**. @@ -75,7 +75,7 @@ The **specified** mode is used in some special scenarios. For example, in a docu **Figure 3** Demonstration effect in specified mode -uiability-launch-type2 +![uiability-launch-type2](figures/uiability-launch-type2.png) For example, there are EntryAbility and SpecifiedAbility, and the launch type of SpecifiedAbility is set to **specified**. You are required to start SpecifiedAbility from EntryAbility. diff --git a/en/application-dev/application-models/uiability-lifecycle.md b/en/application-dev/application-models/uiability-lifecycle.md index 9ec701cbffd4da51098d5dc448addd88f26ee47e..57200abb8fbfb625e2e6c8999da5ad817e2e85b4 100644 --- a/en/application-dev/application-models/uiability-lifecycle.md +++ b/en/application-dev/application-models/uiability-lifecycle.md @@ -7,8 +7,9 @@ When a user opens, switches, and returns to an application, the UIAbility instan The lifecycle of UIAbility has four states: **Create**, **Foreground**, **Background**, and **Destroy**, as shown in the figure below. -**Figure 1** UIAbility lifecycle states -Ability-Life-Cycle +**Figure 1** UIAbility lifecycle states + +![Ability-Life-Cycle](figures/Ability-Life-Cycle.png) ## Description of Lifecycle States @@ -36,8 +37,9 @@ export default class EntryAbility extends UIAbility { After the UIAbility instance is created but before it enters the **Foreground** state, the system creates a WindowStage instance and triggers the **onWindowStageCreate()** callback. You can set UI loading and WindowStage event subscription in the callback. -**Figure 2** WindowStageCreate and WindowStageDestory -Ability-Life-Cycle-WindowStage +**Figure 2** WindowStageCreate and WindowStageDestory + +![Ability-Life-Cycle-WindowStage](figures/Ability-Life-Cycle-WindowStage.png) In the **onWindowStageCreate()** callback, use [loadContent()](../reference/apis/js-apis-window.md#loadcontent9-2) to set the page to be loaded, and call [on('windowStageEvent')](../reference/apis/js-apis-window.md#onwindowstageevent9) to subscribe to [WindowStage events](../reference/apis/js-apis-window.md#windowstageeventtype9), for example, having or losing focus, or becoming visible or invisible. diff --git a/en/application-dev/application-models/want-overview.md b/en/application-dev/application-models/want-overview.md index f8239c64cf43a0df0acca0bc1ec0e3be914eecfe..21c79d517fc237cae9b9bab7d5347ffc82766d5a 100644 --- a/en/application-dev/application-models/want-overview.md +++ b/en/application-dev/application-models/want-overview.md @@ -5,8 +5,9 @@ [Want](../reference/apis/js-apis-app-ability-want.md) is used as the carrier to transfer information between application components. It is used as a parameter of **startAbility()** to specify the startup target and information that needs to be carried during startup, for example, **bundleName** and **abilityName**, which respectively indicate the bundle name of the target ability and the ability name in the bundle. For example, when UIAbilityA starts UIAbilityB and needs to transfer some data to UIAbilityB, it can use Want to transfer the data. -**Figure 1** Want usage -usage-of-want +**Figure 1** Want usage + +![usage-of-want](figures/usage-of-want.png) ## Types of Want diff --git a/en/application-dev/device/usb-guidelines.md b/en/application-dev/device/usb-guidelines.md index 64eee37cf1f0e34a58f5805d13be4cec77cb1498..696fd8e06d2d32c7bf083859bea40be81535352d 100644 --- a/en/application-dev/device/usb-guidelines.md +++ b/en/application-dev/device/usb-guidelines.md @@ -26,7 +26,7 @@ The following table lists the USB APIs currently available. For details, see the | releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | Releases a USB interface. | | getFileDescriptor(pipe: USBDevicePipe): number | Obtains the file descriptor. | | getRawDescriptor(pipe: USBDevicePipe): Uint8Array | Obtains the raw USB descriptor. | -| controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout ?: number): Promise\ | Performs control transfer. | +| controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise\ | Performs control transfer. | ## How to Develop @@ -118,11 +118,11 @@ You can set a USB device as the USB host to connect to other USB devices for dat 4. Perform data transfer. - ```js - /* - Read data. Select the corresponding RX endpoint from deviceList for data transfer. - (endpoint.direction == 0x80); dataUint8Array indicates the data to read. The data type is Uint8Array. - */ + ```js + /* + Read data. Select the corresponding RX endpoint from deviceList for data transfer. + (endpoint.direction == 0x80); dataUint8Array indicates the data to read. The data type is Uint8Array. + */ let inEndpoint = interface1.endpoints[2]; let outEndpoint = interface1.endpoints[1]; let dataUint8Array = new Uint8Array(1024); @@ -147,7 +147,7 @@ You can set a USB device as the USB host to connect to other USB devices for dat }).catch(error => { console.info("usb writeData error : " + JSON.stringify(error)); }); - ``` + ``` 5. Release the USB interface, and close the USB device. diff --git a/en/application-dev/media/avsession-guidelines.md b/en/application-dev/media/avsession-guidelines.md index 6106509fbfe30a7b437ec574843f50cd7bf1aceb..6b047bc2e2ae30aba69e73b1176b12226f0a28a7 100644 --- a/en/application-dev/media/avsession-guidelines.md +++ b/en/application-dev/media/avsession-guidelines.md @@ -187,7 +187,7 @@ currentSession.on('playNext', () => { }); console.log ("Call AudioPlayer.play."); // Set the playback state information. - let time = (new Data()).getTime(); + let time = (new Date()).getTime(); currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PLAY, position: {elapsedTime: 0, updateTime: time}, bufferedTime:2000}).then(() => { console.info('setAVPlaybackState successfully'); }).catch((err) => { @@ -282,7 +282,7 @@ currentSession.off('outputDeviceChange'); // Deactivate the session and destroy the object. currentSession.deactivate().then(() => { - currentSession.destory(); + currentSession.destroy(); }); ``` diff --git a/en/application-dev/napi/drawing-guidelines.md b/en/application-dev/napi/drawing-guidelines.md index 1355a27dcf7fb5e54a283ccd5c39a4f1b19de381..a48a081a3e69ea8259727efd343264f80c6cc284 100644 --- a/en/application-dev/napi/drawing-guidelines.md +++ b/en/application-dev/napi/drawing-guidelines.md @@ -118,9 +118,9 @@ The following steps describe how to use the canvas and brush of the Native Drawi // Draw a pentagram on the canvas. The outline of the pentagram is drawn by the pen, and the color is filled in by the brush. OH_Drawing_CanvasDrawPath(cCanvas, cPath); // Destroy the created objects when they are no longer needed. - OH_Drawing_BrushDestory(cBrush); - OH_Drawing_PenDestory(cPen); - OH_Drawing_PathDestory(cPath); + OH_Drawing_BrushDestroy(cBrush); + OH_Drawing_PenDestroy(cPen); + OH_Drawing_PathDestroy(cPath); ``` 6. **Obtain pixel data.** Use `OH_Drawing_BitmapGetPixels` in `drawing_bitmap.h` to obtain the pixel address of the bitmap bound to the canvas. The memory to which the address points contains the pixel data of the drawing on the canvas. @@ -133,9 +133,9 @@ The following steps describe how to use the canvas and brush of the Native Drawi LOGI("memcpy_s failed"); } // Destroy the canvas object. - OH_Drawing_CanvasDestory(cCanvas); + OH_Drawing_CanvasDestroy(cCanvas); // Destroy the bitmap object. - OH_Drawing_BitmapDestory(cBitmap); + OH_Drawing_BitmapDestroy(cBitmap); ``` ## Development Procedure for Text Drawing diff --git a/en/application-dev/napi/native-window-guidelines.md b/en/application-dev/napi/native-window-guidelines.md index a71a261c8d2dc6cee74e79deff99d50814a00007..f5a5ead9c083217c77692b34384f969c4b44dc00 100644 --- a/en/application-dev/napi/native-window-guidelines.md +++ b/en/application-dev/napi/native-window-guidelines.md @@ -29,20 +29,72 @@ The following scenarios are common for native window development: | OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow \*window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t \*metaData) | Sets the HDR static metadata set of the native window.| | OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow \*window, const OHExtDataHandle \*handle) | Sets the tunnel handle to the native window.| - ## How to Develop The following describes how to use the NAPI provided by **NativeWindow** to request a graphics buffer, write the produced graphics content to the buffer, and flush the buffer to the graphics queue. -1. Obtain a **NativeWindow** instance. For example, use **Surface** to create a **NativeWindow** instance. - ```c++ - sptr cSurface = Surface::CreateSurfaceAsConsumer(); - sptr listener = new BufferConsumerListenerTest(); - cSurface->RegisterConsumerListener(listener); - sptr producer = cSurface->GetProducer(); - sptr pSurface = Surface::CreateSurfaceAsProducer(producer); - OHNativeWindow* nativeWindow = OH_NativeWindow_CreateNativeWindow(&pSurface); - ``` +1. Obtain a **NativeWindow** instance, which can be obtained by running the APIs provided by **OH_NativeXComponent_Callback**. + 1. Define **XComponent** in an .ets file. + ```ts + XComponent({ id: 'xcomponentId', type: 'surface', libraryname: 'nativerender'}) + .onLoad((context) => { + this.context = context; + }) + .onDestroy(() => { + }) + ``` + 2. Obtain **NativeXComponent** at the native C++ layer. + ```c++ + napi_value exportInstance = nullptr; + napi_get_named_property(env, exports, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance); + + OH_NativeXComponent *nativeXComponent = nullptr; + napi_unwrap(env, exportInstance, reinterpret_cast(&nativeXComponent)); + + char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = { }; + uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1; + OH_NativeXComponent_GetXComponentId(nativeXComponent, idStr, &idSize); + ``` + 3. Define **OH_NativeXComponent_Callback**. + ```c++ + // Define the callback. + void OnSurfaceCreatedCB(OH_NativeXComponent* component, void* window) + { + // Obtain a NativeWindow instance. + OHNativeWindow* nativeWindow = window; + // ... + } + void OnSurfaceChangedCB(OH_NativeXComponent* component, void* window) + { + // Obtain a NativeWindow instance. + OHNativeWindow* nativeWindow = window; + // ... + } + void OnSurfaceDestroyedCB(OH_NativeXComponent* component, void* window) + { + // Obtain a NativeWindow instance. + OHNativeWindow* nativeWindow = window; + // ... + } + void DispatchTouchEventCB(OH_NativeXComponent* component, void* window) + { + // Obtain a NativeWindow instance. + OHNativeWindow* nativeWindow = window; + // ... + } + ``` + ```c++ + // Initialize OH_NativeXComponent_Callback. + OH_NativeXComponent_Callback callback_; + callback_->OnSurfaceCreated = OnSurfaceCreatedCB; + callback_->OnSurfaceChanged = OnSurfaceChangedCB; + callback_->OnSurfaceDestroyed = OnSurfaceDestroyedCB; + callback_->DispatchTouchEvent = DispatchTouchEventCB; + ``` + 4. Register **OH_NativeXComponent_Callback** with **NativeXComponent**. + ```c++ + OH_NativeXComponent_RegisterCallback(nativeXComponent, &callback_); + ``` 2. Set the attributes of a native window buffer by using **OH_NativeWindow_NativeWindowHandleOpt**. ```c++ @@ -90,7 +142,6 @@ The following describes how to use the NAPI provided by **NativeWindow** to requ ``` 5. Flush the native window buffer to the graphics queue. - ```c++ // Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the native window buffer are changed. Region region{nullptr, 0}; diff --git a/en/application-dev/quick-start/app-configuration-file.md b/en/application-dev/quick-start/app-configuration-file.md index 3fff90e0682c4f79e63fa0ee8306a5f8aa7e9385..19e6d16258b06b5a2f613a01061fc6a683488ee2 100644 --- a/en/application-dev/quick-start/app-configuration-file.md +++ b/en/application-dev/quick-start/app-configuration-file.md @@ -30,21 +30,21 @@ This document gives an overview of the **app.json5** configuration file. To star As shown above, the **app.json5** file contains several tags. - **Table 1** Tags in the app.json5 file +**Table 1** Tags in the app.json5 file | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | bundleName | Bundle name, which uniquely identifies an application. The value must comply with the following rules:
- Consists of letters, digits, underscores (_), and periods (.).
- Starts with a letter.
- Contains 7 to 127 bytes.
You are advised to use the reverse domain name notation, for example, *com.example.demo*, where the first part is the domain suffix **com**, the second part is the vendor/individual name, and the third part is the application name, which can be of multiple levels.
If an application is built with the system source code, you are advised to name it in *com.ohos.demo* notation, where **ohos** signifies that the application is an OpenHarmony system application.| String| No| | debug | Whether the application can be debugged. This tag is generated during compilation and building in DevEco Studio.
- **true**: The application can be debugged.
- **false**: The application cannot be debugged.| Boolean| Yes (initial value: **false**)| -| icon | [Icon of the application](../application-models/application-component-configuration-stage.md). The value is an icon resource index. | String| No| -| label | [Name of the application](../application-models/application-component-configuration-stage.md). The value is a string resource index. | String| No| -| description | Description of the application. The value is a string with a maximum of 255 bytes or a resource index to the description. | String| Yes (initial value: left empty)| +| icon | [Icon of the application](../application-models/application-component-configuration-stage.md). The value is an icon resource index.| String| No| +| label | [Name of the application](../application-models/application-component-configuration-stage.md). The value is a string resource index.| String| No| +| description | Description of the application. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)| | vendor | Vendor of the application. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| | versionCode | Version number of the application. The value is a 32-bit non-negative integer less than 2 to the power of 31. It is used only to determine whether a version is later than another version. A larger value indicates a later version. Ensure that a new version of the application uses a value greater than any of its predecessors. | Number| No| | versionName | Version number of the application displayed to users.
The value consists of only digits and dots. The four-part format *A.B.C.D* is recommended, wherein:
Part 1 (*A*): major version number, which ranges from 0 to 99. A major version consists of major new features or large changes.
Part 2 (*B*): minor version number, which ranges from 0 to 99. A minor version consists of some new features and large bug fixes.
Part 3 (*C*): feature version number, which ranges from 0 to 99. A feature version consists of scheduled new features.
Part 4 (*D*): maintenance release number or patch number, which ranges from 0 to 999. A maintenance release or patch consists of resolution to security flaws or minor bugs.
The value contains a maximum of 127 bytes.| String| No| | minCompatibleVersionCode | Minimum compatible version of the application. It is used to check whether the application is compatible with a version on other devices in the cross-device scenario.| Number| Yes (initial value: value of **versionCode**)| -| minAPIVersion | Minimum API version required for running the application.| Number| Yes (initial value: value of **compatibleSdkVersion** in **bundle-profile.json5**)| -| targetAPIVersion | Target API version required for running the application.| Number| Yes (initial value: value of **compileSdkVersion** in **bundle-profile.json5**)| +| minAPIVersion | Minimum API version required for running the application.| Number| Yes (initial value: value of **compatibleSdkVersion** in **build-profile.json5**)| +| targetAPIVersion | Target API version required for running the application.| Number| Yes (initial value: value of **compileSdkVersion** in **build-profile.json5**)| | apiReleaseType | Type of the target API version required for running the application. The value can be **"CanaryN"**, **"BetaN"**, or **"Release"**, where **N** represents a positive integer.
- **Canary**: indicates a restricted release.
- **Beta**: indicates a publicly released beta version.
- **Release**: indicates a publicly released official version.
The value is set by DevEco Studio reading the stage of the SDK in use.| String| Yes (initial value: set by DevEco Studio)| | distributedNotificationEnabled | Whether distributed notification is enabled for the application. When distributed notification is enabled and device A and device B where the application is installed are on the same distributed network, the devices behave in this way: If device A receives a message, device B will receive a distributed notification prompting the user to check the message received on device A.
- **true**: Distributed notification is enabled.
- **false**: Distributed notification is not enabled.| Boolean| Yes (initial value: **false**)| | entityType | Type of the application. The options are as follows:
- game
- media
- communication
- news
- travel
- utility
- shopping
- education
- kids
- business
- photography
- unspecified| String| Yes (initial value: **"unspecified"**)| diff --git a/en/application-dev/quick-start/application-package-install-uninstall.md b/en/application-dev/quick-start/application-package-install-uninstall.md index 3ccafd9ad3da5f98b9fbd229ff7025863ca105d8..2fad037a9135912fc9a8ca2b48c56af9ffd8583c 100644 --- a/en/application-dev/quick-start/application-package-install-uninstall.md +++ b/en/application-dev/quick-start/application-package-install-uninstall.md @@ -1,8 +1,13 @@ # Application Installation and Uninstallation Process +## Developers +Developers can install and uninstall applications by running debug commands. For details, see [Multi-HAP Development, Debugging, Release, and Deployment Process](multi-hap-release-deployment.md#debugging). -The OpenHarmony bundle manager service module provides APIs for installing, updating, and uninstalling applications. You can call these APIs when needed. After you release your application to the application market, users can install and uninstall it on their device. +**Figure 1** Process of installing and uninstalling an application (applicable to developers) +![hap-intall-uninstall](figures/hap-install-uninstall-developer.png) +## Consumers +When an application has been released to the application market, consumers can install or uninstall the application on their device through the application market. - **Figure 1** Process of installing and uninstalling an application -![hap-intall-uninstall](figures/hap-intall-uninstall.png) +**Figure 2** Process of installing and uninstalling an application (applicable to consumers) +![hap-intall-uninstall](figures/hap-install-uninstall-user.png) \ No newline at end of file diff --git a/en/application-dev/quick-start/figures/hap-install-uninstall-developer.png b/en/application-dev/quick-start/figures/hap-install-uninstall-developer.png new file mode 100644 index 0000000000000000000000000000000000000000..71de207ab9c530c353064a3422c6855eafa7770e Binary files /dev/null and b/en/application-dev/quick-start/figures/hap-install-uninstall-developer.png differ diff --git a/en/application-dev/quick-start/figures/hap-install-uninstall-user.png b/en/application-dev/quick-start/figures/hap-install-uninstall-user.png new file mode 100644 index 0000000000000000000000000000000000000000..2cd71657b6bb0af0a4d5094d09ebe028807518be Binary files /dev/null and b/en/application-dev/quick-start/figures/hap-install-uninstall-user.png differ diff --git a/en/application-dev/quick-start/figures/hap-intall-uninstall.png b/en/application-dev/quick-start/figures/hap-intall-uninstall.png deleted file mode 100644 index de04aa18f5053de48dd0b595c8265c781e36fee5..0000000000000000000000000000000000000000 Binary files a/en/application-dev/quick-start/figures/hap-intall-uninstall.png and /dev/null differ diff --git a/en/application-dev/quick-start/multi-hap-release-deployment.md b/en/application-dev/quick-start/multi-hap-release-deployment.md index 785f476bf2fa508470d433477f4e1139e76589fd..ec688879ebb61ceb595feb974f2276d700479ef5 100644 --- a/en/application-dev/quick-start/multi-hap-release-deployment.md +++ b/en/application-dev/quick-start/multi-hap-release-deployment.md @@ -28,12 +28,12 @@ You can use DevEco Studio to build code into one or more HAP files. Then, you ca uninstall bundle successfully. ``` -* Using Bundle Manager (bm) for debugging +* Using [Bundle Manager (bm)](../../application-dev/tools/bm-tool.md) for debugging When using bm to install or update an HAP file, the HAP file path is the one on the real device. The command reference is as follows: ``` // Installation and update: Multiple file paths can be specified. - bm install -p /data/app/entry.hap /data/app/ feature.hap + bm install -p /data/app/entry.hap /data/app/feature.hap // The execution result is as follows: install bundle successfully. // Uninstall diff --git a/en/application-dev/quick-start/start-with-ets-fa.md b/en/application-dev/quick-start/start-with-ets-fa.md index 66f2ead3d35e72950a81c5495db14254210c8c2b..197765c3119690c7529469daa85a045d7c2853fd 100644 --- a/en/application-dev/quick-start/start-with-ets-fa.md +++ b/en/application-dev/quick-start/start-with-ets-fa.md @@ -223,7 +223,10 @@ You can implement page redirection through the [page router](../reference/apis/j .height('5%') // Bind the onClick event to the Next button so that clicking the button redirects the user to the second page. .onClick(() => { - router.pushUrl({ url: 'pages/second' }) + router.push({ url: 'pages/second' }) + // In a project of API version 9, you can use the API below instead: + // router.pushUrl({ url: 'pages/second' }) + }) } .width('100%') diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 3b22116a55aba76372da470a3cca5152ea181475..b1b7419a32599978dfb561452d56a139df835919 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -4,70 +4,70 @@ - Ability Framework - Stage Model (Recommended) - - [@ohos.app.ability.Ability](js-apis-app-ability-ability.md) - - [@ohos.app.ability.AbilityConstant](js-apis-app-ability-abilityConstant.md) - - [@ohos.app.ability.abilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md) - - [@ohos.app.ability.AbilityStage](js-apis-app-ability-abilityStage.md) - - [@ohos.app.ability.common](js-apis-app-ability-common.md) - - [@ohos.app.ability.contextConstant](js-apis-app-ability-contextConstant.md) - - [@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md) - - [@ohos.app.ability.ExtensionAbility](js-apis-app-ability-extensionAbility.md) - - [@ohos.app.ability.ServiceExtensionAbility](js-apis-app-ability-serviceExtensionAbility.md) - - [@ohos.app.ability.StartOptions](js-apis-app-ability-startOptions.md) - - [@ohos.app.ability.UIAbility](js-apis-app-ability-uiAbility.md) - - [@ohos.app.form.FormExtensionAbility](js-apis-app-form-formExtensionAbility.md) - - [@ohos.application.DataShareExtensionAbility](js-apis-application-dataShareExtensionAbility.md) - - [@ohos.application.StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md) + - [@ohos.app.ability.Ability (Ability Base Class)](js-apis-app-ability-ability.md) + - [@ohos.app.ability.AbilityConstant (AbilityConstant)](js-apis-app-ability-abilityConstant.md) + - [@ohos.app.ability.abilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-app-ability-abilityLifecycleCallback.md) + - [@ohos.app.ability.AbilityStage (AbilityStage)](js-apis-app-ability-abilityStage.md) + - [@ohos.app.ability.common (Context)](js-apis-app-ability-common.md) + - [@ohos.app.ability.contextConstant (ContextConstant)](js-apis-app-ability-contextConstant.md) + - [@ohos.app.ability.EnvironmentCallback (EnvironmentCallback)](js-apis-app-ability-environmentCallback.md) + - [@ohos.app.ability.ExtensionAbility (ExtensionAbility Base Class)](js-apis-app-ability-extensionAbility.md) + - [@ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-app-ability-serviceExtensionAbility.md) + - [@ohos.app.ability.StartOptions (StartOptions)](js-apis-app-ability-startOptions.md) + - [@ohos.app.ability.UIAbility (UIAbility)](js-apis-app-ability-uiAbility.md) + - [@ohos.app.form.FormExtensionAbility (FormExtensionAbility)](js-apis-app-form-formExtensionAbility.md) + - [@ohos.application.DataShareExtensionAbility (DataShare Extension Ability)](js-apis-application-dataShareExtensionAbility.md) + - [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md) - Stage Model (To Be Deprecated Soon) - - [@ohos.application.Ability](js-apis-application-ability.md) - - [@ohos.application.AbilityConstant](js-apis-application-abilityConstant.md) - - [@ohos.application.AbilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md) - - [@ohos.application.AbilityStage](js-apis-application-abilityStage.md) - - [@ohos.application.context](js-apis-application-context.md) - - [@ohos.application.EnvironmentCallback](js-apis-application-environmentCallback.md) - - [@ohos.application.ExtensionAbility](js-apis-application-extensionAbility.md) - - [@ohos.application.FormExtension](js-apis-application-formExtension.md) - - [@ohos.application.ServiceExtensionAbility](js-apis-application-serviceExtensionAbility.md) - - [@ohos.application.StartOptions](js-apis-application-startOptions.md) + - [@ohos.application.Ability (Ability)](js-apis-application-ability.md) + - [@ohos.application.AbilityConstant (AbilityConstant)](js-apis-application-abilityConstant.md) + - [@ohos.application.AbilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-application-abilityLifecycleCallback.md) + - [@ohos.application.AbilityStage (AbilityStage)](js-apis-application-abilityStage.md) + - [@ohos.application.context (Context)](js-apis-application-context.md) + - [@ohos.application.EnvironmentCallback (EnvironmentCallback)](js-apis-application-environmentCallback.md) + - [@ohos.application.ExtensionAbility (ExtensionAbility)](js-apis-application-extensionAbility.md) + - [@ohos.application.FormExtension (FormExtension)](js-apis-application-formExtension.md) + - [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-application-serviceExtensionAbility.md) + - [@ohos.application.StartOptions (StartOptions)](js-apis-application-startOptions.md) - FA Model - - [@ohos.ability.ability](js-apis-ability-ability.md) - - [@ohos.ability.featureAbility](js-apis-ability-featureAbility.md) - - [@ohos.ability.particleAbility](js-apis-ability-particleAbility.md) + - [@ohos.ability.ability (Ability)](js-apis-ability-ability.md) + - [@ohos.ability.featureAbility (FeatureAbility)](js-apis-ability-featureAbility.md) + - [@ohos.ability.particleAbility (ParticleAbility)](js-apis-ability-particleAbility.md) - Both Models (Recommended) - - [@ohos.app.ability.abilityDelegatorRegistry](js-apis-app-ability-abilityDelegatorRegistry.md) - - [@ohos.app.ability.abilityManager](js-apis-app-ability-abilityManager.md) - - [@ohos.app.ability.appManager](js-apis-app-ability-appManager.md) - - [@ohos.app.ability.appRecovery](js-apis-app-ability-appRecovery.md) - - [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) - - [@ohos.app.ability.ConfigurationConstant](js-apis-app-ability-configurationConstant.md) - - [@ohos.app.ability.errorManager](js-apis-app-ability-errorManager.md) - - [@ohos.app.ability.missionManager](js-apis-app-ability-missionManager.md) - - [@ohos.app.ability.quickFixManager](js-apis-app-ability-quickFixManager.md) - - [@ohos.app.ability.Want](js-apis-app-ability-want.md) - - [@ohos.app.ability.wantAgent](js-apis-app-ability-wantAgent.md) - - [@ohos.app.ability.wantConstant](js-apis-app-ability-wantConstant.md) - - [@ohos.app.form.formBindingData](js-apis-app-form-formBindingData.md) - - [@ohos.app.form.formHost](js-apis-app-form-formHost.md) - - [@ohos.app.form.formInfo](js-apis-app-form-formInfo.md) - - [@ohos.app.form.formProvider](js-apis-app-form-formProvider.md) + - [@ohos.app.ability.abilityDelegatorRegistry (AbilityDelegatorRegistry)](js-apis-app-ability-abilityDelegatorRegistry.md) + - [@ohos.app.ability.abilityManager (AbilityManager)](js-apis-app-ability-abilityManager.md) + - [@ohos.app.ability.appManager (appManager)](js-apis-app-ability-appManager.md) + - [@ohos.app.ability.appRecovery (appRecovery)](js-apis-app-ability-appRecovery.md) + - [@ohos.app.ability.Configuration (Configuration)](js-apis-app-ability-configuration.md) + - [@ohos.app.ability.ConfigurationConstant (ConfigurationConstant)](js-apis-app-ability-configurationConstant.md) + - [@ohos.app.ability.errorManager (ErrorManager)](js-apis-app-ability-errorManager.md) + - [@ohos.app.ability.missionManager (missionManager)](js-apis-app-ability-missionManager.md) + - [@ohos.app.ability.quickFixManager (quickFixManager)](js-apis-app-ability-quickFixManager.md) + - [@ohos.app.ability.Want (Want)](js-apis-app-ability-want.md) + - [@ohos.app.ability.wantAgent (WantAgent)](js-apis-app-ability-wantAgent.md) + - [@ohos.app.ability.wantConstant (wantConstant)](js-apis-app-ability-wantConstant.md) + - [@ohos.app.form.formBindingData (formBindingData)](js-apis-app-form-formBindingData.md) + - [@ohos.app.form.formHost (FormHost)](js-apis-app-form-formHost.md) + - [@ohos.app.form.formInfo (FormInfo)](js-apis-app-form-formInfo.md) + - [@ohos.app.form.formProvider (FormProvider)](js-apis-app-form-formProvider.md) - Both Models (To Be Deprecated Soon) - - [@ohos.ability.dataUriUtils](js-apis-ability-dataUriUtils.md) - - [@ohos.ability.errorCode](js-apis-ability-errorCode.md) - - [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md) - - [@ohos.application.abilityDelegatorRegistry](js-apis-application-abilityDelegatorRegistry.md) - - [@ohos.application.abilityManager](js-apis-application-abilityManager.md) - - [@ohos.application.appManager](js-apis-application-appManager.md) - - [@ohos.application.Configuration](js-apis-application-configuration.md) - - [@ohos.application.ConfigurationConstant](js-apis-application-configurationConstant.md) - - [@ohos.application.errorManager)](js-apis-application-errorManager.md) - - [@ohos.application.formBindingData](js-apis-application-formBindingData.md) - - [@ohos.application.formError](js-apis-application-formError.md) - - [@ohos.application.formHost](js-apis-application-formHost.md) - - [@ohos.application.formInfo](js-apis-application-formInfo.md) - - [@ohos.application.formProvider](js-apis-application-formProvider.md) - - [@ohos.application.missionManager](js-apis-application-missionManager.md) - - [@ohos.application.Want](js-apis-application-want.md) - - [@ohos.wantAgent](js-apis-wantAgent.md) + - [@ohos.ability.dataUriUtils (DataUriUtils)](js-apis-ability-dataUriUtils.md) + - [@ohos.ability.errorCode (ErrorCode)](js-apis-ability-errorCode.md) + - [@ohos.ability.wantConstant (wantConstant)](js-apis-ability-wantConstant.md) + - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](js-apis-application-abilityDelegatorRegistry.md) + - [@ohos.application.abilityManager (AbilityManager)](js-apis-application-abilityManager.md) + - [@ohos.application.appManager (appManager)](js-apis-application-appManager.md) + - [@ohos.application.Configuration (Configuration)](js-apis-application-configuration.md) + - [@ohos.application.ConfigurationConstant (ConfigurationConstant)](js-apis-application-configurationConstant.md) + - [@ohos.application.errorManager (ErrorManager)](js-apis-application-errorManager.md) + - [@ohos.application.formBindingData (formBindingData)](js-apis-application-formBindingData.md) + - [@ohos.application.formError (FormError)](js-apis-application-formError.md) + - [@ohos.application.formHost (FormHost)](js-apis-application-formHost.md) + - [@ohos.application.formInfo (FormInfo)](js-apis-application-formInfo.md) + - [@ohos.application.formProvider (FormProvider)](js-apis-application-formProvider.md) + - [@ohos.application.missionManager (missionManager)](js-apis-application-missionManager.md) + - [@ohos.application.Want (Want)](js-apis-application-want.md) + - [@ohos.wantAgent (WantAgent)](js-apis-wantAgent.md) - Dependent Elements and Definitions - ability - [abilityResult](js-apis-inner-ability-abilityResult.md) @@ -107,7 +107,6 @@ - [MissionListener](js-apis-inner-application-missionListener.md) - [MissionParameter](js-apis-inner-application-missionParameter.md) - [MissionSnapshot](js-apis-inner-application-missionSnapshot.md) - - [PermissionRequestResult](js-apis-inner-application-permissionRequestResult.md) - [ProcessData](js-apis-inner-application-processData.md) - [ProcessRunningInfo](js-apis-inner-application-processRunningInfo.md) - [ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md) @@ -122,26 +121,26 @@ - continuation - [continuationExtraParams](js-apis-continuation-continuationExtraParams.md) - [continuationResult](js-apis-continuation-continuationResult.md) - + - Common Event and Notification - - [@ohos.commonEventManager (Recommended)](js-apis-commonEventManager.md) - - [@ohos.events.emitter](js-apis-emitter.md) - - [@ohos.notificationManager (Recommended)](js-apis-notificationManager.md) - - [@ohos.notificationSubscribe (Recommended)](js-apis-notificationSubscribe.md) - - [@ohos.commonEvent (To Be Deprecated Soon)](js-apis-commonEvent.md) - - [@ohos.notification](js-apis-notification.md) + - [@ohos.commonEventManager (Common Event) (Recommended)](js-apis-commonEventManager.md) + - [@ohos.events.emitter (Emitter)](js-apis-emitter.md) + - [@ohos.notificationManager (NotificationManager) (Recommended)](js-apis-notificationManager.md) + - [@ohos.notificationSubscribe (NotificationSubscribe) (Recommended)](js-apis-notificationSubscribe.md) + - [@ohos.commonEvent (Common Event) (To Be Deprecated Soon)](js-apis-commonEvent.md) + - [@ohos.notification (Notification) (To Be Deprecated Soon)](js-apis-notification.md) - application - [EventHub](js-apis-inner-application-eventHub.md) - Bundle Management - - [@ohos.bundle.appControl](js-apis-appControl.md) - - [@ohos.bundle.bundleManager](js-apis-bundleManager.md) - - [@ohos.bundle.bundleMonitor](js-apis-bundleMonitor.md) - - [@ohos.bundle.defaultAppManager](js-apis-defaultAppManager.md) - - [@ohos.bundle.distributedBundle](js-apis-distributedBundle.md) - - [@ohos.bundle.freeInstall](js-apis-freeInstall.md) - - [@ohos.bundle.installer](js-apis-installer.md) - - [@ohos.bundle.launcherBundleManager](js-apis-launcherBundleManager.md) - - [@ohos.zlib](js-apis-zlib.md) + - [@ohos.bundle.appControl (appControl)](js-apis-appControl.md) + - [@ohos.bundle.bundleManager (bundleManager)](js-apis-bundleManager.md) + - [@ohos.bundle.bundleMonitor (bundleMonitor)](js-apis-bundleMonitor.md) + - [@ohos.bundle.defaultAppManager (Default Application Management)](js-apis-defaultAppManager.md) + - [@ohos.bundle.distributedBundleManager (distributedBundleManager)](js-apis-distributedBundleManager.md) + - [@ohos.bundle.freeInstall (freeInstall)](js-apis-freeInstall.md) + - [@ohos.bundle.installer (installer)](js-apis-installer.md) + - [@ohos.bundle.launcherBundleManager (launcherBundleManager)](js-apis-launcherBundleManager.md) + - [@ohos.zlib (Zip)](js-apis-zlib.md) - bundleManager - [abilityInfo](js-apis-bundleManager-abilityInfo.md) - [applicationInfo](js-apis-bundleManager-applicationInfo.md) @@ -157,41 +156,41 @@ - [remoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo.md) - [shortcutInfo](js-apis-bundleManager-shortcutInfo.md) - UI Page - - [@ohos.animator](js-apis-animator.md) - - [@ohos.curves](js-apis-curve.md) - - [@ohos.matrix4](js-apis-matrix4.md) - - [@ohos.mediaquery](js-apis-mediaquery.md) - - [@ohos.promptAction](js-apis-promptAction.md) - - [@ohos.router](js-apis-router.md) + - [@ohos.animator (Animator)](js-apis-animator.md) + - [@ohos.curves (Interpolation Calculation)](js-apis-curve.md) + - [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md) + - [@ohos.mediaquery (Media Query)](js-apis-mediaquery.md) + - [@ohos.promptAction (Prompt)](js-apis-promptAction.md) + - [@ohos.router (Page Routing)](js-apis-router.md) - Graphics - - [@ohos.animation.windowAnimationManager](js-apis-windowAnimationManager.md) - - [@ohos.application.WindowExtensionAbility](js-apis-application-windowExtensionAbility.md) - - [@ohos.display ](js-apis-display.md) - - [@ohos.effectKit](js-apis-effectKit.md) - - [@ohos.graphics.colorSpaceManager](js-apis-colorSpaceManager.md) - - [@ohos.screen](js-apis-screen.md) - - [@ohos.screenshot](js-apis-screenshot.md) - - [@ohos.window](js-apis-window.md) + - [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md) + - [@ohos.application.WindowExtensionAbility (WindowExtensionAbility)](js-apis-application-windowExtensionAbility.md) + - [@ohos.display (Display)](js-apis-display.md) + - [@ohos.effectKit (Image Effects)](js-apis-effectKit.md) + - [@ohos.graphics.colorSpaceManager (Color Space Management)](js-apis-colorSpaceManager.md) + - [@ohos.screen (Screen)](js-apis-screen.md) + - [@ohos.screenshot (Screenshot)](js-apis-screenshot.md) + - [@ohos.window (Window)](js-apis-window.md) - webgl - - [webgl](js-apis-webgl.md) - - [webgl2](js-apis-webgl2.md) + - [WebGL](js-apis-webgl.md) + - [WebGL2](js-apis-webgl2.md) - Media - - [@ohos.multimedia.audio](js-apis-audio.md) - - [@ohos.multimedia.avsession](js-apis-avsession.md) - - [@ohos.multimedia.camera](js-apis-camera.md) - - [@ohos.multimedia.image](js-apis-image.md) - - [@ohos.multimedia.media](js-apis-media.md) + - [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md) + - [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md) + - [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md) + - [@ohos.multimedia.image (Image Processing)](js-apis-image.md) + - [@ohos.multimedia.media (Media)](js-apis-media.md) - Resource Management - - [@ohos.i18n](js-apis-i18n.md) - - [@ohos.intl](js-apis-intl.md) - - [@ohos.resourceManager](js-apis-resource-manager.md) + - [@ohos.i18n (Internationalization)](js-apis-i18n.md) + - [@ohos.intl (Internationalization)](js-apis-intl.md) + - [@ohos.resourceManager (Resource Manager)](js-apis-resource-manager.md) - Resource Scheduling - - [@ohos.distributedMissionManager](js-apis-distributedMissionManager.md) - - [@ohos.reminderAgentManager](js-apis-reminderAgentManager.md) - - [@ohos.resourceschedule.backgroundTaskManager](js-apis-resourceschedule-backgroundTaskManager.md) - - [@ohos.resourceschedule.workScheduler](js-apis-resourceschedule-workScheduler.md) - - [@ohos.resourceschedule.usageStatistics](js-apis-resourceschedule-deviceUsageStatistics.md) - - [@ohos.WorkSchedulerExtensionAbility](js-apis-WorkSchedulerExtensionAbility.md) + - [@ohos.distributedMissionManager (Distributed Mission Management)](js-apis-distributedMissionManager.md) + - [@ohos.reminderAgentManager (Reminder Agent Management)](js-apis-reminderAgentManager.md) + - [@ohos.resourceschedule.backgroundTaskManager (Background Task Management)](js-apis-resourceschedule-backgroundTaskManager.md) + - [@ohos.resourceschedule.workScheduler (Work Scheduler)](js-apis-resourceschedule-workScheduler.md) + - [@ohos.resourceschedule.usageStatistics (Device Usage Statistics)](js-apis-resourceschedule-deviceUsageStatistics.md) + - [@ohos.WorkSchedulerExtensionAbility (Work Scheduler Callbacks)](js-apis-WorkSchedulerExtensionAbility.md) - Security - [@ohos.abilityAccessCtrl (Ability Access Control)](js-apis-abilityAccessCtrl.md) - [@ohos.privacyManager (Privacy Management)](js-apis-privacyManager.md) @@ -201,6 +200,8 @@ - [@ohos.userIAM.faceAuth (Facial Authentication)](js-apis-useriam-faceauth.md) - [@ohos.userIAM.userAuth (User Authentication)](js-apis-useriam-userauth.md) - [@system.cipher (Cipher Algorithm)](js-apis-system-cipher.md) + - security + - [PermissionRequestResult](js-apis-permissionrequestresult.md) - Data Management - [@ohos.data.dataAbility (DataAbility Predicates)](js-apis-data-ability.md) - [@ohos.data.dataShare (DataShare)](js-apis-data-dataShare.md) @@ -209,183 +210,181 @@ - [@ohos.data.distributedDataObject (Distributed Data Object)](js-apis-data-distributedobject.md) - [@ohos.data.distributedKVStore (Distributed KV Store)](js-apis-distributedKVStore.md) - [@ohos.data.preferences (Preferences)](js-apis-data-preferences.md) - - [@ohos.data.relationalStore (RDB Store)](js-apis-data-relationalStore.md) + - [@ohos.data.relationalStore (关系型数据库)](js-apis-data-relationalStore.md) - [@ohos.data.ValuesBucket (Value Bucket)](js-apis-data-valuesBucket.md) - data/rdb - [resultSet](js-apis-data-resultset.md) - File Management - - [@ohos.document](js-apis-document.md) - - [@ohos.environment](js-apis-environment.md) - - [@ohos.data.fileAccess](js-apis-fileAccess.md) - - [@ohos.fileExtensionInfo](js-apis-fileExtensionInfo.md) - - [@ohos.fileio](js-apis-fileio.md) - - [@ohos.filemanagement.userFileManager](js-apis-userFileManager.md) - - [@ohos.multimedia.medialibrary](js-apis-medialibrary.md) - - [@ohos.securityLabel](js-apis-securityLabel.md) - - [@ohos.statfs](js-apis-statfs.md) - - [@ohos.storageStatistics](js-apis-storage-statistics.md) - - [@ohos.volumeManager](js-apis-volumemanager.md) + - [@ohos.environment (Environment)](js-apis-environment.md) + - [@ohos.file.fileAccess (User File Access and Management)](js-apis-fileAccess.md) + - [@ohos.file.fileExtensionInfo (User File Extension Information)](js-apis-fileExtensionInfo.md) + - [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md) + - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md) + - [@ohos.storageStatistics (Application Storage Statistics)](js-apis-storage-statistics.md) + - [@ohos.volumeManager (Volume Management)](js-apis-volumemanager.md) - Telephony Service - - [@ohos.contact](js-apis-contact.md) - - [@ohos.telephony.call](js-apis-call.md) - - [@ohos.telephony.data](js-apis-telephony-data.md) - - [@ohos.telephony.observer](js-apis-observer.md) - - [@ohos.telephony.radio](js-apis-radio.md) - - [@ohos.telephony.sim](js-apis-sim.md) - - [@ohos.telephony.sms](js-apis-sms.md) + - [@ohos.contact (Contacts)](js-apis-contact.md) + - [@ohos.telephony.call (Call)](js-apis-call.md) + - [@ohos.telephony.data (Cellular Data)](js-apis-telephony-data.md) + - [@ohos.telephony.observer (Observer)](js-apis-observer.md) + - [@ohos.telephony.radio (Network Search)](js-apis-radio.md) + - [@ohos.telephony.sim (SIM Management)](js-apis-sim.md) + - [@ohos.telephony.sms (SMS)](js-apis-sms.md) - Network Management - - [@ohos.net.connection](js-apis-net-connection.md) - - [@ohos.net.ethernet](js-apis-net-ethernet.md) - - [@ohos.net.http](js-apis-http.md) - - [@ohos.net.sharing](js-apis-net-sharing.md) - - [@ohos.net.socket](js-apis-socket.md) - - [@ohos.net.webSocket](js-apis-webSocket.md) - - [@ohos.request](js-apis-request.md) + - [@ohos.net.connection (Network Connection Management)](js-apis-net-connection.md) + - [@ohos.net.ethernet (Ethernet Connection Management)](js-apis-net-ethernet.md) + - [@ohos.net.http (Data Request)](js-apis-http.md) + - [@ohos.net.sharing (Network Sharing)](js-apis-net-sharing.md) + - [@ohos.net.socket (Socket Connection)](js-apis-socket.md) + - [@ohos.net.webSocket (WebSocket Connection)](js-apis-webSocket.md) + - [@ohos.request (Upload and Download)](js-apis-request.md) - Connectivity - - [@ohos.bluetooth](js-apis-bluetooth.md) - - [@ohos.connectedTag](js-apis-connectedTag.md) - - [@ohos.nfc.cardEmulation](js-apis-cardEmulation.md) - - [@ohos.nfc.controller](js-apis-nfcController.md) - - [@ohos.nfc.tag](js-apis-nfcTag.md) - - [@ohos.rpc](js-apis-rpc.md) + - [@ohos.bluetooth (Bluetooth)](js-apis-bluetooth.md) + - [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md) + - [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md) + - [@ohos.nfc.controller (Standard NFC)](js-apis-nfcController.md) + - [@ohos.nfc.tag (Standard NFC Tags)](js-apis-nfcTag.md) + - [@ohos.rpc (RPC)](js-apis-rpc.md) - [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md) - - [@ohos.wifiManagerExt](js-apis-wifiManagerExt.md) - - [@ohos.wifi](js-apis-wifi.md) - - [@ohos.wifiext](js-apis-wifiext.md) + - [@ohos.wifiManagerExt (WLAN Extension)](js-apis-wifiManagerExt.md) + - [@ohos.wifi (To Be Deprecated)](js-apis-wifi.md) + - [@ohos.wifiext (To Be Deprecated)](js-apis-wifiext.md) - tag - - [nfctech](js-apis-nfctech.md) - - [tagSession](js-apis-tagSession.md) + - [nfctech (Standard NFC Technologies)](js-apis-nfctech.md) + - [tagSession (Standard NFC Tag Session)](js-apis-tagSession.md) - Basic Features - - [@ohos.accessibility](js-apis-accessibility.md) - - [@ohos.accessibility.config](js-apis-accessibility-config.md) - - [@ohos.accessibility.GesturePat](js-apis-accessibility-GesturePath.md) - - [@ohos.accessibility.GesturePoint](js-apis-accessibility-GesturePoint.md) - - [@ohos.application.AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md) - - [@ohos.faultLogger](js-apis-faultLogger.md) - - [@ohos.hichecker](js-apis-hichecker.md) - - [@ohos.hidebug](js-apis-hidebug.md) - - [@ohos.hilog](js-apis-hilog.md) - - [@ohos.hiSysEvent](js-apis-hisysevent.md) - - [@ohos.hiTraceChain](js-apis-hitracechain.md) - - [@ohos.hiTraceMeter](js-apis-hitracemeter.md) - - [@ohos.hiviewdfx.hiAppEvent](js-apis-hiviewdfx-hiappevent.md) - - [@ohos.inputmethod](js-apis-inputmethod.md) - - [@ohos.inputmethodengine](js-apis-inputmethodengine.md) - - [@ohos.inputmethodextensionability](js-apis-inputmethod-extension-ability.md) - - [@ohos.inputmethodextensioncontext](js-apis-inputmethod-extension-context.md) - - [@ohos.inputmethodsubtype](js-apis-inputmethod-subtype.md) - - [@ohos.pasteboard](js-apis-pasteboard.md) - - [@ohos.screenLock](js-apis-screen-lock.md) - - [@ohos.systemTime](js-apis-system-time.md) - - [@ohos.systemTimer](js-apis-system-timer.md) - - [@ohos.wallpaper](js-apis-wallpaper.md) - - [@ohos.web.webview](js-apis-webview.md) - - [console](js-apis-logs.md) + - [@ohos.accessibility (Accessibility)](js-apis-accessibility.md) + - [@ohos.accessibility.config (System Accessibility Configuration)](js-apis-accessibility-config.md) + - [@ohos.accessibility.GesturePath (Gesture Path)](js-apis-accessibility-GesturePath.md) + - [@ohos.accessibility.GesturePoint (Gesture Point)](js-apis-accessibility-GesturePoint.md) + - [@ohos.application.AccessibilityExtensionAbility (AccessibilityExtensionAbility)](js-apis-application-accessibilityExtensionAbility.md) + - [@ohos.faultLogger (FaultLogger)](js-apis-faultLogger.md) + - [@ohos.hichecker (HiChecker)](js-apis-hichecker.md) + - [@ohos.hidebug (HiDebug)](js-apis-hidebug.md) + - [@ohos.hilog (HiLog)](js-apis-hilog.md) + - [@ohos.hiSysEvent (System Event Logging)](js-apis-hisysevent.md) + - [@ohos.hiTraceChain (Distributed Call Chain Tracing)](js-apis-hitracechain.md) + - [@ohos.hiTraceMeter (Performance Tracing)](js-apis-hitracemeter.md) + - [@ohos.hiviewdfx.hiAppEvent (Application Event Logging)](js-apis-hiviewdfx-hiappevent.md) + - [@ohos.inputMethod (Input Method Framework)](js-apis-inputmethod.md) + - [@ohos.inputMethodEngine (Input Method Service)](js-apis-inputmethodengine.md) + - [@ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)](js-apis-inputmethod-extension-ability.md) + - [@ohos.InputMethodExtensionContext (InputMethodExtensionContext)](js-apis-inputmethod-extension-context.md) + - [@ohos.InputMethodSubtype (Input Method Subtype)](js-apis-inputmethod-subtype.md) + - [@ohos.pasteboard (Pasteboard)](js-apis-pasteboard.md) + - [@ohos.screenLock (Screenlock)](js-apis-screen-lock.md) + - [@ohos.systemTime (System Time and Time Zone)](js-apis-system-time.md) + - [@ohos.systemTimer (System Timer)](js-apis-system-timer.md) + - [@ohos.wallpaper (Wallpaper)](js-apis-wallpaper.md) + - [@ohos.web.webview (Webview)](js-apis-webview.md) + - [console (Log)](js-apis-logs.md) - [Timer](js-apis-timer.md) - application - [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) - Device Management - - [@ohos.batteryInfo ](js-apis-battery-info.md) - - [@ohos.batteryStatistics](js-apis-batteryStatistics.md) - - [@ohos.brightness](js-apis-brightness.md) - - [@ohos.deviceInfo](js-apis-device-info.md) - - [@ohos.distributedHardware.deviceManager](js-apis-device-manager.md) - - [@ohos.geoLocationManager](js-apis-geoLocationManager.md) - - [@ohos.multimodalInput.inputConsumer](js-apis-inputconsumer.md) - - [@ohos.multimodalInput.inputDevice](js-apis-inputdevice.md) - - [@ohos.multimodalInput.inputDeviceCooperate](js-apis-cooperate.md) - - [@ohos.multimodalInput.inputEvent](js-apis-inputevent.md) - - [@ohos.multimodalInput.inputEventClient](js-apis-inputeventclient.md) - - [@ohos.multimodalInput.inputMonitor](js-apis-inputmonitor.md) - - [@ohos.multimodalInput.keyCode](js-apis-keycode.md) - - [@ohos.multimodalInput.keyEvent](js-apis-keyevent.md) - - [@ohos.multimodalInput.mouseEvent](js-apis-mouseevent.md) - - [@ohos.multimodalInput.pointer](js-apis-pointer.md) - - [@ohos.multimodalInput.touchEvent](js-apis-touchevent.md) - - [@ohos.power](js-apis-power.md) - - [@ohos.runningLock](js-apis-runninglock.md) - - [@ohos.sensor](js-apis-sensor.md) - - [@ohos.settings](js-apis-settings.md) - - [@ohos.stationary](js-apis-stationary.md) + - [@ohos.batteryInfo (Battery Information)](js-apis-battery-info.md) + - [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md) + - [@ohos.brightness (Screen Brightness)](js-apis-brightness.md) + - [@ohos.deviceInfo (Device Information)](js-apis-device-info.md) + - [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md) + - [@ohos.geoLocationManager (Geolocation Manager)](js-apis-geoLocationManager.md) + - [@ohos.multimodalInput.inputConsumer (Input Consumer)](js-apis-inputconsumer.md) + - [@ohos.multimodalInput.inputDevice (Input Device)](js-apis-inputdevice.md) + - [@ohos.multimodalInput.inputDeviceCooperate (Screen Hopping)](js-apis-cooperate.md) + - [@ohos.multimodalInput.inputEvent (Input Event)](js-apis-inputevent.md) + - [@ohos.multimodalInput.inputEventClient (Key Event Injection)](js-apis-inputeventclient.md) + - [@ohos.multimodalInput.inputMonitor (Input Monitor)](js-apis-inputmonitor.md) + - [@ohos.multimodalInput.keyCode (Key Code)](js-apis-keycode.md) + - [@ohos.multimodalInput.keyEvent (Key Event)](js-apis-keyevent.md) + - [@ohos.multimodalInput.mouseEvent (Mouse Event)](js-apis-mouseevent.md) + - [@ohos.multimodalInput.pointer (Mouse Pointer)](js-apis-pointer.md) + - [@ohos.multimodalInput.touchEvent (Touch Event)](js-apis-touchevent.md) + - [@ohos.power (System Power Management)](js-apis-power.md) + - [@ohos.runningLock (Runninglock)](js-apis-runninglock.md) + - [@ohos.sensor (Sensor)](js-apis-sensor.md) + - [@ohos.settings (Data Item Settings)](js-apis-settings.md) + - [@ohos.stationary (Device Status Awareness Framework)](js-apis-stationary.md) - [@ohos.systemCapability (SystemCapability)](js-apis-system-capability.md) - - [@ohos.systemParameterV9](js-apis-system-parameterV9.md) - - [@ohos.thermal](js-apis-thermal.md) - - [@ohos.update](js-apis-update.md) - - [@ohos.usb](js-apis-usb.md) - - [@ohos.vibrator](js-apis-vibrator.md) + - [@ohos.systemParameterV9 (System Parameter)](js-apis-system-parameterV9.md) + - [@ohos.thermal (Thermal Management)](js-apis-thermal.md) + - [@ohos.update (Update)](js-apis-update.md) + - [@ohos.usbV9 (USB Management)](js-apis-usb.md) + - [@ohos.vibrator (Vibrator)](js-apis-vibrator.md) - Account Management - - [@ohos.account.appAccount](js-apis-appAccount.md) - - [@ohos.account.distributedAccount](js-apis-distributed-account.md) - - [@ohos.account.osAccount](js-apis-osAccount.md) + - [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md) + - [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md) + - [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md) - Custom Management - - [@ohos.configPolicy](js-apis-configPolicy.md) - - [@ohos.enterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md) - - [@ohos.enterprise.adminManager](js-apis-enterprise-adminManager.md) - - [@ohos.enterprise.dateTimeManager](js-apis-enterprise-dateTimeManager.md) + - [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md) + - [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](js-apis-EnterpriseAdminExtensionAbility.md) + - [@ohos.enterprise.adminManager (Enterprise Device Management)](js-apis-enterprise-adminManager.md) + - [@ohos.enterprise.dateTimeManager (System Time Management)](js-apis-enterprise-dateTimeManager.md) - Language Base Class Library - [@ohos.buffer (Buffer)](js-apis-buffer.md) - - [@ohos.convertxml](js-apis-convertxml.md) - - [@ohos.process](js-apis-process.md) - - [@ohos.uri](js-apis-uri.md) - - [@ohos.url](js-apis-url.md) - - [@ohos.util](js-apis-util.md) - - [@ohos.util.ArrayList](js-apis-arraylist.md) - - [@ohos.util.Deque](js-apis-deque.md) - - [@ohos.util.HashMap](js-apis-hashmap.md) - - [@ohos.util.HashSet](js-apis-hashset.md) - - [@ohos.util.LightWeightMap](js-apis-lightweightmap.md) - - [@ohos.util.LightWeightSet](js-apis-lightweightset.md) - - [@ohos.util.LinkedList](js-apis-linkedlist.md) - - [@ohos.util.List](js-apis-list.md) - - [@ohos.util.PlainArray](js-apis-plainarray.md) - - [@ohos.util.Queue](js-apis-queue.md) - - [@ohos.util.Stack](js-apis-stack.md) - - [@ohos.util.TreeMap](js-apis-treemap.md) - - [@ohos.util.TreeSet](js-apis-treeset.md) - - [@ohos.util.Vector](js-apis-vector.md) - - [@ohos.worker](js-apis-worker.md) - - [@ohos.xml](js-apis-xml.md) + - [@ohos.convertxml (XML-to-JavaScript Conversion)](js-apis-convertxml.md) + - [@ohos.process (Obtaining Process Information)](js-apis-process.md) + - [@ohos.taskpool (Using the Task Pool)](js-apis-taskpool.md) + - [@ohos.uri (URI String Parsing)](js-apis-uri.md) + - [@ohos.url (URL String Parsing)](js-apis-url.md) + - [@ohos.util (util)](js-apis-util.md) + - [@ohos.util.ArrayList (Linear Container ArrayList)](js-apis-arraylist.md) + - [@ohos.util.Deque (Linear Container Deque)](js-apis-deque.md) + - [@ohos.util.HashMap (Nonlinear Container HashMap)](js-apis-hashmap.md) + - [@ohos.util.HashSet (Nonlinear Container HashSet)](js-apis-hashset.md) + - [@ohos.util.LightWeightMap (Nonlinear Container LightWeightMap)](js-apis-lightweightmap.md) + - [@ohos.util.LightWeightSet (Nonlinear Container LightWeightSet)](js-apis-lightweightset.md) + - [@ohos.util.LinkedList (Linear Container LinkedList)](js-apis-linkedlist.md) + - [@ohos.util.List (Linear Container List)](js-apis-list.md) + - [@ohos.util.PlainArray (Nonlinear Container PlainArray)](js-apis-plainarray.md) + - [@ohos.util.Queue (Linear Container Queue)](js-apis-queue.md) + - [@ohos.util.Stack (Linear Container Stack)](js-apis-stack.md) + - [@ohos.util.TreeMap (Nonlinear Container TreeMap)](js-apis-treemap.md) + - [@ohos.util.TreeSet (Nonlinear Container TreeSet)](js-apis-treeset.md) + - [@ohos.util.Vector (Linear Container Vector)](js-apis-vector.md) + - [@ohos.worker (Worker Startup)](js-apis-worker.md) + - [@ohos.xml (XML Parsing and Generation)](js-apis-xml.md) - Test - - [@ohos.application.testRunner](js-apis-application-testRunner.md) - - [@ohos.uitest](js-apis-uitest.md) + - [@ohos.application.testRunner (TestRunner)](js-apis-application-testRunner.md) + - [@ohos.uitest (UiTest)](js-apis-uitest.md) - APIs No Longer Maintained - - [@ohos.backgroundTaskManager](js-apis-backgroundTaskManager.md) - - [@ohos.bundle](js-apis-Bundle.md) - - [@ohos.bundle.innerBundleManager](js-apis-Bundle-InnerBundleManager.md) - - [@ohos.bundleState](js-apis-deviceUsageStatistics.md) - - [@ohos.bytrace](js-apis-bytrace.md) - - [@ohos.data.distributedData](js-apis-distributed-data.md) - - [@ohos.data.storage](js-apis-data-storage.md) + - [@ohos.backgroundTaskManager (Background Task Management)](js-apis-backgroundTaskManager.md) + - [@ohos.bundle (Bundle)](js-apis-Bundle.md) + - [@ohos.bundle.innerBundleManager (innerBundleManager)](js-apis-Bundle-InnerBundleManager.md) + - [@ohos.bundleState (Device Usage Statistics)](js-apis-deviceUsageStatistics.md) + - [@ohos.bytrace (Performance Tracing)](js-apis-bytrace.md) + - [@ohos.data.distributedData (Distributed Data Management)](js-apis-distributed-data.md) + - [@ohos.data.storage (Lightweight Data Storage)](js-apis-data-storage.md) - [@ohos.data.rdb (RDB)](js-apis-data-rdb.md) - - [@ohos.distributedBundle](js-apis-Bundle-distributedBundle.md) - - [@ohos.document](js-apis-document.md) - - [@ohos.geolocation](js-apis-geolocation.md) - - [@ohos.hiAppEvent](js-apis-hiappevent.md) - - [@ohos.prompt](js-apis-prompt.md) - - [@ohos.reminderAgent](js-apis-reminderAgent.md) - - [@ohos.systemParameter](js-apis-system-parameter.md) - - [@ohos.usb](js-apis-usb-deprecated.md) - - [@ohos.workScheduler](js-apis-workScheduler.md) - - [@system.app](js-apis-system-app.md) - - [@system.battery](js-apis-system-battery.md) - - [@system.bluetooth](js-apis-system-bluetooth.md) - - [@system.brightness](js-apis-system-brightness.md) - - [@system.configuration](js-apis-system-configuration.md) - - [@system.device](js-apis-system-device.md) - - [@system.fetch](js-apis-system-fetch.md) - - [@system.file](js-apis-system-file.md) - - [@system.geolocation](js-apis-system-location.md) - - [@system.mediaquery](js-apis-system-mediaquery.md) - - [@system.network](js-apis-system-network.md) - - [@system.notification](js-apis-system-notification.md) - - [@system.package](js-apis-system-package.md) - - [@system.prompt](js-apis-system-prompt.md) - - [@system.request](js-apis-system-request.md) - - [@system.router](js-apis-system-router.md) - - [@system.sensor](js-apis-system-sensor.md) - - [@system.storage](js-apis-system-storage.md) - - [@system.vibrator](js-apis-system-vibrate.md) + - [@ohos.distributedBundle (Distributed Bundle Management)](js-apis-Bundle-distributedBundle.md) + - [@ohos.document (File Operation)](js-apis-document.md) + - [@ohos.fileio (File Management)](js-apis-fileio.md) + - [@ohos.geolocation (Geolocation)](js-apis-geolocation.md) + - [@ohos.hiAppEvent (Application Event Logging)](js-apis-hiappevent.md) + - [@ohos.prompt (Prompt)](js-apis-prompt.md) + - [@ohos.reminderAgent (Reminder Agent)](js-apis-reminderAgent.md) + - [@ohos.statfs (statfs)](js-apis-statfs.md) + - [@ohos.systemParameter (System Parameter)](js-apis-system-parameter.md) + - [@ohos.usb (USB Management)](js-apis-usb-deprecated.md) + - [@system.app (Application Context)](js-apis-system-app.md) + - [@system.battery (Battery Information)](js-apis-system-battery.md) + - [@system.bluetooth (Bluetooth)](js-apis-system-bluetooth.md) + - [@system.brightness (Screen Brightness)](js-apis-system-brightness.md) + - [@system.configuration (Application Configuration)](js-apis-system-configuration.md) + - [@system.device (Device Information)](js-apis-system-device.md) + - [@system.fetch (Data Request)](js-apis-system-fetch.md) + - [@system.file (File Storage)](js-apis-system-file.md) + - [@system.geolocation (Geographic Location)](js-apis-system-location.md) + - [@system.mediaquery (Media Query)](js-apis-system-mediaquery.md) + - [@system.network (Network State)](js-apis-system-network.md) + - [@system.notification (Notification)](js-apis-system-notification.md) + - [@system.package (Bundle Management)](js-apis-system-package.md) + - [@system.prompt (Prompt)](js-apis-system-prompt.md) + - [@system.request (Upload and Download)](js-apis-system-request.md) + - [@system.router (Page Routing)](js-apis-system-router.md) + - [@system.sensor (Sensor)](js-apis-system-sensor.md) + - [@system.storage (Data Storage)](js-apis-system-storage.md) + - [@system.vibrator (Vibrator)](js-apis-system-vibrate.md) - bundle - [abilityInfo](js-apis-bundle-AbilityInfo.md) - [applicationInfo](js-apis-bundle-ApplicationInfo.md) diff --git a/en/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md index a47e3e8908f69f5515beab95cea6f74351719a77..2a665f5febb82481993674c7501279b838ea05db 100644 --- a/en/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md @@ -1,4 +1,4 @@ -# @ohos.application.AccessibilityExtensionAbility +# @ohos.application.AccessibilityExtensionAbility (AccessibilityExtensionAbility) The **AccessibilityExtensionAbility** module provides accessibility extension capabilities based on the ExtensionAbility framework. diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md index a7d9d995e56f7a1015161e8419080656731a6f1f..1f8883d919ba0f0a843a08b1705273bd24b563f0 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager.md @@ -2771,6 +2771,7 @@ try { ### bundleManager.getApplicationInfoSync getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); +getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); Synchronously obtains the application information based on the given bundle name, application flags, and user ID. @@ -2786,7 +2787,7 @@ Synchronously obtains the application information based on the given bundle name | ----------- | ------ | ---- | ----------------------------------------------------------| | bundleName | string | Yes | Bundle name. | | applicationFlags | [number](#applicationflag) | Yes | Type of the application information to obtain. | -| userId | number | No | User ID. | +| userId | number | Yes | User ID. | **Return value** @@ -2838,6 +2839,7 @@ try { ### bundleManager.getBundleInfoSync getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md); +getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); Synchronously obtains the bundle information based on the given bundle name, bundle flags, and user ID. diff --git a/en/application-dev/reference/apis/js-apis-deque.md b/en/application-dev/reference/apis/js-apis-deque.md index d227b545aa9f5ad3b719b2da86800cab6ccc5084..274836333aa773d32a386ad22b03706e890859c7 100644 --- a/en/application-dev/reference/apis/js-apis-deque.md +++ b/en/application-dev/reference/apis/js-apis-deque.md @@ -1,6 +1,7 @@ # @ohos.util.Deque (Linear Container Deque) > **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. Double-ended queue (deque) is a sequence container implemented based on the queue data structure that follows the principles of First In First Out (FIFO) and Last In First Out (LIFO). It allows insertion and removal of elements at both the ends. **Deque** can dynamically adjust the capacity based on project requirements. It doubles the capacity each time. **Deque** differs from **[Queue](js-apis-queue.md)** and **[Vector](js-apis-vector.md)** mainly in the following aspects: diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index f9a998f37ca17b4d4c70342bc648ed519fbe1652..813b44ccf0088142fccbc22f3087aede4669f2bc 100644 --- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -1,4 +1,4 @@ -# @ohos.deviceUsageStatistics (Device Usage Statistics) +# @ohos.bundleState (Device Usage Statistics) This module provides APIs for collecting statistics on device usage. @@ -454,6 +454,20 @@ Provides the usage duration information of an application. | infosBeginTime | number | No | Time logged in the first application usage record in the **BundleActiveInfo** object.| | infosEndTime | number | No | Time logged in the last application usage record in the **BundleActiveInfo** object.| +### merge(deprecated) + +merge(toMerge: BundleStateInfo): void + +Merges the device usage statistics of applications with the same bundle name. + +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| toMerge | [BundleStateInfo](#bundlestateinfo) | Yes| Device usage statistics to merge.| + ## BundleActiveState Provides information about an application event. diff --git a/en/application-dev/reference/apis/js-apis-distributedBundleManager.md b/en/application-dev/reference/apis/js-apis-distributedBundleManager.md new file mode 100644 index 0000000000000000000000000000000000000000..0308ec2c23901c158fa4f06d94a7299728c4cc60 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-distributedBundleManager.md @@ -0,0 +1,479 @@ +# @ohos.bundle.distributedBundleManager (distributedBundleManager) + +The **distributedBundle** module provides APIs for managing distributed bundles. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. + +## Modules to Import + +``` +import distributedBundle from '@ohos.bundle.distributedBundleManager'; +``` + +## System Capabilities + +SystemCapability.BundleManager.DistributedBundleFramework + +## Required Permissions + +| Permission | Permission Level | Description | +| ------------------------------------------ | ------------ | ------------------ | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | Permission to query information about all bundles.| + +For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels). + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\): void; + +Obtains information about the remote ability that matches the given element 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes | Target element name. | +| callback | AsyncCallback<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo.md)> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **RemoteAbilityInfo** object obtained. Otherwise, **err** is an error object and **data** is **undefined**.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|--------------------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + { + deviceId: '1', + bundleName: 'com.example.application', + abilityName: 'MainAbility' + }, (err, data) => { + if (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + } else { + console.info('Operation succeed:' + JSON.stringify(data)); + } + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName): Promise\; + +Obtains information about the remote ability that matches the given element name. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | -------------------------------------------- | ---- | ----------------------- | +| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes | Target element name.| + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo.md)> | Promise used to return the result. If the operation is successful, the **RemoteAbilityInfo** object is returned. Otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + { + deviceId: '1', + bundleName: 'com.example.application', + abilityName: 'MainAbility' + }).then(data => { + console.info('Operation succeed:' + JSON.stringify(data)); + }).catch(err => { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementNames: Array\, callback: AsyncCallback\>): void; + +Obtains information about the remote abilities that match the given element names. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | Yes | **ElementName** array, whose maximum length is 10. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the array of **RemoteAbilityInfo** objects obtained. Otherwise, **err** is an error object and **data** is **undefined**.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + [ + { + deviceId: '1', + bundleName: 'com.example.application1', + abilityName: 'MainAbility1' + }, + { + deviceId: '1', + bundleName: 'com.example.application2', + abilityName: 'MainAbility' + } + ], (err, data) => { + if (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + } else { + console.info('Operation succeed:' + JSON.stringify(data)); + } + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementNames: Array\): Promise\>; + +Obtains information about the remote abilities that match the given element names. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | --------------------------------------------------- | ---- | ----------------------- | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | Yes | **ElementName** array, whose maximum length is 10.| + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\> | Promise used to return the result. If the operation is successful, an array of **RemoteAbilityInfo** objects is returned. Otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + [ + { + deviceId: '1', + bundleName: 'com.example.application', + abilityName: 'MainAbility' + }, + { + deviceId: '1', + bundleName: 'com.example.application2', + abilityName: 'MainAbility' + } + ]).then(data => { + console.info('Operation succeed:' + JSON.stringify(data)); + }).catch(err => { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback\): void; + +Obtains information about the remote ability that matches the given element name and locale. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- | +| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes | Target element name. | +| locale | string |Yes| Target locale.| +| callback | AsyncCallback<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo.md)> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **RemoteAbilityInfo** object obtained. Otherwise, **err** is an error object and **data** is **undefined**.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + { + deviceId: '1', + bundleName: 'com.example.application', + abilityName: 'MainAbility' + }, 'zh-Hans-CN', (err, data) => { + if (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + } else { + console.info('Operation succeed:' + JSON.stringify(data)); + } + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise\; + +Obtains information about the remote ability that matches the given element name and locale. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | -------------------------------------------- | ---- | ----------------------- | +| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes | Target element name.| +| locale | string |Yes| Target locale.| + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo.md)> | Promise used to return the result. If the operation is successful, the **RemoteAbilityInfo** object is returned. Otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + { + deviceId: '1', + bundleName: 'com.example.application', + abilityName: 'MainAbility' + }, 'zh-Hans-CN').then(data => { + console.info('Operation succeed:' + JSON.stringify(data)); + }).catch(err => { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementNames: Array\, locale: string, callback: AsyncCallback\>): void; + +Obtains information about the remote abilities that match the given element names and locale. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | Yes | **ElementName** array, whose maximum length is 10. | +| locale | string |Yes| Target locale.| +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the array of **RemoteAbilityInfo** objects obtained. Otherwise, **err** is an error object and **data** is **undefined**.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID | Error Message | +|---------------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + [ + { + deviceId: '1', + bundleName: 'com.example.application1', + abilityName: 'MainAbility1' + }, + { + deviceId: '1', + bundleName: 'com.example.application2', + abilityName: 'MainAbility' + } + ], 'zh-Hans-CN', (err, data) => { + if (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + } else { + console.info('Operation succeed:' + JSON.stringify(data)); + } + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementNames: Array\, locale: string): Promise\>; + +Obtains information about the remote abilities that match the given element names and locale. 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.DistributedBundleFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | --------------------------------------------------- | ---- | ----------------------- | +| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | Yes | **ElementName** array, whose maximum length is 10.| +| locale | string |Yes| Target locale.| + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\> | Promise used to return the result. If the operation is successful, an array of **RemoteAbilityInfo** objects is returned. Otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +|----------|-------------------------| +| 17700001 | The specified bundle name is not found. | +| 17700003 | The specified ability name is not found. | +| 17700007 | The specified device ID is not found. | +| 17700027 | The distributed service is not running. | + +**Example** + +```ts +try { + distributedBundle.getRemoteAbilityInfo( + [ + { + deviceId: '1', + bundleName: 'com.example.application', + abilityName: 'MainAbility' + }, + { + deviceId: '1', + bundleName: 'com.example.application2', + abilityName: 'MainAbility' + } + ], 'zh-Hans-CN').then(data => { + console.info('Operation succeed:' + JSON.stringify(data)); + }).catch(err => { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); + }); +} catch (err) { + console.error('Operation failed: error code is ' + err.code + 'and error message is ' + err.message); +} +``` diff --git a/en/application-dev/reference/apis/js-apis-document.md b/en/application-dev/reference/apis/js-apis-document.md index 1ff80d1b41633b2fc1dc351a3c0180baec1d71b6..3dd80a0e5d45a110d245159acb93047200dea271 100644 --- a/en/application-dev/reference/apis/js-apis-document.md +++ b/en/application-dev/reference/apis/js-apis-document.md @@ -1,4 +1,4 @@ -# File Interaction +# @ohos.document (File Interaction) > **NOTE**
> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-fileAccess.md b/en/application-dev/reference/apis/js-apis-fileAccess.md index bea477cc5357a7026ca0fd3b4b11bb3f6049d53e..d064302086186e5bcd33f50aade78f58376a6ce4 100644 --- a/en/application-dev/reference/apis/js-apis-fileAccess.md +++ b/en/application-dev/reference/apis/js-apis-fileAccess.md @@ -1,4 +1,4 @@ -# @ohos.data.fileAccess +# @ohos.file.fileAccess (User File Access and Management) The **fileAccess** module is a framework for accessing and operating user files based on the Extension ability mechanism. This module interacts with diverse file management services, such as the media library and external storage management service, and provides a set of file access and management APIs for system applications. The media library service allows access to user files on local devices and distributed devices. The external storage management service allows access to the user files stored on devices such as shared disks, USB flash drives, and SD cards. @@ -10,7 +10,7 @@ The **fileAccess** module is a framework for accessing and operating user files ## Modules to Import ```js -import fileAccess from '@ohos.data.fileAccess'; +import fileAccess from '@ohos.file.fileAccess'; ``` ## fileAccess.getFileAccessAbilityInfo @@ -38,7 +38,41 @@ Obtains information about all wants with **extension** set to **fileAcesss** in wantInfos = await fileAccess.getFileAccessAbilityInfo(); console.log("getFileAccessAbilityInfo data " + JSON.stringify(wantInfos)); } catch (error) { - console.error("getFileAccessAbilityInfo failed, error " + error); + console.error("getFileAccessAbilityInfo failed, errCode:" + error.code + ", errMessage:" + error.message); + } + } + ``` + +## fileAccess.getFileAccessAbilityInfo + +getFileAccessAbilityInfo(callback: AsyncCallback<Array<Want>>): void; + +Obtains information about all wants with **extension** set to **fileAcesss** in the system. A want is a basic communication component used to start services. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.| + +**Example** + + ```js + async getFileAccessAbilityInfo() { + try { + fileAccess.getFileAccessAbilityInfo(function (err, wantInfos) { + if (err) { + console.error("Failed to getFileAccessAbilityInfo in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("getFileAccessAbilityInfo data " + JSON.stringify(wantInfos)); + }); + } catch (error) { + console.error("getFileAccessAbilityInfo failed, errCode:" + error.code + ", errMessage:" + error.message); } } ``` @@ -72,7 +106,7 @@ Synchronously creates a **Helper** object to connect to the specified wants. The createFileAccessHelper() { let fileAccessHelper = null; / / Obtain wantInfos by using getFileAccessAbilityInfo(). - // Create a Helper object to interact with the media library service only. + // Create a helper object to interact with the media library service only. let wantInfos = [ { "bundleName": "com.ohos.medialibrary.medialibrarydata", @@ -80,12 +114,12 @@ Synchronously creates a **Helper** object to connect to the specified wants. The }, ] try { - // This.context is passed by MainAbility. + // this.context is passed by MainAbility. fileAccessHelper = fileAccess.createFileAccessHelper(this.context, wantInfos); if (!fileAccessHelper) console.error("createFileAccessHelper interface returns an undefined object"); } catch (error) { - console.error("createFileAccessHelper failed, error " + error); + console.error("createFileAccessHelper failed, errCode:" + error.code + ", errMessage:" + error.message); } } ``` @@ -119,12 +153,12 @@ Synchronously creates a **Helper** object to connect to all file management serv let fileAccesssHelperAllServer = null; // Create a Helper object to interact with all file management services configured with fileAccess in the system. try { - // This.context is passed by MainAbility. + // this.context is passed by MainAbility. fileAccesssHelperAllServer = fileAccess.createFileAccessHelper(this.context); if (!fileAccesssHelperAllServer) console.error("createFileAccessHelper interface returns an undefined object"); } catch (error) { - console.error("createFileAccessHelper failed, error " + error); + console.error("createFileAccessHelper failed, errCode:" + error.code + ", errMessage:" + error.message); } } ``` @@ -168,7 +202,51 @@ returns [RootInfo](#rootinfo) by using [next()](#rootiteratornext). rootinfos.push(result.value); } } catch (error) { - console.error("getRoots failed, error " + error); + console.error("getRoots failed, errCode:" + error.code + ", errMessage:" + error.message); + } + } + ``` + +## FileAccessHelper.getRoots + +getRoots(callback:AsyncCallback<RootIterator>) : void; + +Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. +The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext). + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.| + +**Example** + + ```js + async getRoots() { + let rootinfos = []; + let isDone = false; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.getRoots(function (err, rootIterator) { + if (err) { + console.error("Failed to getRoots in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + while (!isDone) { + let result = rootIterator.next(); + console.log("next result = " + JSON.stringify(result)); + isDone = result.done; + if (!isDone) + rootinfos.push(result.value); + } + }); + } catch (error) { + console.error("getRoots failed, errCode:" + error.code + ", errMessage:" + error.message); } } ``` @@ -199,7 +277,7 @@ Synchronously obtains the **FileIterator** object of the first-level files (file **Example** ```js - / / Obtain rootInfos by using getRoots(). + // Obtain rootInfos by using getRoots(). // let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; let rootInfo = rootinfos[0]; let fileInfos = []; @@ -220,7 +298,7 @@ Synchronously obtains the **FileIterator** object of the first-level files (file fileInfos.push(result.value); } } catch (error) { - console.log("listFile failed, error " + error); + console.error("listFile failed, errCode:" + error.code + ", errMessage:" + error.message); } ``` @@ -270,7 +348,7 @@ Recursively obtains the **FileIterator** object of the files matching the condit fileInfos.push(result.value); } } catch (error) { - console.error("scanFile failed, error " + error); + console.error("scanFile failed, errCode:" + error.code + ", errMessage:" + error.message); } ``` @@ -300,7 +378,7 @@ Synchronously obtains the **FileIterator** object of the next-level files (file ```js // fileInfoDir specifies the target directory. - // let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; + // let filter = { suffix : [".txt", ".jpg", ".xlsx"] }; let fileInfoDir = fileInfos[0]; let subfileInfos = []; let isDone = false; @@ -320,7 +398,7 @@ Synchronously obtains the **FileIterator** object of the next-level files (file subfileInfos.push(result.value); } } catch (error) { - console.error("listFile failed, error " + error); + console.error("listFile failed, errCode:" + error.code + ", errMessage:" + error.message); } ``` @@ -371,7 +449,7 @@ Recursively obtains the **FileIterator** object of the files matching the condit subfileInfos.push(result.value); } } catch (error) { - console.error("scanFile-filter failed, error " + error); + console.error("scanFile failed, errCode:" + error.code + ", errMessage:" + error.message); } ``` @@ -390,7 +468,7 @@ Creates a file in a directory. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | --- | --- | --- | -- | | uri | string | Yes| URI of the parent directory for the file to create.| - | displayName | string | Yes| Name of the file to create. A file name extension must be added for a local file. It is not required for a file stored in a shared disk.| + | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| **Return value** @@ -414,9 +492,49 @@ Creates a file in a directory. This API uses a promise to return the result. console.error("createFile return undefined object"); return; } - console.log("File created successfully. fileUri: " + JSON.stringify(fileUri)); + console.log("createFile sucess, fileUri: " + JSON.stringify(fileUri)); } catch (error) { - console.error("createFile failed, error " + error); + console.error("createFile failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.createFile + +createFile(uri: string, displayName: string, callback: AsyncCallback<string>) : void; + +Creates a file in a directory. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the parent directory for the file to create.| + | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.| + +**Example** + + ```js + // The media library URI is used as an example. + // In the sample code, sourceUri indicates the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceUri = "datashare:///media/file/6"; + let displayName = "file1" + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.createFile(sourceUri, displayName, function (err, fileUri) { + if (err) { + console.error("Failed to createFile in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("createFile sucess, fileUri: " + JSON.stringify(fileUri)); + }); + } catch (error) { + console.error("createFile failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` @@ -459,9 +577,49 @@ Creates a folder in a directory. This API uses a promise to return the result. console.error("mkDir return undefined object"); return; } - console.log("Folder created successfully. dirUri: " + JSON.stringify(dirUri)); + console.log("mkDir sucess, dirUri: " + JSON.stringify(dirUri)); } catch (error) { - console.error("mkDir failed, error " + error); + console.error("mkDir failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.mkDir + +mkDir(parentUri: string, displayName: string, callback: AsyncCallback<string>) : void; + +Creates a folder in a directory. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | parentUri | string | Yes| URI of the parent directory for the folder to create.| + | displayName | string | Yes| Name of the folder to create.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the folder created.| + +**Example** + + ```js + // The media library URI is used as an example. + // In the sample code, sourceUri indicates the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceUri = "datashare:///media/file/6"; + let dirName = "dirTest" + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.mkDir(sourceUri, dirName, function (err, dirUri) { + if (err) { + console.error("Failed to mkDir in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("mkDir sucess, dirUri: " + JSON.stringify(dirUri)); + }); + } catch (error) { + console.error("mkDir failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` @@ -486,7 +644,7 @@ Opens a file. This API uses a promise to return the result. | Type| Description| | --- | -- | -| Promise<number> | Promise used to return the handle to the file opened.| +| Promise<number> | Promise used to return the file descriptor of the file opened.| **Example** @@ -499,7 +657,46 @@ Opens a file. This API uses a promise to return the result. // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. let fd = await fileAccessHelper.openFile(targetUri, fileAccess.OPENFLAGS.READ); } catch (error) { - console.error("openFile failed, error " + error); + console.error("openFile failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.openFile + +openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback<number>) : void; + +Opens a file. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file to open.| + | flags | [OPENFLAGS](#openflags) | Yes| File open mode.| + | callback | AsyncCallback<number> | Yes| Promise used to return the file descriptor of the file opened.| + +**Example** + + ```js + // The media library URI is used as an example. + //In the sample code, targetUri indicates a file in the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let targetUri = "datashare:///media/file/100"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.openFile(targetUri, fileAccess.OPENFLAGS.READ, function (err, fd) { + if (err) { + console.error("Failed to openFile in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("openFile sucess, fd: " + fd); + }); + } catch (error) { + console.error("openFile failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` @@ -538,7 +735,45 @@ Deletes a file or folder. This API uses a promise to return the result. if (code != 0) console.error("delete failed, code " + code); } catch (error) { - console.error("delete failed, error " + error); + console.error("delete failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.delete + +delete(uri: string, callback: AsyncCallback<number>) : void; + +Deletes a file or folder. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file or folder to delete.| + | callback | AsyncCallback<number> | Yes| Promise used to return the result.| + +**Example** + + ```js + // The media library URI is used as an example. + //In the sample code, targetUri indicates a file in the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let targetUri = "datashare:///media/file/100"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.delete(targetUri, function (err, code) { + if (err) { + console.error("Failed to delete in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("delete sucess, code: " + code); + }); + } catch (error) { + console.error("delete failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` @@ -576,9 +811,49 @@ Moves a file or folder. This API uses a promise to return the result. try { // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. let fileUri = await fileAccessHelper.move(sourceFile, destFile); - console.log("Operation successful. fileUri: " + JSON.stringify(fileUri)); + console.log("move sucess, fileUri: " + JSON.stringify(fileUri)); + } catch (error) { + console.error("move failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.move + +move(sourceFile: string, destFile: string, callback: AsyncCallback<string>) : void; + +Moves a file or folder. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | sourceFile | string | Yes| URI of the file or folder to move.| + | destFile | string | Yes| URI of the folder to which the file or folder will be moved.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or folder in the destination directory.| + +**Example** + + ```js + // The media library URI is used as an example. + //In the sample code, sourceFile destFile indicates the file or folder in the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceFile = "datashare:///media/file/102"; + let destFile = "datashare:///media/file/101"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.move(sourceFile, destFile, function (err, fileUri) { + if (err) { + console.error("Failed to move in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("move sucess, fileUri: " + JSON.stringify(fileUri)); + }); } catch (error) { - console.error("move failed, error " + error); + console.error("move failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` @@ -615,9 +890,48 @@ Renames a file or folder. This API uses a promise to return the result. try { // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. let DestDir = await fileAccessHelper.rename(sourceDir, "testDir"); - console.log("Operation successful. DestDir: " + JSON.stringify(DestDir)); + console.log("rename sucess, DestDir: " + JSON.stringify(DestDir)); } catch (error) { - console.error("rename failed, error " + error); + console.error("rename failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.rename + +rename(uri: string, displayName: string, callback: AsyncCallback<string>) : void; + +Renames a file or folder. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file or folder to rename.| + | displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or folder.| + +**Example** + + ```js + // The media library URI is used as an example. + // In the sample code, sourceDir indicates a file in the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceDir = "datashare:///media/file/100"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.rename(sourceDir, "testDir", function (err, DestDir) { + if (err) { + console.error("Failed to rename in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("rename sucess, DestDir: " + JSON.stringify(DestDir)); + }); + } catch (error) { + console.error("rename failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` @@ -658,7 +972,48 @@ Checks whether a file or folder exists. This API uses a promise to return the re else console.log("sourceDir does not exist"); } catch (error) { - console.error("rename failed, error " + error); + console.error("access failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.access + +access(sourceFileUri: string, callback: AsyncCallback<boolean>) : void; + +Checks whether a file or folder exists. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | sourceFileUri | string | Yes| URI of the file or folder.| + | callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| + +**Example** + + ```js + // The media library URI is used as an example. + // In the sample code, sourceDir indicates a file in the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceDir = "datashare:///media/file/100"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.access(sourceDir, function (err, existJudgment) { + if (err) { + console.error("Failed to access in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + if (existJudgment) + console.log("sourceDir exists"); + else + console.log("sourceDir does not exist"); + }); + } catch (error) { + console.error("access failed, errCode:" + error.code + ", errMessage:" + error.message); }; ``` diff --git a/en/application-dev/reference/apis/js-apis-fileExtensionInfo.md b/en/application-dev/reference/apis/js-apis-fileExtensionInfo.md index 43ccea2e0fadb8875acd0bbd18225d57a3ee62a8..f91966f296e6e2e940cac09ba0598092a7653672 100644 --- a/en/application-dev/reference/apis/js-apis-fileExtensionInfo.md +++ b/en/application-dev/reference/apis/js-apis-fileExtensionInfo.md @@ -1,4 +1,4 @@ -# @ohos.fileExtensionInfo +# @ohos.file.fileExtensionInfo (User File Extension Information) The **fileExtensionInfo** module defines attributes in **RootInfo** and **FileInfo** of the user file access and management module. @@ -10,7 +10,7 @@ The **fileExtensionInfo** module defines attributes in **RootInfo** and **FileIn ## Modules to Import ```js -import fileExtensionInfo from '@ohos.fileExtensionInfo'; +import fileExtensionInfo from '@ohos.file.fileExtensionInfo'; ``` ## fileExtensionInfo.DeviceType @@ -40,7 +40,7 @@ Defines the values of **deviceFlags** used in **RootInfo**. **deviceFlags** is u | Name| Type | Readable| Writable| Description | | ------ | ------ | ---- | ---- | -------- | | SUPPORTS_READ | number | Yes | No | The device supports read.| - | SUPPORTS_WRITE | number | Yes | No | This device supports write.| + | SUPPORTS_WRITE | number | Yes | No | The device supports write.| ## fileExtensionInfo.DocumentFlag diff --git a/en/application-dev/reference/apis/js-apis-fileio.md b/en/application-dev/reference/apis/js-apis-fileio.md index 8a55647849f7b2633a7b69e6fc5ff49f4a20f1e6..ef56fa3d0c876f57b4a38c3dd175a16566fc4dad 100644 --- a/en/application-dev/reference/apis/js-apis-fileio.md +++ b/en/application-dev/reference/apis/js-apis-fileio.md @@ -1,4 +1,4 @@ -# File Management +# @ohos.fileio (File Management) The **fileio** module provides APIs for file storage and management, including basic file management, directory management, file information statistics, and stream read and write. @@ -40,7 +40,7 @@ FA Model let pathDir = data; }) ``` - + For details about how to obtain the context of the FA model, see [FA Model](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-Context.md#context). ## fileio.stat diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md b/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md index 6a8cabde0302010e3739f298ba03583325491ef8..a61dd42ece2d52f0da53dd51f33770483b37757e 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md @@ -1,4 +1,4 @@ -# InputMethodExtensionAbility +# @ohos.InputMethodExtensionAbility (InputMethodExtensionAbility) The **InputMethodExtensionAbility** module provides APIs for developing input methods and managing their lifecycles. @@ -9,7 +9,7 @@ The **InputMethodExtensionAbility** module provides APIs for developing input me ## Modules to Import ```js -import InputMethodExtensionAbility from '@ohos.inputmethodextensionability'; +import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility'; ``` ## Attributes diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md b/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md index b33db13faa840a1660a42e612ef5a4d523241877..37dadd8e2ce6cd3e7c2f33ab05154f20b52cf844 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md @@ -1,4 +1,4 @@ -# @ohos.inputmethodextensioncontext (InputMethodExtensionContext) +# @ohos.InputMethodExtensionContext (InputMethodExtensionContext) The **InputMethodExtensionContext** module, inherited from **ExtensionContext**, provides context for **InputMethodExtension** abilities. @@ -11,7 +11,7 @@ You can use the APIs of this module to start, terminate, connect, and disconnect ## Modules to Import ``` -import InputMethodExtensionContext from '@ohos.inputmethodextensioncontext'; +import InputMethodExtensionContext from '@ohos.InputMethodExtensionContext'; ``` ## Usage @@ -19,7 +19,7 @@ import InputMethodExtensionContext from '@ohos.inputmethodextensioncontext'; Before using the **InputMethodExtensionContext** module, you must define a child class that inherits from **InputMethodExtensionAbility**. ```js -import InputMethodExtensionAbility from '@ohos.inputmethodextensionability'; +import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility'; class EntryAbility extends InputMethodExtensionAbility { onCreate() { let context = this.context; @@ -66,9 +66,9 @@ Terminates this ability. This API uses a promise to return the result. **Example** ```js -this.context.destroy().then((data) => { - console.log('success:' + JSON.stringify(data)); +this.context.destroy().then(() => { + console.log('Succeed in destroying context.'); }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); + console.log('Failed to destroy context: ' + JSON.stringify(error)); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md b/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md index 61ec49997ccb35b204f860e57b0985793598e071..8f1a3fddc9344bcf5d04a526b5c70a77837e29d0 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md @@ -1,6 +1,6 @@ -# @ohos.inputmethodsubtype +# @ohos.InputMethodSubtype (Input Method Subtype) -The **inputMethodSubtype** module provides APIs for managing the attributes of input method subtypes. Different attribute settings result in different subtypes. +The **InputMethodSubtype** module provides APIs for managing the attributes of input method subtypes. Different attribute settings result in different subtypes. > **NOTE** > @@ -9,7 +9,7 @@ The **inputMethodSubtype** module provides APIs for managing the attributes of i ## Modules to Import ``` -import inputMethodEngine from '@ohos.inputMethodSubtype'; +import InputMethodSubtype from '@ohos.InputMethodSubtype'; ``` ## Attributes diff --git a/en/application-dev/reference/apis/js-apis-inputmethod.md b/en/application-dev/reference/apis/js-apis-inputmethod.md index 424e48b357711a7ee94eb4b048f107d7ad4c7a3d..bdc166cd9d3b5a60636214b72311a2c8368c8d6d 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod.md @@ -1,4 +1,4 @@ -# @ohos.inputmethod +# @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. @@ -10,7 +10,7 @@ The **inputMethod** module provides an input method framework, which can be used ## Modules to Import ```js -import inputMethod from '@ohos.inputmethod'; +import inputMethod from '@ohos.inputMethod'; ``` ## Constants8+ @@ -111,7 +111,7 @@ Switches to another input method. This API uses an asynchronous callback to retu | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | target | [InputMethodProperty](#inputmethodproperty8) | Yes| Input method to switch to.| -| callback | AsyncCallback<boolean> | 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. | +| callback | AsyncCallback<boolean> | 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** @@ -160,15 +160,15 @@ Switches to another input method. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -|target | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + |target | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| **Return value** -| Type | Description | -| ----------------------------------------- | ---------------------------- | -| Promise\ | Promise used to return the result. The value **true** means that the switching is successful, and **false** means the opposite.| + | Type | Description | + | ----------------------------------------- | ---------------------------- | + | Promise\ | Promise used to return the result. The value **true** means that the switching is successful, and **false** means the opposite.| **Error codes** @@ -240,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.| -| callback | AsyncCallback<boolean> | 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. | +| callback | AsyncCallback<boolean> | 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** @@ -376,7 +376,7 @@ Switches to a specified subtype of a specified input method. This API uses an as | -------- | -------- | -------- | -------- | |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| |inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| -| callback | AsyncCallback<boolean> | 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. | +| callback | AsyncCallback<boolean> | 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** @@ -557,7 +557,7 @@ Ends this input session. The invoking of this API takes effect only after the in | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 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. | +| callback | AsyncCallback<boolean> | 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** @@ -643,7 +643,7 @@ Shows this soft keyboard. This API must be used with the input text box and work | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| **Error codes** @@ -715,7 +715,7 @@ Hides this soft keyboard. This API must be used with the input text box and work | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| **Error codes** @@ -789,7 +789,7 @@ Ends this input session. The invoking of this API takes effect only after the in | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 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. | +| callback | AsyncCallback<boolean> | 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.| **Example** @@ -1157,7 +1157,7 @@ Displays a dialog box for selecting an input method. This API uses an asynchrono | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 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. | +| callback | AsyncCallback<boolean> | 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** @@ -1291,7 +1291,7 @@ Displays a dialog box for selecting an input method. This API uses an asynchrono | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-inputmethodengine.md b/en/application-dev/reference/apis/js-apis-inputmethodengine.md index 2c87f74698434a68279b5e1c627e2a7352819a38..7cfb76e570ae3faf57fdf3ff31cd6cbcb9103eae 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethodengine.md +++ b/en/application-dev/reference/apis/js-apis-inputmethodengine.md @@ -1,6 +1,6 @@ -# @ohos.inputmethodengine +# @ohos.inputMethodEngine (Input Method Service) -The **inputMethodEngine** module streamlines the interaction between input methods and applications. By calling APIs of this module, applications can be bound to input method services to accept text input through the input methods, request the keyboard to display or hide, listen for the input method status, and much more. +The **inputMethodEngine** module streamlines the interactions between input methods and applications. By calling APIs of this module, applications can be bound to input method services to accept text input, request the keyboard to display or hide, listen for the input method status, and much more. > **NOTE** > @@ -9,7 +9,7 @@ The **inputMethodEngine** module streamlines the interaction between input metho ## Modules to Import ``` -import inputMethodEngine from '@ohos.inputmethodengine'; +import inputMethodEngine from '@ohos.inputMethodEngine'; ``` ## Constants @@ -203,7 +203,7 @@ Enables listening for a keyboard event. This API uses an asynchronous callback t | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Listening type.
- The value **'keyboardShow'** indicates the keyboard display event.
- The value **'keyboardHide'** indicates the keyboard hiding event. | +| type | string | Yes | Listening type.
- The value **'keyboardShow'** indicates the keyboard display event.
- The value **'keyboardHide'** indicates the keyboard hiding event.| | callback | () => void | Yes | Callback used to return the result. | **Example** @@ -418,7 +418,7 @@ Disables listening for a keyboard event. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Listening type.
The value **'keyboardShow'** indicates the keyboard display event.
The value **'keyboardHide'** indicates the keyboard hiding event.| +| type | string | Yes | Listening type.
- The value **'keyboardShow'** indicates the keyboard display event.
- The value **'keyboardHide'** indicates the keyboard hiding event.| | callback | () => void | No | Callback used to return the result. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-launcherBundleManager.md b/en/application-dev/reference/apis/js-apis-launcherBundleManager.md index 505c29ae0ef6cc18404767eaa4a4b4ac88296651..3180bf582281372886331d6d37ff059cad79e1db 100644 --- a/en/application-dev/reference/apis/js-apis-launcherBundleManager.md +++ b/en/application-dev/reference/apis/js-apis-launcherBundleManager.md @@ -1,4 +1,4 @@ -# @ohos.bundle.launcherBundleManager +# @ohos.bundle.launcherBundleManager (launcherBundleManager) The **bundle.launcherBundleManager** module providers APIs for the **Home Screen** application to obtain the launcher ability information and shortcut information. diff --git a/en/application-dev/reference/apis/js-apis-linkedlist.md b/en/application-dev/reference/apis/js-apis-linkedlist.md index 0e745d749c0967cd515a91356750f7de0703ace7..bc51f25fbb6c54f7fadc6bdd05533113a1c7254c 100644 --- a/en/application-dev/reference/apis/js-apis-linkedlist.md +++ b/en/application-dev/reference/apis/js-apis-linkedlist.md @@ -389,7 +389,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message| | -------- | -------- | | 10200011 | The removeFirst method cannot be bound. | -| 10200010 | The container is empty. | +| 10200010 | Container is empty. | **Example** @@ -424,7 +424,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message| | -------- | -------- | | 10200011 | The removeLast method cannot be bound. | -| 10200010 | The container is empty. | +| 10200010 | Container is empty. | **Example** @@ -504,7 +504,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message| | -------- | -------- | | 10200011 | The removeFirstFound method cannot be bound. | -| 10200010 | The container is empty. | +| 10200010 | Container is empty. | **Example** @@ -544,7 +544,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | ID| Error Message| | -------- | -------- | | 10200011 | The removeLastFound method cannot be bound. | -| 10200010 | The container is empty. | +| 10200010 | Container is empty. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-reminderAgent.md b/en/application-dev/reference/apis/js-apis-reminderAgent.md index 29b20c42950323df2346d817922f178d71d11a80..3f9387defec0e68dc6414fdb4b21c5bca9cb1490 100644 --- a/en/application-dev/reference/apis/js-apis-reminderAgent.md +++ b/en/application-dev/reference/apis/js-apis-reminderAgent.md @@ -1,4 +1,4 @@ -# @ohos.reminderAgent (reminderAgent) +# @ohos.reminderAgent (Reminder Agent) The **reminderAgent** module provides APIs for publishing scheduled reminders through the reminder agent. diff --git a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md index ab3d0f116871392e6cdbf0c004b9c418c5660e16..f443c028e40072e8b402f93b54be1e9ecfdc0842 100644 --- a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md +++ b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md @@ -1,4 +1,4 @@ -# @ohos.reminderAgentManager (reminderAgentManager) +# @ohos.reminderAgentManager (Reminder Agent Management) The **reminderAgentManager** module provides APIs for publishing scheduled reminders through the reminder agent. diff --git a/en/application-dev/reference/apis/js-apis-request.md b/en/application-dev/reference/apis/js-apis-request.md index d3a0eeb30ea75a3109b6917d50b7b1d24cdd2fb4..0ee58f75024c1b9a8fcbcb2319f3f75482050b61 100644 --- a/en/application-dev/reference/apis/js-apis-request.md +++ b/en/application-dev/reference/apis/js-apis-request.md @@ -2,7 +2,8 @@ The **request** module provides applications with basic upload, download, and background transmission agent capabilities. -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -35,7 +36,6 @@ The **cleartextTraffic** attribute is not involved during application developmen The download server must support the HTTP HEAD method so that the size of the data to download can be obtained through **Content-length**. Otherwise, the download task fails. If this is the case, you can check the failure cause through [on('fail')7+](#onfail7). -Only HTTP requests are supported. HTTPS requests are not supported. ## Constants @@ -77,7 +77,7 @@ The table below lists the causes of download pause that may be returned by [getT | PAUSED_QUEUED_FOR_WIFI7+ | number | 0 | Download paused and queuing for a WLAN connection, because the file size exceeds the maximum value allowed by a mobile network session.| | PAUSED_WAITING_FOR_NETWORK7+ | number | 1 | Download paused due to a network connection problem, for example, network disconnection.| | PAUSED_WAITING_TO_RETRY7+ | number | 2 | Download paused and then retried.| -| PAUSED_BY_USER9+ | number | 3 | The user paused the session. | +| PAUSED_BY_USER9+ | number | 3 | The user paused the session.| | PAUSED_UNKNOWN7+ | number | 4 | Download paused due to unknown reasons.| ### Download Task Status Codes @@ -128,7 +128,7 @@ For details about the error codes, see [Upload and Download Error Codes](../erro ```js let uploadTask; let uploadConfig = { - url: 'http://patch', + url: 'https://patch', header: { key1: "value1", key2: "value2" }, method: "POST", files: [{ filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" }], @@ -176,7 +176,7 @@ For details about the error codes, see [Upload and Download Error Codes](../erro ```js let uploadTask; let uploadConfig = { - url: 'http://patch', + url: 'https://patch', header: { key1: "value1", key2: "value2" }, method: "POST", files: [{ filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" }], @@ -228,7 +228,7 @@ Uploads files. This API uses a promise to return the result. ```js let uploadTask; let uploadConfig = { - url: 'http://patch', + url: 'https://patch', header: { key1: "value1", key2: "value2" }, method: "POST", files: [{ filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" }], @@ -270,7 +270,7 @@ Uploads files. This API uses an asynchronous callback to return the result. ```js let uploadTask; let uploadConfig = { - url: 'http://patch', + url: 'https://patch', header: { key1: "value1", key2: "value2" }, method: "POST", files: [{ filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" }], @@ -318,7 +318,7 @@ Uploads files. This API uses a promise to return the result. ```js let uploadTask; let uploadConfig = { - url: 'http://patch', + url: 'https://patch', header: { key1: "value1", key2: "value2" }, method: "POST", files: [{ filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" }], @@ -359,7 +359,7 @@ Uploads files. This API uses an asynchronous callback to return the result. ```js let uploadTask; let uploadConfig = { - url: 'http://patch', + url: 'https://patch', header: { key1: "value1", key2: "value2" }, method: "POST", files: [{ filename: "test", name: "test", uri: "internal://cache/test.jpg", type: "jpg" }], @@ -376,7 +376,7 @@ Uploads files. This API uses an asynchronous callback to return the result. ## UploadTask -Implements file uploads. Before using any APIs of this class, you must obtain an **UploadTask** object through [request.uploadFile9+](#requestuploadfile9) in promise mode or [request.uploadFile9+](#requestuploadfile9-1) in callback mode. +Implements file uploads. Before using any APIs of this class, you must obtain an **UploadTask** object. ### on('progress') @@ -399,8 +399,8 @@ Parameters of the callback function | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uploadedSize | number | Yes| Size of the uploaded files, in bytes. | -| totalSize | number | Yes| Total size of the files to upload, in bytes. | +| uploadedSize | number | Yes| Size of the uploaded files, in bits. | +| totalSize | number | Yes| Total size of the files to upload, in bits. | **Example** @@ -504,12 +504,12 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret | type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (upload progress).| | callback | function | No| Callback for the upload progress event.| - Parameters of the callback function +Parameters of the callback function | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| uploadedSize | number | Yes| Size of the uploaded files, in bytes. | -| totalSize | number | Yes| Total size of the files to upload, in bytes. | +| uploadedSize | number | Yes| Size of the uploaded files, in bits. | +| totalSize | number | Yes| Total size of the files to upload, in bits. | **Example** @@ -764,7 +764,7 @@ Removes this upload task. This API uses an asynchronous callback to return the r | -------- | -------- | -------- | -------- | | filename | string | Yes| File name in the header when **multipart** is used.| | name | string | Yes| Name of a form item when **multipart** is used. The default value is **file**.| -| uri | string | Yes| Local path for storing files.
The **dataability** and **internal** protocol types are supported. However, the **internal** protocol type supports only temporary directories. Below are examples:
dataability:///com.domainname.dataability.persondata/person/10/file.txt

internal://cache/path/to/file.txt | +| uri | string | Yes| Local path for storing files.
Only the **internal** protocol type is supported. In the value, **internal://cache/** is mandatory. Example:
internal://cache/path/to/file.txt | | type | string | Yes| Type of the file content. By default, the type is obtained based on the extension of the file name or URI.| @@ -1027,7 +1027,7 @@ Downloads files. This API uses an asynchronous callback to return the result. ## DownloadTask -Implements file downloads. Before using any APIs of this class, you must obtain a **DownloadTask** object through [request.downloadFile9+](#requestdownloadfile9) in promise mode or [request.downloadFile9+](#requestdownloadfile9-1) in callback mode. +Implements file downloads. Before using any APIs of this class, you must obtain a **DownloadTask** object. ### on('progress') @@ -1047,12 +1047,12 @@ Subscribes to a download event. This API uses an asynchronous callback to return | type | string | Yes| Type of the event to subscribe to. The value is **'progress'** (download progress).| | callback | function | Yes| Callback for the download progress event.| - Parameters of the callback function +Parameters of the callback function | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| receivedSize | number | Yes| Size of the downloaded files, in bytes. | -| totalSize | number | Yes| Total size of the files to download, in bytes. | +| receivedSize | number | Yes| Size of the downloaded files, in bits. | +| totalSize | number | Yes| Total size of the files to download, in bits. | **Example** @@ -1085,8 +1085,8 @@ Parameters of the callback function | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| receivedSize | number | Yes| Size of the downloaded files, in bytes. | -| totalSize | number | Yes| Total size of the files to download, in bytes. | +| receivedSize | number | Yes| Size of the downloaded files, in bits. | +| totalSize | number | Yes| Total size of the files to download, in bits. | **Example** @@ -1252,7 +1252,7 @@ Removes this download task. This API uses a promise to return the result. delete(callback: AsyncCallback<boolean>): void -Removes this download task. This API uses an asynchronous callback to return the result. +Deletes this download task. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.INTERNET @@ -1262,7 +1262,7 @@ Removes this download task. This API uses an asynchronous callback to return the | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the task removal result.| +| callback | AsyncCallback<boolean> | Yes| Callback used to return the task deletion result. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md index 70f20b743d5ee09f2c79877ab626d76fdaeb0d95..0e7ad7e7c38f32e85af6ab3504252da38afb32eb 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md @@ -1,4 +1,4 @@ -# @ohos.resourceschedule.workScheduler (workScheduler) +# @ohos.resourceschedule.workScheduler (Work Scheduler) The **workScheduler** module provides the APIs for registering, canceling, and querying Work Scheduler tasks, which do not have real-time constraints. diff --git a/en/application-dev/reference/apis/js-apis-screen-lock.md b/en/application-dev/reference/apis/js-apis-screen-lock.md index c726ec7c8fdd4cd6f16d71f5a6892bc565b66cf6..aebd21314c8d71e68409b4b5d89af29161614950 100644 --- a/en/application-dev/reference/apis/js-apis-screen-lock.md +++ b/en/application-dev/reference/apis/js-apis-screen-lock.md @@ -100,14 +100,6 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. | -------- | --------------------- | ---- | ------------------------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** means that the screen is unlocked successfully, and **false** means the opposite.| -**Error codes** - -For details about the error codes, see [Screen Lock Management Error Codes](../errorcodes/errorcode-screenlock.md). - -| ID| Error Message| -| -------- | ---------------------------------------- | -| 13200002 | The screenlock management service is abnormal. | - **Example** ```js @@ -134,14 +126,6 @@ Unlocks the screen. This API uses a promise to return the result. | ------------------- | ------------------------------------------------------------ | | Promise<boolean> | Promise used to return the result. The value **true** means that the screen is unlocked successfully, and **false** means the opposite.| -**Error codes** - -For details about the error codes, see [Screen Lock Management Error Codes](../errorcodes/errorcode-screenlock.md). - -| ID| Error Message| -| -------- | ---------------------------------------- | -| 13200002 | The screenlock management service is abnormal. | - **Example** ```js @@ -168,14 +152,6 @@ Locks the screen. This API uses an asynchronous callback to return the result. | -------- | ---------------------- | ---- | ---------------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** means that the screen is locked successfully, and **false** means the opposite.| -**Error codes** - -For details about the error codes, see [Screen Lock Management Error Codes](../errorcodes/errorcode-screenlock.md). - -| ID| Error Message| -| -------- | ---------------------------------------- | -| 13200002 | The screenlock management service is abnormal. | - **Example** ```js @@ -204,13 +180,6 @@ Locks the screen. This API uses a promise to return the result. | ---------------------- | ------------------------------------------------------------ | | Promise<boolean> | Promise used to return the result. The value **true** means that the screen is locked successfully, and **false** means the opposite.| -**Error codes** - -For details about the error codes, see [Screen Lock Management Error Codes](../errorcodes/errorcode-screenlock.md). - -| ID| Error Message| -| -------- | ---------------------------------------- | -| 13200002 | The screenlock management service is abnormal. | **Example** @@ -226,7 +195,7 @@ screenlock.lock().then((data) => { onSystemEvent(callback: Callback<SystemEvent>): boolean -Registers a callback for system events related to screen locking. +Registers a callback for system events related to screen locking. This API can be called only by system screen lock applications. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -244,13 +213,6 @@ Registers a callback for system events related to screen locking. | ------- | ------------------------------------------------- | | boolean | Returns **true** if the callback is registered successfully; returns **false** otherwise.| -**Error codes** - -For details about the error codes, see [Screen Lock Management Error Codes](../errorcodes/errorcode-screenlock.md). - -| ID| Error Message| -| -------- | ---------------------------------------- | -| 13200002 | The screenlock management service is abnormal. | **Example** @@ -282,13 +244,6 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac | parameter | number | Yes | Result.
- **0**: The operation is successful. For example, the screen is locked or unlocked successfully.
- **1**, the operation fails. For example, screen locking or unlocking fails.
- **2**: The operation is canceled. For example, screen locking or unlocking is canceled.| | callback | AsyncCallback\ | Yes | Callback used to return the result. The **value** true means that the event is sent successfully, and **false** means the opposite. | -**Error codes** - -For details about the error codes, see [Screen Lock Management Error Codes](../errorcodes/errorcode-screenlock.md). - -| ID| Error Message| -| -------- | ---------------------------------------- | -| 13200002 | The screenlock management service is abnormal. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-screenshot.md b/en/application-dev/reference/apis/js-apis-screenshot.md index 4fa5e15b59c8d70b09f5bcf8cd1e9686ba329a14..309a1bc64491497bf61aaf6f2695a9d5c4fbd9d4 100644 --- a/en/application-dev/reference/apis/js-apis-screenshot.md +++ b/en/application-dev/reference/apis/js-apis-screenshot.md @@ -1,4 +1,4 @@ -# @ohos.screenshot +# @ohos.screenshot (Screenshot) The **Screenshot** module provides APIs for you to set information such as the region to capture and the size of the screen region when capturing a screen. diff --git a/en/application-dev/reference/apis/js-apis-statfs.md b/en/application-dev/reference/apis/js-apis-statfs.md index b9cf5106d4369769056d0ad19ed0b4a37a75f553..975ea9f78454ac498ad22986dfa97b15b292f519 100644 --- a/en/application-dev/reference/apis/js-apis-statfs.md +++ b/en/application-dev/reference/apis/js-apis-statfs.md @@ -1,4 +1,4 @@ -# statfs +# @ohos.statfs (statfs) The statfs module provides APIs for obtaining file system information, including the total number of bytes and the number of idle bytes of the file system. diff --git a/en/application-dev/reference/apis/js-apis-stationary.md b/en/application-dev/reference/apis/js-apis-stationary.md index ceae25ac4c711e8dd3664520290fda7b897c9ae9..bd7c29020ed3d0b65501421c4b9547423986fdf9 100644 --- a/en/application-dev/reference/apis/js-apis-stationary.md +++ b/en/application-dev/reference/apis/js-apis-stationary.md @@ -5,6 +5,8 @@ The **stationary** module provides APIs to report the device status, including a > **NOTE** > > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> This module does not support x86 emulators. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-system-bluetooth.md b/en/application-dev/reference/apis/js-apis-system-bluetooth.md index a8c77cd86a20c0401d01ce1e54a61c58c7aace17..c65aef6079cb393917d7f8a44ef9d62de5e49478 100644 --- a/en/application-dev/reference/apis/js-apis-system-bluetooth.md +++ b/en/application-dev/reference/apis/js-apis-system-bluetooth.md @@ -1,4 +1,4 @@ -# Bluetooth +# @system.bluetooth (Bluetooth) > **NOTE**
diff --git a/en/application-dev/reference/apis/js-apis-system-configuration.md b/en/application-dev/reference/apis/js-apis-system-configuration.md index dfeb0cf7db9c94d7831fe96cc19c6a6c09afd471..934ceb020412a18c64499de1cb0ef1593ace2e50 100644 --- a/en/application-dev/reference/apis/js-apis-system-configuration.md +++ b/en/application-dev/reference/apis/js-apis-system-configuration.md @@ -1,4 +1,4 @@ -# Application Configuration +# @system.configuration (Application Configuration) > **NOTE**
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.i18n`](js-apis-i18n.md) and [`@ohos.intl`](js-apis-intl.md) instead. diff --git a/en/application-dev/reference/apis/js-apis-system-date-time.md b/en/application-dev/reference/apis/js-apis-system-date-time.md index 90c915b32ee35f9d09f6fe0453c962b985f914f1..38d90b668894a52dde1a4ae05578d290182bc6ef 100644 --- a/en/application-dev/reference/apis/js-apis-system-date-time.md +++ b/en/application-dev/reference/apis/js-apis-system-date-time.md @@ -1,4 +1,4 @@ -# @ohos.systemDateTime +# @ohos.systemDateTime (System Time and Time Zone) The **systemDateTime** module provides system time and time zone features. You can use the APIs of this module to set and obtain the system time and time zone. diff --git a/en/application-dev/reference/apis/js-apis-system-fetch.md b/en/application-dev/reference/apis/js-apis-system-fetch.md index b9566ae178fb1bd4d4400eb998f3b12bea609845..529dc836e0132e77cae90c08f855d8ecb2c5fe8c 100644 --- a/en/application-dev/reference/apis/js-apis-system-fetch.md +++ b/en/application-dev/reference/apis/js-apis-system-fetch.md @@ -1,8 +1,9 @@ -# Data Request +# @system.fetch (Data Request) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE** +> > - The APIs of this module are no longer maintained since API version 6. You are advised to use [`@ohos.net.http`](js-apis-http.md) instead. -> +> > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-system-file.md b/en/application-dev/reference/apis/js-apis-system-file.md index 841f0b90056e377710f20336a3a5bf07ba58dde8..8483433af3dd490b8ae640b74d2e31378c45b6d2 100644 --- a/en/application-dev/reference/apis/js-apis-system-file.md +++ b/en/application-dev/reference/apis/js-apis-system-file.md @@ -1,4 +1,4 @@ -# File Storage +# @system.file (File Storage) > **NOTE**
> - The APIs of this module are no longer maintained since API version 6. You are advised to use [`@ohos.fileio`](js-apis-fileio.md). diff --git a/en/application-dev/reference/apis/js-apis-system-location.md b/en/application-dev/reference/apis/js-apis-system-location.md index fd4fba8512b1cdecae82339ef31a4b293f022aef..4f34c5ade9c9721f58ab188320291136e19eba73 100644 --- a/en/application-dev/reference/apis/js-apis-system-location.md +++ b/en/application-dev/reference/apis/js-apis-system-location.md @@ -1,6 +1,7 @@ -# Geographic Location +# @system.geolocation (Geographic Location) > **NOTE** +> > - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.geolocation`](js-apis-geolocation.md). > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-system-request.md b/en/application-dev/reference/apis/js-apis-system-request.md index a2b939bf7d0983a25202fe11b7c5dd4ddd9d3665..675a7fb9977fb5756d8a9a84296eebf0049011cb 100644 --- a/en/application-dev/reference/apis/js-apis-system-request.md +++ b/en/application-dev/reference/apis/js-apis-system-request.md @@ -1,9 +1,9 @@ -# @system.request +# @system.request (Upload and Download) The **system.request** module provides applications with basic upload and download capabilities. > **NOTE** -> - The APIs of this module are deprecated since API version 9. You are advised to use [`@ohos.request`](js-apis-request.md) instead. +> - The APIs of this module are deprecated since API version 9. You are advised to use [@ohos.request](js-apis-request.md) instead. > > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -25,9 +25,9 @@ Uploads a file. This API returns no value. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | options | [UploadRequestOptions](#uploadrequestoptions) | Yes| Upload configurations.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| options | [UploadRequestOptions](#uploadrequestoptions) | Yes| Upload configurations.| **Example** @@ -61,27 +61,27 @@ Uploads a file. This API returns no value. **System capability**: SystemCapability.MiscServices.Upload - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | url | string | Yes| URL of the upload server.| - | data | Array<[RequestData](#requestdata)> | No| Form data in the request body.| - | files | Array<[RequestFile](#requestfile)> | Yes| List of files to upload, which is submitted through **multipart/form-data**.| - | header | Object | No| Request header.| - | method | string | No| Request method, which can be **'POST'** or **'PUT'**. The default value is **POST**.| - | success | Function | No| Called when API call is successful.| - | fail | Function | No| Called when API call has failed.| - | complete | Function | No| Called when API call is complete.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| url | string | Yes| URL of the upload server.| +| data | Array<[RequestData](#requestdata)> | No| Form data in the request body.| +| files | Array<[RequestFile](#requestfile)> | Yes| List of files to upload, which is submitted through **multipart/form-data**.| +| header | Object | No| Request header.| +| method | string | No| Request method, which can be **'POST'** or **'PUT'**. The default value is **POST**.| +| success | Function | No| Called when API call is successful.| +| fail | Function | No| Called when API call has failed.| +| complete | Function | No| Called when API call is complete.| **success parameter** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | data | [UploadResponse](#uploadresponse) | Yes| Information returned when the upload task is successful.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| data | [UploadResponse](#uploadresponse) | Yes| Information returned when the upload task is successful.| **fail parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | data | any | Yes| Header information returned when the upload task fails.| - | code | number | Yes| HTTP status code returned when the upload task fails.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| data | any | Yes| Header information returned when the upload task fails.| +| code | number | Yes| HTTP status code returned when the upload task fails.| @@ -89,33 +89,33 @@ Uploads a file. This API returns no value. **System capability**: SystemCapability.MiscServices.Upload - | Name| Type| Description| - | -------- | -------- | -------- | - | code | number | HTTP status code returned by the server.| - | data | string | Content returned by the server. The value type is determined by the type in the returned headers.| - | headers | Object | Headers returned by the server.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| code | number | Yes| HTTP status code returned by the server.| +| data | string | Yes| Content returned by the server. The value type is determined by the type in the returned headers.| +| headers | Object | Yes| Headers returned by the server.| ## RequestFile **System capability**: SystemCapability.MiscServices.Upload - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | filename | string | No| File name in the header when **multipart** is used.| - | name | string | No| Name of a form item when **multipart** is used. The default value is **file**.| - | uri | string | Yes| Local path for storing files.| - | type | string | No| Type of the file content. By default, the type is obtained based on the extension of the file name or URI.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| filename | string | No| File name in the header when **multipart** is used.| +| name | string | No| Name of a form item when **multipart** is used. The default value is **file**.| +| uri | string | Yes| Local path for storing files.| +| type | string | No| Type of the file content. By default, the type is obtained based on the extension of the file name or URI.| ## RequestData **System capability**: SystemCapability.MiscServices.Upload - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | name | string | Yes| Name of the form element.| - | value | string | Yes| Value of the form element.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| name | string | Yes| Name of the form element.| +| value | string | Yes| Value of the form element.| @@ -129,9 +129,9 @@ Downloads a file. This API returns no value. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | options | [DownloadRequestOptions](#downloadrequestoptions) | Yes| Download configurations.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| options | [DownloadRequestOptions](#downloadrequestoptions) | Yes| Download configurations.| **Example** @@ -164,34 +164,34 @@ Downloads a file. This API returns no value. **System capability**: SystemCapability.MiscServices.Download - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | url | string | Yes| Resource URL.| - | filename | string | No| Name of the file to download. The value is obtained from the current request or resource URL by default.| - | header | Object | No| Request header.| - | description | string | No| Download description. The default value is the file name.| - | success | Function | No| Called when API call is successful.| - | fail | Function | No| Called when API call has failed.| - | complete | Function | No| Called when API call is complete.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| url | string | Yes| Resource URL.| +| filename | string | No| Name of the file to download. The value is obtained from the current request or resource URL by default.| +| header | Object | No| Request header.| +| description | string | No| Download description. The default value is the file name.| +| success | Function | No| Called when API call is successful.| +| fail | Function | No| Called when API call has failed.| +| complete | Function | No| Called when API call is complete.| **success parameter** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | data | [DownloadResponse](#downloadresponse) | Yes| Information returned when the download task is successful.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| data | [DownloadResponse](#downloadresponse) | Yes| Information returned when the download task is successful.| **fail parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | data | any | Yes| Header information returned when the download task fails.| - | code | number | Yes| HTTP status code returned when the download task fails.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| data | any | Yes| Header information returned when the download task fails.| +| code | number | Yes| HTTP status code returned when the download task fails.| ## DownloadResponse **System capability**: SystemCapability.MiscServices.Download - | Name| Type| Description| - | -------- | -------- | -------- | - | token | string | Download token, which is used to obtain the download status| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| token | string | Yes| Download token, which is used to obtain the download status| ## request.onDownloadComplete @@ -204,9 +204,9 @@ Listens for download task status. This API returns no value. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | options | [OnDownloadCompleteOptions](#ondownloadcompleteoptions) | Yes| Configurations of the download task.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| options | [OnDownloadCompleteOptions](#ondownloadcompleteoptions) | Yes| Configurations of the download task.| **Example** @@ -231,29 +231,29 @@ Listens for download task status. This API returns no value. **System capability**: SystemCapability.MiscServices.Download - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | token | string | Yes| Result token returned by the download API.| - | success | Function | No| Called when API call is successful.| - | fail | Function | No| Called when API call has failed.| - | complete | Function | No| Called when API call is complete.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| token | string | Yes| Result token returned by the download API.| +| success | Function | No| Called when API call is successful.| +| fail | Function | No| Called when API call has failed.| +| complete | Function | No| Called when API call is complete.| **success parameter** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | data | [OnDownloadCompleteResponse](#ondownloadcompleteresponse) | Yes| Information returned when the download task is successful.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| data | [OnDownloadCompleteResponse](#ondownloadcompleteresponse) | Yes| Information returned when the download task is successful.| **fail parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | data | any | Yes| Header information returned when the download task fails.| - | code | number | Yes| HTTP status code returned when the download task fails.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| data | any | Yes| Header information returned when the download task fails.| +| code | number | Yes| HTTP status code returned when the download task fails.| ## OnDownloadCompleteResponse **System capability**: SystemCapability.MiscServices.Download - | Name| Type| Description| - | -------- | -------- | -------- | - | uri | string | URI of the download file.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| uri | string | Yes| URI of the download file.| diff --git a/en/application-dev/reference/apis/js-apis-system-storage.md b/en/application-dev/reference/apis/js-apis-system-storage.md index a593a0972638bbbf376fb9bcb0693009b081e197..0549fac53863bd341d1ff0d1aa8d0e95a0a262c8 100644 --- a/en/application-dev/reference/apis/js-apis-system-storage.md +++ b/en/application-dev/reference/apis/js-apis-system-storage.md @@ -1,23 +1,22 @@ -# Data Storage +# @system.storage (Data Storage) -> **NOTE**
+> **NOTE** > -> - The APIs of this module are no longer maintained since API Version 6, and you are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API Version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md). +> - The APIs of this module are no longer maintained since API version 6, and you are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md). > -> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> - The APIs of this module can be used only in the FA model. +> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> - The APIs of this module can be used only in the FA model. ## Modules to Import - ```js import storage from '@system.storage'; ``` - ## storage.get -get(Object): void +get(options: GetStorageOptions): void Reads the value stored in the cache based on the specified key. @@ -25,13 +24,9 @@ Reads the value stored in the cache based on the specified key. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data to read.| -| default | string | No| Default value returned when the **key** does not exist.| -| success | Function | No| Called to return the value obtained when **storage.get()** is successful.| -| fail | Function | No| Called when **storage.get()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| -| complete | Function | No| Called when **storage.get()** is complete.| +| Name | Type | Mandatory| Description | +| ------- | -------------------- | ---- | ---------- | +| options | [GetStorageOptions](#getstorageoptions) | Yes | API configuration.| **Example** @@ -54,10 +49,9 @@ export default { } ``` - ## storage.set -set(Object): void +get(options: SetStorageOptions): void Sets the value in the cache based on the specified key. @@ -65,13 +59,9 @@ Sets the value in the cache based on the specified key. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data to set.| -| value | string | Yes| New value to set. The length must be less than 128 bytes.| -| success | Function | No| Called when **storage.set()** is successful.| -| fail | Function | No| Called when **storage.set()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| -| complete | Function | No| Called when **storage.set()** is complete.| +| Name | Type | Mandatory| Description | +| ------- | ------------------- | ---- | ---------- | +| options | [SetStorageOptions](#setstorageoptions) | Yes | API configuration.| **Example** @@ -92,10 +82,9 @@ export default { } ``` - ## storage.clear -clear(Object): void +clear(options?: ClearStorageOptions): void Clears the key-value pairs from the cache. @@ -103,11 +92,9 @@ Clears the key-value pairs from the cache. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| success | Function | No| Called when **storage.clear()** is successful.| -| fail | Function | No| Called when **storage.clear()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| -| complete | Function | No| Called when **storage.clear()** is complete.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------- | ---- | -------------- | +| options | [ClearStorageOptions](#clearstorageoptions) | No | API configuration.| **Example** @@ -126,10 +113,9 @@ export default { } ``` - ## storage.delete -delete(Object): void +delete(options: DeleteStorageOptions): void Deletes the key-value pair based on the specified key. @@ -137,12 +123,9 @@ Deletes the key-value pair based on the specified key. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data to delete.| -| success | Function | No| Called when **storage.delete()** is successful.| -| fail | Function | No| Called when **storage.delete()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| -| complete | Function | No| Called when **storage.delete()** is complete.| +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------------- | ---- | -------------- | +| options | [DeleteStorageOptions](#deletestorageoptions) | Yes | API configuration.| **Example** @@ -161,3 +144,52 @@ export default { } } ``` + +## GetStorageOptions + +**System capability**: SystemCapability.DistributedDataManager.Preferences.Core + +| Name | Type | Mandatory| Description | +| -------- | ---------------- | ---- | ------------------- | +| key | string | Yes | Key of the target data. | +| default | string | No | Default value returned when the specified key does not exist. | +| success | (data: any) => void | No | Called to return the result when **storage.get()** is called successfully. **data** is the value indexed by the specified key. | +| fail | (data: string, code: number) => void | No | Called to return the result when **storage.get()** fails to be called. **data** is the error information, and **code** indicates the error code. | +| complete | () => void | No | Called when **storage.get()** is complete. | + + +## SetStorageOptions + +**System capability**: SystemCapability.DistributedDataManager.Preferences.Core + +| Name | Type | Mandatory| Description | +| -------- | ------------------- | ---- | -------------------- | +| key | string | Yes | Key of the data to set. | +| value | string | Yes | New value to set. The length must be less than 128 bytes. | +| success | () => void | No | Called when **storage.set()** is called successfully. | +| fail | (data: string, code: number) => void | No | Called to return the result when **storage.get()** fails to be called. **data** is the error information, and **code** indicates the error code. | +| complete | () => void | No | Called when **storage.get()** is complete. | + + +## ClearStorageOptions + +**System capability**: SystemCapability.DistributedDataManager.Preferences.Core + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | -------------------- | +| success | () => void | No | Called when **storage.clear()** is called successfully. | +| fail | (data: string, code: number) => void | No | Called to return the result when **storage.clear()** fails to be called. **data** is the error information, and **code** indicates the error code. | +| complete | () => void | No | Called when **storage.clear()** is complete. | + + +## DeleteStorageOptions + +**System capability**: SystemCapability.DistributedDataManager.Preferences.Core + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ------------------ | +| key | string | Yes | Key of the data to delete. | +| success | () => void | No | Called when **storage.delete()** is called successfully. | +| fail | (data: string, code: number) => void | No | Called to return the result when **storage.delete()** fails to be called. **data** is the error information, and **code** indicates the error code. | +| complete | () => void | No | Called when **storage.delete()** is complete. | + diff --git a/en/application-dev/reference/apis/js-apis-system-time.md b/en/application-dev/reference/apis/js-apis-system-time.md index a1876af97b532bf208eb405ee9c7c22edda6919f..6454fd82ed851af06a70941cdf6ef68bf6af232a 100644 --- a/en/application-dev/reference/apis/js-apis-system-time.md +++ b/en/application-dev/reference/apis/js-apis-system-time.md @@ -1,4 +1,4 @@ -# @ohos.systemTime +# @ohos.systemTime (System Time and Time Zone) The **systemTime** module provides system time and time zone features. You can use the APIs of this module to set and obtain the system time and time zone. @@ -29,25 +29,33 @@ Sets the system time. This API uses an asynchronous callback to return the resul | time | number | Yes | Timestamp to set, in milliseconds. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| -1 | The parameter check failed or permission denied or system error. | + **Example** ```js // Set the system time to 2021-01-20 02:36:25. let time = 1611081385000; try { - systemTime.setTime(time, (error) => { - if (error) { - console.info(`Failed to setting time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in setting time`); - }); + systemTime.setTime(time, (error) => { + if (error) { + console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`); + return; + } + }console.info(`Succeeded in setting time`); + }); } catch(e) { - console.info(`Failed to set time. message:${e.message}, code:${e.code}`); + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.setTime(deprecated) +## systemTime.setTime setTime(time : number) : Promise<void> @@ -69,67 +77,75 @@ Sets the system time. This API uses a promise to return the result. | ------------------- | ------------------------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| -1 | The parameter check failed or permission denied or system error. | + **Example** ```js // Set the system time to 2021-01-20 02:36:25. let time = 1611081385000; try { - systemTime.setTime(time).then(() => { - console.info(`Succeeded in setting time.`); - }).catch((error) => { - console.info(`Failed to setting time. message:${error.message}, code:${error.code}`); - }); + systemTime.setTime(time).then(() => { + console.info(`Succeeded in setting time.`); + }).catch((error) => { + console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to set time. message:${e.message}, code:${e.code}`); + console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getCurrentTime(deprecated) +## systemTime.getCurrentTime8+ getCurrentTime(isNano: boolean, callback: AsyncCallback<number>): void Obtains the time elapsed since the Unix epoch. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getCurrentTime](./js-apis-system-date-time.md#systemdatetimegetcurrenttime). - **System capability**: SystemCapability.MiscServices.Time **Parameters** | Name | Type | Mandatory| Description | | -------- | -------------- | ---- | ------------------ | -| isNano | boolean | Yes | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds (ns).
- **false**: in milliseconds (ms).| +| isNano | boolean | Yes | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds.
- **false**: in milliseconds.| | callback | AsyncCallback<number> | Yes | Callback used to return the time elapsed since the Unix epoch. | +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getCurrentTime(true, (error, time) => { - if (error) { - console.info(`Failed to getting currentTime. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting currentTime : ${time}`); - }); + systemTime.getCurrentTime(true, (error, time) => { + if (error) { + console.info(`Failed to getting currentTime. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting currentTime: ${time}`); + }); } catch(e) { - console.info(`Failed to get currentTime. message:${e.message}, code:${e.code}`); + console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getCurrentTime(deprecated) +## systemTime.getCurrentTime8+ getCurrentTime(callback: AsyncCallback<number>): void Obtains the time elapsed since the Unix epoch. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getCurrentTime](./js-apis-system-date-time.md#systemdatetimegetcurrenttime-1). - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -138,39 +154,43 @@ Obtains the time elapsed since the Unix epoch. This API uses an asynchronous cal | -------- | ----------- | ---- | ---------------------------------- | | callback | AsyncCallback<number> | Yes | Callback used to return the time elapsed since the Unix epoch. | +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getCurrentTime((error, time) => { - if (error) { - console.info(`Failed to getting currentTime. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting currentTime : ${time}`); - }); + systemTime.getCurrentTime((error, time) => { + if (error) { + console.info(`Failed to getting currentTime. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting currentTime : ${time}`); + }); } catch(e) { - console.info(`Failed to get currentTime. message:${e.message}, code:${e.code}`); + console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getCurrentTime(deprecated) +## systemTime.getCurrentTime8+ getCurrentTime(isNano?: boolean): Promise<number> Obtains the time elapsed since the Unix epoch. This API uses a promise to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getCurrentTime](./js-apis-system-date-time.md#systemdatetimegetcurrenttime-2). - **System capability**: SystemCapability.MiscServices.Time **Parameters** | Name| Type | Mandatory| Description | | ------ | ------- | ---- | ------------------------- | -| isNano | boolean | No | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds (ns).
- **false**: in milliseconds (ms).| +| isNano | boolean | No | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds.
- **false**: in milliseconds.| **Return value** @@ -178,65 +198,73 @@ Obtains the time elapsed since the Unix epoch. This API uses a promise to return | --------------------- | --------------------------- | | Promise<number> | Promise used to return the time elapsed since the Unix epoch.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getCurrentTime().then((time) => { - console.info(`Succeeded in getting currentTime : ${time}`); - }).catch((error) => { - console.info(`Failed to getting currentTime. message:${error.message}, code:${error.code}`); - }); + systemTime.getCurrentTime().then((time) => { + console.info(`Succeeded in getting currentTime : ${time}`); + }).catch((error) => { + console.info(`Failed to getting currentTime. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get currentTime. message:${e.message}, code:${e.code}`); + console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getRealActiveTime(deprecated) +## systemTime.getRealActiveTime8+ getRealActiveTime(isNano: boolean, callback: AsyncCallback<number>): void Obtains the time elapsed since system startup, excluding the deep sleep time. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getRealActiveTime](./js-apis-system-date-time.md#systemdatetimegetrealactivetime). - **System capability**: SystemCapability.MiscServices.Time **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------- | ---- | -------------------------- | -| isNano | boolean | Yes | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds (ns).
- **false**: in milliseconds (ms).| +| isNano | boolean | Yes | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds.
- **false**: in milliseconds.| | callback | AsyncCallback<number> | Yes | Callback used to return the time.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getRealActiveTime(true, (error, time) => { - if (error) { - console.info(`Failed to getting real active time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real active time : ${time}`); - }); + systemTime.getRealActiveTime(true, (error, time) => { + if (error) { + console.info(`Failed to getting real active time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real active time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real active time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real active time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getRealActiveTime(deprecated) +## systemTime.getRealActiveTime8+ getRealActiveTime(callback: AsyncCallback<number>): void Obtains the time elapsed since system startup, excluding the deep sleep time. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getRealActiveTime](./js-apis-system-date-time.md#systemdatetimegetrealactivetime-1). - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -245,39 +273,43 @@ Obtains the time elapsed since system startup, excluding the deep sleep time. Th | -------- | -------------- | ---- | --------------------- | | callback | AsyncCallback<number> | Yes | Callback used to return the time.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getRealActiveTime((error, time) => { - if (error) { - console.info(`Failed to getting real active time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real active time : ${time}`); - }); + systemTime.getRealActiveTime((error, time) => { + if (error) { + console.info(`Failed to getting real active time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real active time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real active time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real active time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getRealActiveTime(deprecated) +## systemTime.getRealActiveTime8+ getRealActiveTime(isNano?: boolean): Promise<number> Obtains the time elapsed since system startup, excluding the deep sleep time. This API uses a promise to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getRealActiveTime](./js-apis-system-date-time.md#systemdatetimegetrealactivetime-2). - **System capability**: SystemCapability.MiscServices.Time **Parameters** | Name| Type | Mandatory| Description | | ------ | ------- | ---- | ----------------------------------- | -| isNano | boolean | No | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds (ns).
- **false**: in milliseconds (ms).| +| isNano | boolean | No | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds.
- **false**: in milliseconds.| **Return value** @@ -285,65 +317,73 @@ Obtains the time elapsed since system startup, excluding the deep sleep time. Th | -------------- | -------------------------------- | | Promise<number> | Promise used to return the time elapsed since system startup, excluding the deep sleep time.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getRealActiveTime().then((time) => { - console.info(`Succeeded in getting real active time : ${time}`); - }).catch((error) => { - console.info(`Failed to getting real active time. message:${error.message}, code:${error.code}`); - }); + systemTime.getRealActiveTime().then((time) => { + console.info(`Succeeded in getting real active time : ${time}`); + }).catch((error) => { + console.info(`Failed to getting real active time. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get real active time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real active time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getRealTime(deprecated) +## systemTime.getRealTime8+ getRealTime(isNano: boolean, callback: AsyncCallback<number>): void Obtains the time elapsed since system startup, including the deep sleep time. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getRealTime](./js-apis-system-date-time.md#systemdatetimegetrealtime). - **System capability**: SystemCapability.MiscServices.Time **Parameters** | Name | Type | Mandatory| Description | | -------- | --------------- | ---- | ------------------------------- | -| isNano | boolean | Yes | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds (ns).
- **false**: in milliseconds (ms).| +| isNano | boolean | Yes | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds.
- **false**: in milliseconds.| | callback | AsyncCallback<number> | Yes | Callback used to return the time. | +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getRealTime(true, (error, time) => { - if (error) { - console.info(`Failed to getting real time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real time : ${time}`); - }); + systemTime.getRealTime(true, (error, time) => { + if (error) { + console.info(`Failed to getting real time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getRealTime(deprecated) +## systemTime.getRealTime8+ getRealTime(callback: AsyncCallback<number>): void Obtains the time elapsed since system startup, including the deep sleep time. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getRealTime](./js-apis-system-date-time.md#systemdatetimegetrealtime-1). - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -352,39 +392,43 @@ Obtains the time elapsed since system startup, including the deep sleep time. Th | -------- | --------- | ---- | --------------------------- | | callback | AsyncCallback<number> | Yes | Callback used to return the time. | +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getRealTime((error, time) => { - if (error) { - console.info(`Failed to getting real time. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in getting real time : ${time}`); - }); + systemTime.getRealTime((error, time) => { + if (error) { + console.info(`Failed to getting real time. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in getting real time : ${time}`); + }); } catch(e) { - console.info(`Failed to get real time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getRealTime(deprecated) +## systemTime.getRealTime8+ getRealTime(isNano?: boolean): Promise<number> Obtains the time elapsed since system startup, including the deep sleep time. This API uses a promise to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getRealTime](./js-apis-system-date-time.md#systemdatetimegetrealtime-2). - **System capability**: SystemCapability.MiscServices.Time **Parameters** | Name| Type | Mandatory| Description | | ------ | ------- | ---- | ------------------------------- | -| isNano | boolean | No | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds (ns).
- **false**: in milliseconds (ms).| +| isNano | boolean | No | Whether the time to return is in nanoseconds.
- **true**: in nanoseconds.
- **false**: in milliseconds.| **Return value** @@ -392,21 +436,29 @@ Obtains the time elapsed since system startup, including the deep sleep time. Th | --------------------- | ------------------------------- | | Promise<number> | Promise used to return the time elapsed since system startup, including the deep sleep time.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getRealTime().then((time) => { - console.info(`Succeeded in getting real time : ${time}`); - }).catch((error) => { - console.info(`Failed to getting real time. message:${error.message}, code:${error.code}`); - }); + systemTime.getRealTime().then((time) => { + console.info(`Succeeded in getting real time : ${time}`); + }).catch((error) => { + console.info(`Failed to getting real time. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get real time. message:${e.message}, code:${e.code}`); + console.info(`Failed to get real time. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.setDate(deprecated) +## systemTime.setDate setDate(date: Date, callback: AsyncCallback<void>): void @@ -423,24 +475,32 @@ Sets the system date. This API uses an asynchronous callback to return the resul | date | Date | Yes | Target date to set. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| -1 | The parameter check failed or permission denied or system error. | + **Example** ```js let date = new Date(); try { - systemTime.setDate(date, (error) => { - if (error) { - console.info(`Failed to setting date. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in setting date.`); - }); + systemTime.setDate(date, (error) => { + if (error) { + console.info(`Failed to setting date. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting date.`); + }); } catch(e) { - console.info(`Failed to set date. message:${e.message}, code:${e.code}`); + console.info(`Failed to set date. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.setDate(deprecated) +## systemTime.setDate setDate(date: Date): Promise<void> @@ -462,31 +522,35 @@ Sets the system date. This API uses a promise to return the result. | ------------------- | -------------------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| -1 | The parameter check failed or permission denied or system error. | + **Example** ```js let date = new Date(); try { - systemTime.setDate(date).then(() => { - console.info(`Succeeded in setting date.`); - }).catch((error) => { - console.info(`Failed to setting date. message:${error.message}, code:${error.code}`); - }); + systemTime.setDate(date).then(() => { + console.info(`Succeeded in setting date.`); + }).catch((error) => { + console.info(`Failed to setting date. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to set date. message:${e.message}, code:${e.code}`); + console.info(`Failed to set date. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getDate(deprecated) +## systemTime.getDate8+ getDate(callback: AsyncCallback<Date>): void Obtains the current system date. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getDate](./js-apis-system-date-time.md#systemdatetimegetdate). - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -495,32 +559,36 @@ Obtains the current system date. This API uses an asynchronous callback to retur | -------- | -------------- | ---- | --------------------- | | callback | AsyncCallback<Date> | Yes | Callback used to return the current system date.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getDate((error, date) => { - if (error) { - console.info(`Failed to get date. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in get date : ${date}`);; - }); + systemTime.getDate((error, date) => { + if (error) { + console.info(`Failed to get date. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in get date : ${date}`);; + }); } catch(e) { - console.info(`Failed to get date. message:${e.message}, code:${e.code}`); + console.info(`Failed to get date. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getDate(deprecated) +## systemTime.getDate8+ getDate(): Promise<Date> Obtains the current system date. This API uses a promise to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getDate](./js-apis-system-date-time.md#systemdatetimegetdate-1). - **System capability**: SystemCapability.MiscServices.Time **Return value** @@ -529,21 +597,29 @@ Obtains the current system date. This API uses a promise to return the result. | ------------------- | ----------------------------------------- | | Promise<Date> | Promise used to return the current system date.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getDate().then((date) => { - console.info(`Succeeded in getting date : ${date}`); - }).catch((error) => { - console.info(`Failed to getting date. message:${error.message}, code:${error.code}`); - }); + systemTime.getDate().then((date) => { + console.info(`Succeeded in getting date : ${date}`); + }).catch((error) => { + console.info(`Failed to getting date. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get date. message:${e.message}, code:${e.code}`); + console.info(`Failed to get date. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.setTimezone(deprecated) +## systemTime.setTimezone setTimezone(timezone: string, callback: AsyncCallback<void>): void @@ -560,23 +636,31 @@ Sets the system time zone. This API uses an asynchronous callback to return the | timezone | string | Yes | System time zone to set. For details, see [Supported System Time Zones](#supported-system-time-zones). | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| -1 | The parameter check failed or permission denied or system error. | + **Example** ```js try { - systemTime.setTimezone('Asia/Shanghai', (error) => { - if (error) { - console.info(`Failed to setting timezone. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in setting timezone.`); - }); + systemTime.setTimezone('Asia/Shanghai', (error) => { + if (error) { + console.info(`Failed to setting timezone. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in setting timezone.`); + }); } catch(e) { - console.info(`Failed to set timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to set timezone. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.setTimezone(deprecated) +## systemTime.setTimezone setTimezone(timezone: string): Promise<void> @@ -598,30 +682,34 @@ Sets the system time zone. This API uses a promise to return the result. | ------------------- | -------------------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| -1 | The parameter check failed or permission denied or system error. | + **Example** ```js try { - systemTime.setTimezone('Asia/Shanghai').then(() => { - console.info(`Succeeded in setting timezone.`); - }).catch((error) => { - console.info(`Failed to setting timezone. message:${error.message}, code:${error.code}`); - }); + systemTime.setTimezone('Asia/Shanghai').then(() => { + console.info(`Succeeded in setting timezone.`); + }).catch((error) => { + console.info(`Failed to setting timezone. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to set timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to set timezone. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getTimezone(deprecated) +## systemTime.getTimezone8+ getTimezone(callback: AsyncCallback<string>): void Obtains the system time zone. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getTimezone](./js-apis-system-date-time.md#systemdatetimegettimezone). - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -630,32 +718,36 @@ Obtains the system time zone. This API uses an asynchronous callback to return t | -------- | --------- | ---- | ------------------------ | | callback | AsyncCallback<string> | Yes | Callback used to return the system time zone. For details, see [Supported System Time Zones](#supported-system-time-zones).| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getTimezone((error, data) => { - if (error) { - console.info(`Failed to get timezone. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in get timezone : ${data}`);; - }); + systemTime.getTimezone((error, data) => { + if (error) { + console.info(`Failed to get timezone. message: ${error.message}, code: ${error.code}`); + return; + } + console.info(`Succeeded in get timezone : ${data}`);; + }); } catch(e) { - console.info(`Failed to get timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to get timezone. message: ${e.message}, code: ${e.code}`); } ``` -## systemTime.getTimezone(deprecated) +## systemTime.getTimezone8+ getTimezone(): Promise<string> Obtains the system time zone. This API uses a promise to return the result. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [systemDateTime.getTimezone](./js-apis-system-date-time.md#systemdatetimegettimezone-1). - **System capability**: SystemCapability.MiscServices.Time **Return value** @@ -664,17 +756,25 @@ Obtains the system time zone. This API uses a promise to return the result. | --------------------- | ------------------------------------- | | Promise<string> | Promise used to return the system time zone. For details, see [Supported System Time Zones](#supported-system-time-zones).| +**Error codes** + +For details about the error codes, see [Time and Time Zone Service Error Codes](../errorcodes/errorcode-time.md). + +| ID| Error Message | +| -------- | ------------------------------------------- | +| -1 | The parameter check failed or system error. | + **Example** ```js try { - systemTime.getTimezone().then((data) => { - console.info(`Succeeded in getting timezone: ${data}`); - }).catch((error) => { - console.info(`Failed to getting timezone. message:${error.message}, code:${error.code}`); - }); + systemTime.getTimezone().then((data) => { + console.info(`Succeeded in getting timezone: ${data}`); + }).catch((error) => { + console.info(`Failed to getting timezone. message: ${error.message}, code: ${error.code}`); + }); } catch(e) { - console.info(`Failed to get timezone. message:${e.message}, code:${e.code}`); + console.info(`Failed to get timezone. message: ${e.message}, code: ${e.code}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-system-timer.md b/en/application-dev/reference/apis/js-apis-system-timer.md index fb1f95ce2d8c5003377120d9d28f29f4415d3117..cb3a97212ef21d604ae41784f142ac60fcf3f353 100644 --- a/en/application-dev/reference/apis/js-apis-system-timer.md +++ b/en/application-dev/reference/apis/js-apis-system-timer.md @@ -1,4 +1,4 @@ -# @ohos.systemTimer +# @ohos.systemTimer (System Timer) The **systemTimer** module provides system timer features. You can use the APIs of this module to implement the alarm clock and other timer services. @@ -48,8 +48,6 @@ createTimer(options: TimerOptions, callback: AsyncCallback<number>): void Creates a timer. This API uses an asynchronous callback to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -63,23 +61,23 @@ Creates a timer. This API uses an asynchronous callback to return the result. ```js export default { - systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat: false - }; - try { - systemTimer.createTimer(options, (error) => { - if (error) { - console.info(`Failed to create timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in creating timer.`); - }); - } catch(e) { - console.info(`Failed to create timer. message:${e.message}, code:${e.code}`); + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + systemTimer.createTimer(options, (error, timerId) => { + if (error) { + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + return; } + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }); + } catch(e) { + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -89,8 +87,6 @@ createTimer(options: TimerOptions): Promise<number> Creates a timer. This API uses a promise to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -109,21 +105,21 @@ Creates a timer. This API uses a promise to return the result. ```js export default { - systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - }; - try { - systemTimer.createTimer(options).then(() => { - console.info(`Succeeded in creating timer.`); - }).catch((error) => { - console.info(`Failed to create timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to create timer. message:${e.message}, code:${e.code}`); - } + systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + }; + try { + systemTimer.createTimer(options).then((timerId) => { + console.info(`Succeeded in creating timer. timerId: ${timerId}`); + }).catch((error) => { + console.info(`Failed to create timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to create timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -133,8 +129,6 @@ startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void&g Starts a timer. This API uses an asynchronous callback to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -149,26 +143,26 @@ Starts a timer. This API uses an asynchronous callback to return the result. ```js export default { - async systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime, (error) => { + if (error) { + console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + return; } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - try { - systemTimer.startTimer(timerId, triggerTime, (error) => { - if (error) { - console.info(`Failed to start timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in starting timer.`); - }); - } catch(e) { - console.info(`Failed to start timer. message:${e.message}, code:${e.code}`); - } + console.info(`Succeeded in starting timer.`); + }); + } catch(e) { + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -178,8 +172,6 @@ startTimer(timer: number, triggerTime: number): Promise<void> Starts a timer. This API uses a promise to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -199,24 +191,24 @@ Starts a timer. This API uses a promise to return the result. ```js export default { - async systemTimer (){ - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - try { - systemTimer.startTimer(timerId, triggerTime).then(() => { - console.info(`Succeeded in starting timer.`); - }).catch((error) => { - console.info(`Failed to start timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to start timer. message:${e.message}, code:${e.code}`); - } + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + try { + systemTimer.startTimer(timerId, triggerTime).then(() => { + console.info(`Succeeded in starting timer.`); + }).catch((error) => { + console.info(`Failed to start timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to start timer. message: ${e.message}, code: ${e.code}`); + } + } } ``` @@ -226,8 +218,6 @@ stopTimer(timer: number, callback: AsyncCallback<void>): void Stops a timer. This API uses an asynchronous callback to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -241,27 +231,27 @@ Stops a timer. This API uses an asynchronous callback to return the result. ```js export default { - async systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - try { - systemTimer.stopTimer(timerId, (error) => { - if (error) { - console.info(`Failed to stop timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in stopping timer.`); - }); - } catch(e) { - console.info(`Failed to stop timer. message:${e.message}, code:${e.code}`); + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId, (error) => { + if (error) { + console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + return; } - } + console.info(`Succeeded in stopping timer.`); + }); + } catch(e) { + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } } ``` @@ -271,8 +261,6 @@ stopTimer(timer: number): Promise<void> Stops a timer. This API uses a promise to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -291,25 +279,25 @@ Stops a timer. This API uses a promise to return the result. ```js export default { - async systemTimer (){ - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - try { - systemTimer.stopTimer(timerId).then(() => { - console.info(`Succeeded in stopping timer.`); - }).catch((error) => { - console.info(`Failed to stop timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to stop timer. message:${e.message}, code:${e.code}`); - } + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + try { + systemTimer.stopTimer(timerId).then(() => { + console.info(`Succeeded in stopping timer.`); + }).catch((error) => { + console.info(`Failed to stop timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to stop timer. message: ${e.message}, code: ${e.code}`); + } + } } ``` @@ -319,8 +307,6 @@ destroyTimer(timer: number, callback: AsyncCallback<void>): void Destroys a timer. This API uses an asynchronous callback to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -334,28 +320,28 @@ Destroys a timer. This API uses an asynchronous callback to return the result. ```js export default { - async systemTimer () { - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - systemTimer.stopTimer(timerId) - try { - systemTimer.destroyTimer(timerId, (error) => { - if (error) { - console.info(`Failed to destroy timer. message:${error.message}, code:${error.code}`); - return; - } - console.info(`Succeeded in destroying timer.`); - }); - } catch(e) { - console.info(`Failed to destroying timer. message:${e.message}, code:${e.code}`); + async systemTimer () { + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId, (error) => { + if (error) { + console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + return; } + console.info(`Succeeded in destroying timer.`); + }); + } catch(e) { + console.info(`Failed to destroying timer. message: ${e.message}, code: ${e.code}`); } + } } ``` @@ -365,8 +351,6 @@ destroyTimer(timer: number): Promise<void> Destroys a timer. This API uses a promise to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.MiscServices.Time **Parameters** @@ -385,25 +369,25 @@ Destroys a timer. This API uses a promise to return the result. ```js export default { - async systemTimer (){ - let options = { - type: systemTimer.TIMER_TYPE_REALTIME, - repeat:false - } - let timerId = await systemTimer.createTimer(options) - let triggerTime = new Date().getTime() - triggerTime += 3000 - systemTimer.startTimer(timerId, triggerTime) - systemTimer.stopTimer(timerId) - try { - systemTimer.destroyTimer(timerId).then(() => { - console.info(`Succeeded in destroying timer.`); - }).catch((error) => { - console.info(`Failed to destroy timer. message:${error.message}, code:${error.code}`); - }); - } catch(e) { - console.info(`Failed to destroying timer. message:${e.message}, code:${e.code}`); - } + async systemTimer (){ + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = await systemTimer.createTimer(options); + let triggerTime = new Date().getTime(); + triggerTime += 3000; + systemTimer.startTimer(timerId, triggerTime); + systemTimer.stopTimer(timerId); + try { + systemTimer.destroyTimer(timerId).then(() => { + console.info(`Succeeded in destroying timer.`); + }).catch((error) => { + console.info(`Failed to destroy timer. message: ${error.message}, code: ${error.code}`); + }); + } catch(e) { + console.info(`Failed to destroying timer. message: ${e.message}, code: ${e.code}`); } + } } ``` diff --git a/en/application-dev/reference/apis/js-apis-taskpool.md b/en/application-dev/reference/apis/js-apis-taskpool.md new file mode 100644 index 0000000000000000000000000000000000000000..a441a39e8bb232fd589a0b03e473890ef6bbbc5f --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-taskpool.md @@ -0,0 +1,243 @@ +# @ohos.taskpool (Using the Task Pool) + +The task pool provides a multi-thread running environment for applications. It helps reduce resource consumption and improve system performance. It also frees you from caring about the lifecycle of thread instances. You can use the **TaskPool** APIs to create background tasks and perform operations on them, for example, executing or canceling a task. Theoretically, you can create an unlimited number of tasks, but this is not recommended for memory considerations. In addition, you are not advised performing blocking operations in a task, especially indefinite blocking. Long-time blocking operations occupy worker threads and may block other task scheduling, adversely affecting your application performance. + +You can determine the execution sequence of tasks with the same priority. They are executed in the same sequence as you call the task execution APIs. The default task priority is **MEDIUM**. (The task priority mechanism is not supported yet.) + +If the number of tasks to be executed is greater than the number of worker threads in the task pool, the task pool scales out based on load balancing to minimize the waiting duration. Similarly, when the number of tasks to be executed falls below the number of worker threads, the task pool scales in to reduce the number of worker threads. (The load balancing mechanism is not supported yet.) + +The **TaskPool** APIs return error codes in numeric format. For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md). + +> **NOTE**
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import taskpool from '@ohos.taskpool'; +``` + +## Priority + +Enumerates the priorities available for created tasks. (This enum is not supported yet.) + +**System capability**: SystemCapability.Utils.Lang + +| Name| Value| Description| +| -------- | -------- | -------- | +| HIGH | 0 | The task has a high priority.| +| MEDIUM | 1 | The task has a medium priority.| +| LOW | 2 | The task has a low priority.| + +## Task + +Implements a task. Before using any of the following APIs, you must create a **Task** instance. + +### constructor + +constructor(func: Function, ...args: unknown[]) + +A constructor used to create a **Task** instance. + +**System capability**: SystemCapability.Utils.Lang + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------- | ---- | -------------------------------------------------------------------- | +| func | Function | Yes | Function to be passed in for task execution. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). | +| args | unknown[] | No | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).| + +**Error codes** + +For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md). + +| ID| Error Message | +| -------- | --------------------------------------- | +| 10200014 | The function is not mark as concurrent. | + +**Example** + +```js +function func(args) { + "use concurrent" + console.log("func: " + args); + return args; +} +let task = new taskpool.Task(func, "this is my first Task"); +``` + +### Attributes + +**System capability**: SystemCapability.Utils.Lang + +| Name | Type | Readable| Writable| Description | +| --------- | --------- | ---- | ---- | ------------------------------------------------------------------------- | +| function | Function | Yes | Yes | Function to be passed in during task creation. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). | +| arguments | unknown[] | Yes | Yes | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).| + +## taskpool.execute + +execute(func: Function, ...args: unknown[]): Promise\ + +Executes a task in the task pool. You must pass in a function and arguments to execute the task, and the task executed in this mode cannot be canceled. + +**System capability**: SystemCapability.Utils.Lang + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | --------- | ---- | ---------------------------------------------------------------------- | +| func | Function | Yes | Function used to execute the task. For details about the supported return value types of the function, see [Sequenceable Data Types](#sequenceable-data-types). | +| args | unknown[] | No | Arguments of the function. For details about the supported parameter types, see [Sequenceable Data Types](#sequenceable-data-types).| + +**Return value** + +| Type | Description | +| ----------------- | ------------------------------------ | +| Promise\ | Promise used to return the result.| + +**Error codes** + +For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md). + +| ID| Error Message | +| -------- | ----------------------------------------- | +| 10200003 | Worker initialization failure. | +| 10200006 | Serializing an uncaught exception failed. | +| 10200014 | The function is not mark as concurrent. | + +**Example** + +```js +function func(args) { + "use concurrent" + console.log("func: " + args); + return args; +} + +let value = taskpool.execute(func, 100); +``` + +## taskpool.execute + +execute(task: Task, priority?: Priority): Promise\ + +Executes a task in the task pool. You must pass in a created task, and the task executed in this mode can be canceled. + +**System capability**: SystemCapability.Utils.Lang + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ------------------------------------ | +| task | [Task](#task) | Yes | Task to be executed. | +| priority | [Priority](#priority) | No | Priority of the task (not supported yet).| + +**Return value** + +| Type | Description | +| ---------------- | ------------------------------ | +| Promise\ | Promise used to return the result.| + +**Error codes** + +For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md). + +| ID| Error Message | +| -------- | ----------------------------------------- | +| 10200003 | Worker initialization failure. | +| 10200006 | Serializing an uncaught exception failed. | +| 10200014 | The function is not mark as concurrent. | + +**Example** + +```js +function func(args) { + "use concurrent" + console.log("func: " + args); + return args; +} +let task = new taskpool.Task(func, "this is my first Task"); +let value = taskpool.execute(task); +``` + +## taskpool.cancel + +cancel(task: Task): void + +Cancels a task in the task pool. + +**System capability**: SystemCapability.Utils.Lang + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------------- | ---- | -------------------- | +| task | [Task](#task) | Yes | Task to cancel.| + +**Error codes** + +For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md). + +| ID| Error Message | +| -------- | ------------------------- | +| 10200015 | If the task is not exist. | +| 10200016 | If the task is running. | + +**Example** + +```js +function func(args) { + "use concurrent" + console.log("func: " + args); + return args; +} +let task = new taskpool.Task(func, "this is first Task"); +let value = taskpool.execute(task); +taskpool.cancel(task); +``` + +## Additional Information + +### Sequenceable Data Types +The following sequenceable data types are supported: All Primitive Type (excluding symbol), Date, String, RegExp, Array, Map, Set, Object, ArrayBuffer, and TypedArray. + +### Precautions +A task in the task pool can reference only variables passed in by input parameters or imported variables. It does not support closure variables. + +```js +// 1. Reference a variable passed in by the input parameter. +function func(args) { + "use concurrent" + console.log("func: " + args); + return args; +} + +let task = new taskpool.Task(func, "create task, then execute"); +let val1 = taskpool.execute(task); + +let val2 = taskpool.execute(func, "execute task by func"); +``` + +```js +// 2. Reference an imported variable. + +// b.ts +export var c = 2000; + +// a.ts +import { c } from './b' + +function test(a) { + "use concurrent" + console.log(a); + console.log(c); + return a; +} + +let task = new taskpool.Task(test, "create task, then execute"); +let val1 = taskpool.execute(task); + +let val2 = taskpool.execute(test, "execute task by func"); +``` diff --git a/en/application-dev/reference/apis/js-apis-uri.md b/en/application-dev/reference/apis/js-apis-uri.md index 00bf51656958f8ca58b926cb54ad9fd1d82a8e53..b3fb6f7a3ea58550cfa93a514591715952c52ad6 100644 --- a/en/application-dev/reference/apis/js-apis-uri.md +++ b/en/application-dev/reference/apis/js-apis-uri.md @@ -35,7 +35,7 @@ Naming format: A standard URI consists of the following parts: [scheme:]scheme-specific-part[#fragment] -- Scheme: scheme component, which is mandatory. Example values: **http**, **https**, **ftp**, **datashare**, and **dataability**. +- scheme: scheme component. Set this parameter as required. Example values: **http**, **https**, **ftp**, **datashare**, and **dataability**. - scheme-specific-part: specific part of the URI decoding scheme. The value consists of [//][authority][path][?query]. Set this parameter as required. - authority: decoding authority component of the URI. The value consists of [userinfo@]host[:port]. Set this parameter as required. - userinfo: user information. Set this parameter as required. @@ -226,7 +226,9 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi ```js const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080?query=pppppp'); -uriInstance.checkIsAbsolute(); +console.log(uriInstance.checkIsAbsolute()); // true +const uriInstance1 = new uri.URI('xxx.com/suppliers.htm'); +console.log(uriInstance1.checkIsAbsolute()); // false ``` @@ -248,6 +250,7 @@ Normalizes the path of this URI. ```js const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); +console.log(uriInstance.path); // /path/path1/../path2/./path3 let uriInstance1 = uriInstance.normalize(); -uriInstance1.path; +console.log(uriInstance1.path); // /path/path2/path3 ``` diff --git a/en/application-dev/reference/apis/js-apis-url.md b/en/application-dev/reference/apis/js-apis-url.md index 8a972e121d32b041e1ff7f8319c4e26261afb2f5..d4d453a59685a23f228ca2d4bc7e56ac0608a8e8 100755 --- a/en/application-dev/reference/apis/js-apis-url.md +++ b/en/application-dev/reference/apis/js-apis-url.md @@ -87,7 +87,7 @@ paramsObject.delete('fod'); getAll(name: string): string[] -Obtains all the key-value pairs based on the specified name. +Obtains all the values based on the specified key. **System capability**: SystemCapability.Utils.Lang @@ -95,13 +95,13 @@ Obtains all the key-value pairs based on the specified name. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Key specified to obtain all key-value pairs.| +| name | string | Yes| Target key.| **Return value** | Type| Description| | -------- | -------- | -| string[] | Key-value pairs obtained.| +| string[] | All the values obtained.| **Example** @@ -432,7 +432,7 @@ A no-argument constructor used to create a URL. It returns a **URL** object afte **System capability**: SystemCapability.Utils.Lang ### parseURL9+ - + static parseURL(url : string, base?: string | URL): URL Parses a URL. @@ -514,7 +514,7 @@ A constructor used to create a **URLSearchParams** instance. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+](#constructor9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.constructor9+](#constructor9) instead. **System capability**: SystemCapability.Utils.Lang @@ -542,7 +542,7 @@ Appends a key-value pair into the query string. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.append9+](#append9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.append9+](#append9) instead. **System capability**: SystemCapability.Utils.Lang @@ -569,7 +569,7 @@ Deletes key-value pairs of the specified key. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.delete9+](#delete9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.delete9+](#delete9) instead. **System capability**: SystemCapability.Utils.Lang @@ -595,7 +595,7 @@ Obtains all the key-value pairs based on the specified key. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.getAll9+](#getall9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.getAll9+](#getall9) instead. **System capability**: SystemCapability.Utils.Lang @@ -603,7 +603,7 @@ Obtains all the key-value pairs based on the specified key. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Key specified to obtain all key-value pairs.| +| name | string | Yes| Target key.| **Return value** @@ -628,7 +628,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.entries9+](#entries9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.entries9+](#entries9) instead. **System capability**: SystemCapability.Utils.Lang @@ -656,7 +656,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.forEach9+](#foreach9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.forEach9+](#foreach9) instead. **System capability**: SystemCapability.Utils.Lang @@ -693,7 +693,7 @@ Obtains the value of the first key-value pair based on the specified key. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.get9+](#get9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.get9+](#get9) instead. **System capability**: SystemCapability.Utils.Lang @@ -727,7 +727,7 @@ Checks whether a key has a value. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.has9+](#has9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.has9+](#has9) instead. **System capability**: SystemCapability.Utils.Lang @@ -760,7 +760,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.set9+](#set9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.set9+](#set9) instead. **System capability**: SystemCapability.Utils.Lang @@ -788,7 +788,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.sort9+](#sort9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.sort9+](#sort9) instead. **System capability**: SystemCapability.Utils.Lang @@ -809,7 +809,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.keys9+](#keys9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.keys9+](#keys9) instead. **System capability**: SystemCapability.Utils.Lang @@ -837,7 +837,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams9+.values9+](#values9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.values9+](#values9) instead. **System capability**: SystemCapability.Utils.Lang @@ -865,7 +865,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [Symbol.iterator]9+](#symboliterator9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.[Symbol.iterator]9+](#symboliterator9) instead. **System capability**: SystemCapability.Utils.Lang @@ -892,7 +892,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tostring9+](#tostring9) instead. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [URLParams.tostring9+](#tostring9) instead. **System capability**: SystemCapability.Utils.Lang diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index 215816e358a3c70d147a149db7c9142a15535ec1..6657eb3e558732fa50af4c7bb82f7b26e3457433 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -1,4 +1,4 @@ -# @ohos.wantAgent +# @ohos.wantAgent (wantAgent) The **WantAgent** module provides APIs for creating and comparing **WantAgent** objects, and obtaining the user ID and bundle name of a **WantAgent** object. diff --git a/en/application-dev/reference/apis/js-apis-webview.md b/en/application-dev/reference/apis/js-apis-webview.md index 83d89392cd8ade90901018fbe5721ce53ba54f2e..8c3ca939bdb5758f987780d94c7bb88837613b4d 100644 --- a/en/application-dev/reference/apis/js-apis-webview.md +++ b/en/application-dev/reference/apis/js-apis-webview.md @@ -1,6 +1,6 @@ -# @ohos.web.webview +# @ohos.web.webview (Webview) The **Webview** module provides APIs for web control. @@ -228,19 +228,19 @@ Loads the dynamic link library (DLL) file of the web engine. This API can be cal **Example** -The following code snippet exemplifies calling this API after the EntryAbility is created. +The following code snippet exemplifies calling this API after the MainAbility is created. ```ts // xxx.ts -import UIAbility from '@ohos.app.ability.UIAbility'; -import web_webview from '@ohos.web.webview'; +import Ability from '@ohos.application.Ability' +import web_webview from '@ohos.web.webview' -export default class EntryAbility extends UIAbility { +export default class MainAbility extends Ability { onCreate(want, launchParam) { - console.log("EntryAbility onCreate") + console.log("MainAbility onCreate") web_webview.WebviewController.initializeWebEngine() globalThis.abilityWant = want - console.log("EntryAbility onCreate done") + console.log("MainAbility onCreate done") } } ``` @@ -249,7 +249,7 @@ export default class EntryAbility extends UIAbility { ```ts // xxx.ets -import web_webview from '@ohos.web.webview'; +import web_webview from '@ohos.web.webview' @Entry @Component @@ -1471,10 +1471,8 @@ struct WebComponent { try { // 1. Create two message ports. this.ports = this.controller.createWebMessagePorts(); - // 2. Send one of the message ports to the HTML side, which can then save and use the port. - this.controller.postMessage('__init_port__', [this.ports[0]], '*'); - // 3. Register a callback for the other message port on the application side. - this.ports[1].onMessageEvent((result: WebMessage) => { + // 2. Register a callback on a message port (for example, port 1) on the application side. + this.ports[1].onMessageEvent((result: web_webview.WebMessage) => { var msg = 'Got msg from HTML:'; if (typeof(result) == "string") { console.log("received string message from html5, string is:" + result); @@ -1491,12 +1489,14 @@ struct WebComponent { } this.receivedFromHtml = msg; }) + // 3. Send another message port (for example, port 0) to the HTML side, which can then save the port for future use. + this.controller.postMessage('__init_port__', [this.ports[0]], '*'); } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) - // 4. Use the port on the application side to send messages to the message port that has been sent to the HTML. + // 4. Use the port on the application side to send messages to the port that has been sent to the HTML side. Button('SendDataToHTML') .onClick(() => { try { @@ -1506,7 +1506,7 @@ struct WebComponent { console.error(`ports is null, Please initialize first`); } } catch (error) { - console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) Web({ src: $rawfile('xxx.html'), controller: this.controller }) @@ -1528,7 +1528,7 @@ struct WebComponent {

WebView Message Port Demo


-
+

display received message send from ets

@@ -2750,6 +2750,104 @@ struct WebComponent { } ``` +### pageUp + +pageUp(top:boolean): void + +Scrolls the page up by half the view port or jumps to the top of the page. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| top | boolean | Yes | Whether to jump to the top of the page. The value **true** means to jump to the top of the page; and **false** means to scroll the page up by half the view port.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('pageUp') + .onClick(() => { + try { + this.controller.pageUp(false); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### pageDown + +pageDown(bottom:boolean): void + +Scrolls the page down by half the view port or jumps to the bottom of the page. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| bottom | boolean | Yes | Whether to jump to the bottom of the page. The value **true** means to jump to the bottom of the page; and **false** means to scroll the page down by half the view port.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('pageDown') + .onClick(() => { + try { + this.controller.pageDown(false); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + ### getBackForwardEntries getBackForwardEntries(): BackForwardList @@ -2799,6 +2897,122 @@ struct WebComponent { } ``` +### serializeWebState + +serializeWebState(): Uint8Array + +Serializes the page status history of the current Webview. + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| ---------- | --------------------------------------------- | +| Uint8Array | Serialized data of the page status history of the current WebView.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; +import fileio from '@ohos.fileio'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('serializeWebState') + .onClick(() => { + try { + let state = this.controller.serializeWebState(); + let path = globalThis.AbilityContext.cacheDir; + path += '/WebState'; + let fd = fileio.openSync(path, 0o2 | 0o100, 0o666); + fileio.writeSync(fd, state.buffer); + fileio.closeSync(fd); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### restoreWebState + +restoreWebState(state: Uint8Array): void + +Restores the page status history from the serialized data of the current WebView. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ---------- | ---- | ---------------------------- | +| state | Uint8Array | Yes | Serialized data of the page status history.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; +import fileio from '@ohos.fileio'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('RestoreWebState') + .onClick(() => { + try { + let path = globalThis.AbilityContext.cacheDir; + path += '/WebState'; + let fd = fileio.openSync(path, 0o002, 0o666); + let stat = fileio.fstatSync(fd); + let size = stat.size; + let buf = new ArrayBuffer(size); + fileio.read(fd, buf, (err, data) => { + if (data) { + this.controller.restoreWebState(new Uint8Array(data.buffer)); + } + fileio.closeSync(fd); + }); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + ### customizeSchemes static customizeSchemes(schemes: Array\): void @@ -4001,7 +4215,7 @@ Stores this web page. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ----------------------------------- | | baseName | string | Yes| Save path. The value cannot be null. | -| autoName | boolean | Yes| Whether to automatically generate a file name.
The value **false** means not to automatically generate a file name.
The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. | +| autoName | boolean | Yes| Whether to automatically generate a file name.
The value **false** means not to automatically generate a file name.
The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. | | callback | AsyncCallback\ | Yes | Callback used to return the save path if the operation is successful and null otherwise.| **Example** @@ -4082,6 +4296,10 @@ Stores this web page. This API uses a promise to return the result. Implements a **GeolocationPermissions** object. +### Required Permissions + +**ohos.permission.LOCATION**, **ohos.permission.APPROXIMATELY_LOCATION**, and **ohos.permission.LOCATION_IN_BACKGROUND**, which are required for accessing the location information. For details about the permissions, see [@ohos.geolocation (Geolocation)](./js-apis-geolocation.md). + ### allowGeolocation static allowGeolocation(origin: string): void @@ -4469,6 +4687,8 @@ Provides the element information of the area being clicked. For details about th Describes the data types supported for [WebMessagePort](#webmessageport). +**System capability**: SystemCapability.Web.Webview.Core + | Type | Description | | -------- | -------------------------------------- | | string | String type.| @@ -4492,10 +4712,10 @@ Provides the historical information list of the current webview. **System capability**: SystemCapability.Web.Webview.Core -| Name | Type | Readable| Writable| Description | -| ------------ | ------ | ---- | ---- | ---------------------------- | -| currentIndex | number | Yes | No | Index of the current page in the page history stack.| -| size | number | Yes | No | Number of indexes in the history stack. | +| Name | Type | Readable| Writable| Description | +| ------------ | ------ | ---- | ---- | ------------------------------------------------------------ | +| currentIndex | number | Yes | No | Index of the current page in the page history stack. | +| size | number | Yes | No | Number of indexes in the history stack. The maximum value is 50. If this value is exceeded, the earliest index will be overwritten.| ### getItemAtIndex @@ -4537,8 +4757,8 @@ struct WebComponent { try { let list = this.controller.getBackForwardEntries(); let historyItem = list.getItemAtIndex(list.currentIndex); - console.log("HistoryItem: " + JSON.stringify(historyItem)); - this.icon = historyItem.icon; + console.log("HistoryItem: " + JSON.stringify(historyItem)); + this.icon = historyItem.icon; } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index bc1ad05712b63c8b2d990af46c8bf70242134e77..4c5e4fdc59b30f0b411d6fe63c50ccd84d84778b 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -1,4 +1,4 @@ -# @ohos.window +# @ohos.window (Window) The **Window** module provides basic window management capabilities, such as creating and destroying the current window, setting properties for the current window, and managing and scheduling windows. @@ -54,7 +54,7 @@ Defines the parameters for creating a subwindow or system window. | ---------- | -------------------------- | -- | ----------------------------------- | | name | string | Yes| Name of the window. | | windowType | [WindowType](#windowtype7) | Yes| Type of the window. | -| ctx | BaseContext | No| Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md). If this parameter is not set, no context is used.
A system window is created when **Context** is [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md).| +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | No| Current application context. If this parameter is not set, no context is used.
You do not need to set this parameter to create a subwindow in the FA model or a system window in the stage model. | | displayId | number | No| ID of the current physical screen. If this parameter is not set, the default value **-1** is used.| | parentId | number | No| ID of the parent window. If this parameter is not set, the default value **-1** is used. | @@ -430,7 +430,7 @@ Obtains the top window of the current application. This API uses an asynchronous | Name| Type| Mandatory| Description| | -------- | -------------------------------------- | -- | ---------------------------------------- | -| ctx | BaseContext | Yes| Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [Context](js-apis-ability-context.md).| +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Current application context.| | callback | AsyncCallback<[Window](#window)> | Yes| Callback used to return the top window obtained.| **Error codes** @@ -472,7 +472,7 @@ Obtains the top window of the current application. This API uses a promise to re | Name| Type| Mandatory| Description| | ------ | ----------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | Yes | Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [Context](js-apis-ability-context.md).| +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | Yes | Current application context.| **Return value** @@ -897,7 +897,7 @@ promise.then((data)=> { create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback<Window>): void -Creates a subwindow (in API version 8) or a system window (from API version 9). This API uses an asynchronous callback to return the result. +Creates a system window. This API uses an asynchronous callback to return the result. > **NOTE** > @@ -907,12 +907,12 @@ Creates a subwindow (in API version 8) or a system window (from API version 9). **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | Yes | Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md).| -| id | string | Yes | Window ID. | -| type | [WindowType](#windowtype7) | Yes | Window type. | -| callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the subwindow created. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------- | ---- | ------------------------------------ | +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | Yes | Current application context. | +| id | string | Yes | Window ID. | +| type | [WindowType](#windowtype7) | Yes | Window type. | +| callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the subwindow created.| **Example** @@ -933,7 +933,7 @@ window.create(this.context, 'alertWindow', window.WindowType.TYPE_SYSTEM_ALERT, create(ctx: BaseContext, id: string, type: WindowType): Promise<Window> -Creates a subwindow (in API version 8) or a system window (from API version 9). This API uses a promise to return the result. +Creates a system window. This API uses a promise to return the result. > **NOTE** > @@ -945,7 +945,7 @@ Creates a subwindow (in API version 8) or a system window (from API version 9). | Name| Type | Mandatory| Description | | ------ | ------------------------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | Yes | Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md).| +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | Yes | Current application context.| | id | string | Yes | Window ID. | | type | [WindowType](#windowtype7) | Yes | Window type. | @@ -1121,7 +1121,7 @@ Obtains the top window of the current application. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | Yes | Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [Context](js-apis-ability-context.md).| +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | Yes | Current application context.| | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the top window obtained. | **Example** @@ -1154,7 +1154,7 @@ Obtains the top window of the current application. This API uses a promise to re | Name| Type | Mandatory| Description | | ------ | ----------- | ---- | ------------------------------------------------------------ | -| ctx | BaseContext | Yes | Current application context.
For details about the context in the FA model, see [Context](js-apis-inner-app-context.md).
For details about the context in the stage model, see [Context](js-apis-ability-context.md).| +| ctx | [BaseContext](js-apis-inner-application-baseContext.md) | Yes | Current application context.| **Return value** @@ -1864,7 +1864,7 @@ Obtains the area where this window cannot be displayed, for example, the system | Name| Type| Mandatory| Description| | ---- |----------------------------------| -- | ------------------------------------------------------------ | -| type | [AvoidAreaType](#avoidareatype7) | Yes| Type of the area. | +| type | [AvoidAreaType](#avoidareatype7) | Yes| Type of the area.| **Return value** @@ -4084,7 +4084,6 @@ try { } catch (exception) { console.error('Failed to set backdrop blur. Cause: ' + JSON.stringify(exception)); } - ``` ### setBackdropBlurStyle9+ @@ -4120,7 +4119,6 @@ try { } catch (exception) { console.error('Failed to set backdrop blur style. Cause: ' + JSON.stringify(exception)); } - ``` ### setShadow9+ @@ -4159,7 +4157,6 @@ try { } catch (exception) { console.error('Failed to set shadow. Cause: ' + JSON.stringify(exception)); } - ``` ### setCornerRadius9+ @@ -4195,7 +4192,6 @@ try { } catch (exception) { console.error('Failed to set corner radius. Cause: ' + JSON.stringify(exception)); } - ``` ### show(deprecated) @@ -4226,7 +4222,6 @@ windowClass.show((err) => { } console.info('Succeeded in showing the window.'); }); - ``` ### show(deprecated) @@ -4256,7 +4251,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to show the window. Cause: ' + JSON.stringify(err)); }); - ``` ### destroy(deprecated) @@ -4287,7 +4281,6 @@ windowClass.destroy((err) => { } console.info('Succeeded in destroying the window.'); }); - ``` ### destroy(deprecated) @@ -4317,7 +4310,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err)); }); - ``` ### moveTo(deprecated) @@ -4352,7 +4344,6 @@ windowClass.moveTo(300, 300, (err)=>{ } console.info('Succeeded in moving the window.'); }); - ``` ### moveTo(deprecated) @@ -4391,7 +4382,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to move the window. Cause: ' + JSON.stringify(err)); }); - ``` ### resetSize(deprecated) @@ -4432,7 +4422,6 @@ windowClass.resetSize(500, 1000, (err) => { } console.info('Succeeded in changing the window size.'); }); - ``` ### resetSize(deprecated) @@ -4477,7 +4466,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to change the window size. Cause: ' + JSON.stringify(err)); }); - ``` ### setWindowType(deprecated) @@ -4512,7 +4500,6 @@ windowClass.setWindowType(type, (err) => { } console.info('Succeeded in setting the window type.'); }); - ``` ### setWindowType(deprecated) @@ -4551,7 +4538,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the window type. Cause: ' + JSON.stringify(err)); }); - ``` ### getProperties(deprecated) @@ -4582,7 +4568,6 @@ windowClass.getProperties((err, data) => { } console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data)); }); - ``` ### getProperties(deprecated) @@ -4612,7 +4597,6 @@ promise.then((data)=> { }).catch((err)=>{ console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err)); }); - ``` ### getAvoidArea(deprecated) @@ -4629,10 +4613,10 @@ Obtains the area where this window cannot be displayed, for example, the system **Parameters** -| Name | Type | Mandatory | Description | -| -------- | --------------------------------------------- | --------- | ------------------------------------------------------------ | -| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. | -| callback | AsyncCallback<[AvoidArea](#avoidarea7)> | Yes | Callback used to return the area. | +| Name | Type | Mandatory | Description | +| -------- | --------------------------------------------- | --------- | --------------------------------- | +| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. | +| callback | AsyncCallback<[AvoidArea](#avoidarea7)> | Yes | Callback used to return the area. | **Example** @@ -4645,7 +4629,6 @@ windowClass.getAvoidArea(type, (err, data) => { } console.info('Succeeded in obtaining the area. Data:' + JSON.stringify(data)); }); - ``` ### getAvoidArea(deprecated) @@ -4662,9 +4645,9 @@ Obtains the area where this window cannot be displayed, for example, the system **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------------- | --------- | ------------------------------------------------------------ | -| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. | +| Name | Type | Mandatory | Description | +| ---- | -------------------------------- | --------- | ----------------- | +| type | [AvoidAreaType](#avoidareatype7) | Yes | Type of the area. | **Return value** @@ -4682,7 +4665,6 @@ promise.then((data)=> { }).catch((err)=>{ console.error('Failed to obtain the area. Cause:' + JSON.stringify(err)); }); - ``` ### setFullScreen(deprecated) @@ -4715,7 +4697,6 @@ windowClass.setFullScreen(isFullScreen, (err) => { } console.info('Succeeded in enabling the full-screen mode.'); }); - ``` ### setFullScreen(deprecated) @@ -4752,7 +4733,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to enable the full-screen mode. Cause: ' + JSON.stringify(err)); }); - ``` ### setLayoutFullScreen(deprecated) @@ -4785,7 +4765,6 @@ windowClass.setLayoutFullScreen(isLayoutFullScreen, (err) => { } console.info('Succeeded in setting the window layout to full-screen mode.'); }); - ``` ### setLayoutFullScreen(deprecated) @@ -4822,7 +4801,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); }); - ``` ### setSystemBarEnable(deprecated) @@ -4856,7 +4834,6 @@ windowClass.setSystemBarEnable(names, (err) => { } console.info('Succeeded in setting the system bar to be invisible.'); }); - ``` ### setSystemBarEnable(deprecated) @@ -4894,7 +4871,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err)); }); - ``` ### setSystemBarProperties(deprecated) @@ -4933,7 +4909,6 @@ windowClass.setSystemBarProperties(SystemBarProperties, (err) => { } console.info('Succeeded in setting the system bar properties.'); }); - ``` ### setSystemBarProperties(deprecated) @@ -4976,7 +4951,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err)); }); - ``` ### loadContent(deprecated) @@ -5008,7 +4982,6 @@ windowClass.loadContent('pages/page2/page2', (err) => { } console.info('Succeeded in loading the content.'); }); - ``` ### loadContent(deprecated) @@ -5044,7 +5017,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to load the content. Cause: ' + JSON.stringify(err)); }); - ``` ### isShowing(deprecated) @@ -5075,7 +5047,6 @@ windowClass.isShowing((err, data) => { } console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data)); }); - ``` ### isShowing(deprecated) @@ -5105,7 +5076,6 @@ promise.then((data)=> { }).catch((err)=>{ console.error('Failed to check whether the window is showing. Cause: ' + JSON.stringify(err)); }); - ``` ### on('systemAvoidAreaChange')(deprecated) @@ -5133,7 +5103,6 @@ Enables listening for changes to the area where the window cannot be displayed. windowClass.on('systemAvoidAreaChange', (data) => { console.info('Succeeded in enabling the listener for system avoid area changes. Data: ' + JSON.stringify(data)); }); - ``` ### off('systemAvoidAreaChange')(deprecated) @@ -5159,7 +5128,6 @@ Disables listening for changes to the area where the window cannot be displayed. ```js windowClass.off('systemAvoidAreaChange'); - ``` ### isSupportWideGamut(deprecated) @@ -5190,7 +5158,6 @@ windowClass.isSupportWideGamut((err, data) => { } console.info('Succeeded in checking whether the window support WideGamut Data: ' + JSON.stringify(data)); }); - ``` ### isSupportWideGamut(deprecated) @@ -5220,7 +5187,6 @@ promise.then((data)=> { }).catch((err)=>{ console.error('Failed to check whether the window support WideGamut. Cause: ' + JSON.stringify(err)); }); - ``` ### setColorSpace(deprecated) @@ -5237,10 +5203,10 @@ Sets a color space for this window. This API uses an asynchronous callback to re **Parameters** -| Name | Type | Mandatory | Description | -| ---------- | ------------------------- | --------- | ----------------------------------- | +| Name | Type | Mandatory | Description | +| ---------- | -------------------------- | --------- | ----------------------------------- | | colorSpace | [ColorSpace](#colorspace8) | Yes | Color space to set. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -5252,7 +5218,6 @@ windowClass.setColorSpace(window.ColorSpace.WIDE_GAMUT, (err) => { } console.info('Succeeded in setting window colorspace.'); }); - ``` ### setColorSpace(deprecated) @@ -5269,8 +5234,8 @@ Sets a color space for this window. This API uses a promise to return the result **Parameters** -| Name | Type | Mandatory | Description | -| ---------- | ------------------------- | --------- | ------------------- | +| Name | Type | Mandatory | Description | +| ---------- | -------------------------- | --------- | ------------------- | | colorSpace | [ColorSpace](#colorspace8) | Yes | Color space to set. | **Return value** @@ -5288,7 +5253,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set window colorspace. Cause: ' + JSON.stringify(err)); }); - ``` ### getColorSpace(deprecated) @@ -5305,8 +5269,8 @@ Obtains the color space of this window. This API uses an asynchronous callback t **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ | +| Name | Type | Mandatory | Description | +| -------- | ----------------------------------------------- | --------- | ------------------------------------------------------------ | | callback | AsyncCallback<[ColorSpace](#colorspace8)> | Yes | Callback used to return the result. When the color space is obtained successfully, **err** is **undefined**, and **data** is the current color space. | **Example** @@ -5319,7 +5283,6 @@ windowClass.getColorSpace((err, data) => { } console.info('Succeeded in getting window colorspace. Cause:' + JSON.stringify(data)); }); - ``` ### getColorSpace(deprecated) @@ -5336,8 +5299,8 @@ Obtains the color space of this window. This API uses a promise to return the re **Return value** -| Type | Description | -| ---------------------------------------- | ----------------------------------------------- | +| Type | Description | +| ----------------------------------------- | ----------------------------------------------- | | Promise<[ColorSpace](#colorspace8)> | Promise used to return the current color space. | **Example** @@ -5349,7 +5312,6 @@ promise.then((data)=> { }).catch((err)=>{ console.error('Failed to get window colorspace. Cause: ' + JSON.stringify(err)); }); - ``` ### setBackgroundColor(deprecated) @@ -5382,7 +5344,6 @@ windowClass.setBackgroundColor(color, (err) => { } console.info('Succeeded in setting the background color.'); }); - ``` ### setBackgroundColor(deprecated) @@ -5419,7 +5380,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the background color. Cause: ' + JSON.stringify(err)); }); - ``` ### setBrightness(deprecated) @@ -5452,7 +5412,6 @@ windowClass.setBrightness(brightness, (err) => { } console.info('Succeeded in setting the brightness.'); }); - ``` ### setBrightness(deprecated) @@ -5489,7 +5448,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the brightness. Cause: ' + JSON.stringify(err)); }); - ``` ### setDimBehind(deprecated) @@ -5521,7 +5479,6 @@ windowClass.setDimBehind(0.5, (err) => { } console.info('Succeeded in setting the dimness.'); }); - ``` ### setDimBehind(deprecated) @@ -5557,7 +5514,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the dimness. Cause: ' + JSON.stringify(err)); }); - ``` ### setFocusable(deprecated) @@ -5590,7 +5546,6 @@ windowClass.setFocusable(isFocusable, (err) => { } console.info('Succeeded in setting the window to be focusable.'); }); - ``` ### setFocusable(deprecated) @@ -5627,7 +5582,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the window to be focusable. Cause: ' + JSON.stringify(err)); }); - ``` ### setKeepScreenOn(deprecated) @@ -5660,7 +5614,6 @@ windowClass.setKeepScreenOn(isKeepScreenOn, (err) => { } console.info('Succeeded in setting the screen to be always on.'); }); - ``` ### setKeepScreenOn(deprecated) @@ -5697,7 +5650,6 @@ promise.then(() => { }).catch((err)=>{ console.info('Failed to set the screen to be always on. Cause: ' + JSON.stringify(err)); }); - ``` ### setOutsideTouchable(deprecated) @@ -5729,7 +5681,6 @@ windowClass.setOutsideTouchable(true, (err) => { } console.info('Succeeded in setting the area to be touchable.'); }); - ``` ### setOutsideTouchable(deprecated) @@ -5765,7 +5716,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the area to be touchable. Cause: ' + JSON.stringify(err)); }); - ``` ### setPrivacyMode(deprecated) @@ -5798,7 +5748,6 @@ windowClass.setPrivacyMode(isPrivacyMode, (err) => { } console.info('Succeeded in setting the window to privacy mode.'); }); - ``` ### setPrivacyMode(deprecated) @@ -5835,7 +5784,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the window to privacy mode. Cause: ' + JSON.stringify(err)); }); - ``` ### setTouchable(deprecated) @@ -5868,7 +5816,6 @@ windowClass.setTouchable(isTouchable, (err) => { } console.info('Succeeded in setting the window to be touchable.'); }); - ``` ### setTouchable(deprecated) @@ -5905,7 +5852,6 @@ promise.then(()=> { }).catch((err)=>{ console.error('Failed to set the window to be touchable. Cause: ' + JSON.stringify(err)); }); - ``` ## WindowStageEventType9+ @@ -5957,11 +5903,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -5975,7 +5919,6 @@ export default class EntryAbility extends UIAbility { }); } }; - ``` ### getMainWindow9+ @@ -6006,11 +5949,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6023,7 +5964,6 @@ export default class EntryAbility extends UIAbility { }); } }; - ``` ### getMainWindowSync9+ @@ -6054,11 +5994,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6068,7 +6006,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### createSubWindow9+ @@ -6100,11 +6037,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6123,9 +6058,7 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` - ### createSubWindow9+ createSubWindow(name: string): Promise<Window> @@ -6160,11 +6093,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6181,7 +6112,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### getSubWindow9+ @@ -6211,11 +6141,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6229,9 +6157,7 @@ export default class EntryAbility extends UIAbility { }); } }; - ``` - ### getSubWindow9+ getSubWindow(): Promise<Array<Window>> @@ -6259,11 +6185,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); let windowClass = null; @@ -6276,9 +6200,7 @@ export default class EntryAbility extends UIAbility { }) } }; - ``` - ### loadContent9+ loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void>): void @@ -6309,11 +6231,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { storage : LocalStorage onWindowStageCreate(windowStage) { this.storage = new LocalStorage(); @@ -6332,7 +6252,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### loadContent9+ @@ -6370,11 +6289,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { storage : LocalStorage onWindowStageCreate(windowStage) { this.storage = new LocalStorage(); @@ -6392,7 +6309,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### loadContent9+ @@ -6424,11 +6340,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6444,7 +6358,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### on('windowStageEvent')9+ @@ -6476,11 +6389,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6494,7 +6405,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### off('windowStageEvent')9+ @@ -6526,11 +6436,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6541,7 +6449,6 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` ### disableWindowDecor()9+ @@ -6568,17 +6475,14 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('disableWindowDecor'); windowStage.disableWindowDecor(); } }; - ``` ### setShowOnLockScreen()9+ @@ -6611,11 +6515,9 @@ For details about the error codes, see [Window Error Codes](../errorcodes/errorc **Example** ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - // ... +import Ability from '@ohos.application.Ability'; +class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); try { @@ -6625,9 +6527,7 @@ export default class EntryAbility extends UIAbility { }; } }; - ``` - ## TransitionContext9+ Provides the context for the transition animation. @@ -6688,7 +6588,6 @@ controller.animationForShown = (context : window.TransitionContext) => { } console.info('complete transition end'); }; - ``` ## TransitionController9+ @@ -6739,7 +6638,6 @@ controller.animationForShown = (context : window.TransitionContext) => { ); console.info('complete transition end'); }; - ``` ### animationForHidden9+ diff --git a/en/application-dev/reference/apis/js-apis-worker.md b/en/application-dev/reference/apis/js-apis-worker.md index db8a73c0ff0b29ca6c753073f8ea0d297b19ccb8..5b7468da9721fa93ba1e42313a83101adf631df1 100644 --- a/en/application-dev/reference/apis/js-apis-worker.md +++ b/en/application-dev/reference/apis/js-apis-worker.md @@ -107,7 +107,7 @@ In the FA model: "buildOption": { "sourceOption": { "workers": [ - "./src/main/ets/entryability/workers/worker.ts" + "./src/main/ets/MainAbility/workers/worker.ts" ] } } @@ -1192,7 +1192,7 @@ In the FA model: "buildOption": { "sourceOption": { "workers": [ - "./src/main/ets/entryability/workers/worker.ts" + "./src/main/ets/MainAbility/workers/worker.ts" ] } } @@ -2114,7 +2114,7 @@ Configuration of the **build-profile.json5** file: "buildOption": { "sourceOption": { "workers": [ - "./src/main/ets/entryability/workers/worker.ts" + "./src/main/ets/MainAbility/workers/worker.ts" ] } } diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md index 8ee9c34e359dad14776f7fca6e55ec18d8381cc2..a661b6abc36a1820fbcd634178d5cf2654911336 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md @@ -24,7 +24,7 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) | ----------------- | -------- | ----- | -------- | | values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. If the value is less than 0, the value 0 is used.| | max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.
- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.
Default value: **100**| -| type8+ | [DataPanelType](#datapaneltype) | No| Type of the data panel.
Default value: **DataPanelType.Circle**| +| type8+ | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).
Default value: **DataPanelType.Circle**| ## DataPanelType diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md b/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md index f87d471b580ea09127f939d391af7a1acdaf6201..0a040213c13402688e171d048e12d67b5bb17633 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md @@ -21,7 +21,7 @@ ScrollBar(value: { scroller: Scroller, direction?: ScrollBarDirection, state?: B | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | scroller | [Scroller](ts-container-scroll.md#scroller) | Yes| Scroller, which can be bound to scrollable components.| -| direction | ScrollBarDirection | No| Scrollbar direction in which scrollable components scroll.
Default value: **ScrollBarDirection.Vertical**| +| direction | [ScrollBarDirection](#scrollbardirection) | No| Scrollbar direction in which scrollable components scroll.
Default value: **ScrollBarDirection.Vertical**| | state | [BarState](ts-appendix-enums.md#barstate) | No| Scrollbar state.
Default value: **BarState.Auto**| > **NOTE** diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-web.md b/en/application-dev/reference/arkui-ts/ts-basic-components-web.md index e2afb3e5eaa55dfb4d4509db3c87ba55821cd748..52414cedbeda0334a2df1e126931fc4d2f4d20a2 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -1219,7 +1219,7 @@ The universal events are not supported. onAlert(callback: (event?: { url: string; message: string; result: JsResult }) => boolean) -Triggered when **alert()** is invoked to display an alert dialog box on the web page. +Called when **alert()** is invoked to display an alert dialog box on the web page. **Parameters** @@ -1233,7 +1233,7 @@ Triggered when **alert()** is invoked to display an alert dialog box on the web | Type | Description | | ------- | ---------------------------------------- | -| boolean | If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\** component of the user's operation.| +| boolean | If the callback returns **true**, the application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to instruct the **\** component to exit the current page based on the user operation. If the callback returns **false**, the **\** component cannot trigger the system dialog box.| **Example** @@ -1277,7 +1277,7 @@ Triggered when **alert()** is invoked to display an alert dialog box on the web onBeforeUnload(callback: (event?: { url: string; message: string; result: JsResult }) => boolean) -Triggered when this page is about to exit after the user refreshes or closes the page. This callback is triggered only when the page has obtained focus. +Called when this page is about to exit after the user refreshes or closes the page. This API takes effect only when the page has obtained focus. **Parameters** @@ -1291,7 +1291,7 @@ Triggered when this page is about to exit after the user refreshes or closes the | Type | Description | | ------- | ---------------------------------------- | -| boolean | If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\** component of the user's operation.| +| boolean | If the callback returns **true**, the application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to instruct the **\** component to exit the current page based on the user operation. If the callback returns **false**, the **\** component cannot trigger the system dialog box.| **Example** @@ -1338,7 +1338,7 @@ Triggered when this page is about to exit after the user refreshes or closes the onConfirm(callback: (event?: { url: string; message: string; result: JsResult }) => boolean) -Triggered when **confirm()** is invoked by the web page. +Called when **confirm()** is invoked by the web page. **Parameters** @@ -1352,7 +1352,7 @@ Triggered when **confirm()** is invoked by the web page. | Type | Description | | ------- | ---------------------------------------- | -| boolean | If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\** component of the user's operation.| +| boolean | If the callback returns **true**, the application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to instruct the **\** component to exit the current page based on the user operation. If the callback returns **false**, the **\** component cannot trigger the system dialog box.| **Example** @@ -1412,7 +1412,7 @@ onPrompt(callback: (event?: { url: string; message: string; value: string; resul | Type | Description | | ------- | ---------------------------------------- | -| boolean | If the callback returns **false**, the default dialog box is displayed. If the callback returns **true**, a system application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to notify the **\** component of the user's operation.| +| boolean | If the callback returns **true**, the application can use the system dialog box (allows the confirm and cancel operations) and invoke the **JsResult** API to instruct the **\** component to exit the current page based on the user operation. If the callback returns **false**, the **\** component cannot trigger the system dialog box.| **Example** @@ -1460,7 +1460,7 @@ onPrompt(callback: (event?: { url: string; message: string; value: string; resul onConsole(callback: (event?: { message: ConsoleMessage }) => boolean) -Triggered to notify the host application of a JavaScript console message. +Called to notify the host application of a JavaScript console message. **Parameters** @@ -1539,7 +1539,7 @@ onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisp onErrorReceive(callback: (event?: { request: WebResourceRequest, error: WebResourceError }) => void) -Triggered when an error occurs during web page loading. For better results, simplify the implementation logic in the callback. +Called when an error occurs during web page loading. For better results, simplify the implementation logic in the callback. **Parameters** @@ -1583,7 +1583,7 @@ Triggered when an error occurs during web page loading. For better results, simp onHttpErrorReceive(callback: (event?: { request: WebResourceRequest, response: WebResourceResponse }) => void) -Triggered when an HTTP error (the response code is greater than or equal to 400) occurs during web page resource loading. +Called when an HTTP error (the response code is greater than or equal to 400) occurs during web page resource loading. **Parameters** @@ -1635,7 +1635,7 @@ Triggered when an HTTP error (the response code is greater than or equal to 400) onPageBegin(callback: (event?: { url: string }) => void) -Triggered when the web page starts to be loaded. This API is triggered only for the main frame content, and not for the iframe or frameset content. +Called when the web page starts to be loaded. This API is called only for the main frame content, and not for the iframe or frameset content. **Parameters** @@ -1668,7 +1668,7 @@ Triggered when the web page starts to be loaded. This API is triggered only for onPageEnd(callback: (event?: { url: string }) => void) -Triggered when the web page loading is complete. This API is triggered only for the main frame content. +Called when the web page loading is complete. This API takes effect only for the main frame content. **Parameters** @@ -1700,7 +1700,7 @@ Triggered when the web page loading is complete. This API is triggered only for onProgressChange(callback: (event?: { newProgress: number }) => void) -Triggered when the web page loading progress changes. +Called when the web page loading progress changes. **Parameters** @@ -1732,7 +1732,7 @@ Triggered when the web page loading progress changes. onTitleReceive(callback: (event?: { title: string }) => void) -Triggered when the document title of the web page is changed. +Called when the document title of the web page is changed. **Parameters** @@ -1764,7 +1764,7 @@ Triggered when the document title of the web page is changed. onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void) -Triggered when loading of the web page is complete. This API is used by an application to update the historical link it accessed. +Called when loading of the web page is complete. This API is used by an application to update the historical link it accessed.. **Parameters** @@ -1797,7 +1797,7 @@ Triggered when loading of the web page is complete. This API is used by an appli onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void) -Triggered when the rendering process exits abnormally. +Called when the rendering process exits abnormally. **Parameters** @@ -1829,7 +1829,7 @@ Triggered when the rendering process exits abnormally. onShowFileSelector(callback: (event?: { result: FileSelectorResult, fileSelector: FileSelectorParam }) => boolean) -Triggered to process an HTML form whose input type is **file**, in response to the tapping of the **Select File** button. +Called to process an HTML form whose input type is **file**, in response to the tapping of the **Select File** button. **Parameters** @@ -1842,7 +1842,7 @@ Triggered to process an HTML form whose input type is **file**, in response to t | Type | Description | | ------- | ---------------------------------------- | -| boolean | The value **true** means that the pop-up window provided by the system is displayed. The value **false** means that the default web pop-up window is displayed.| +| boolean | The value **true** means that the pop-up window provided by the system is displayed. If the callback returns **false**, the **\** component cannot trigger the system dialog box.| **Example** @@ -1885,7 +1885,7 @@ Triggered to process an HTML form whose input type is **file**, in response to t onResourceLoad(callback: (event: {url: string}) => void) -Invoked to notify the **\** component of the URL of the loaded resource file. +Called to notify the **\** component of the URL of the loaded resource file. **Parameters** @@ -1917,7 +1917,7 @@ Invoked to notify the **\** component of the URL of the loaded resource fil onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void) -Invoked when the display ratio of this page changes. +Called when the display ratio of this page changes. **Parameters** @@ -1950,7 +1950,7 @@ Invoked when the display ratio of this page changes. onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean) -Triggered when the **\** component is about to access a URL. This API is used to determine whether to block the access. +Called when the **\** component is about to access a URL. This API is used to determine whether to block the access. **Parameters** @@ -1989,7 +1989,7 @@ Triggered when the **\** component is about to access a URL. This API is us onInterceptRequest(callback: (event?: { request: WebResourceRequest}) => WebResourceResponse) -Invoked when the **\** component is about to access a URL. This API is used to block the URL and return the response data. +Called when the **\** component is about to access a URL. This API is used to block the URL and return the response data. **Parameters** @@ -2054,7 +2054,7 @@ Invoked when the **\** component is about to access a URL. This API is used onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, realm: string}) => boolean) -Invoked when an HTTP authentication request is received. +Called when an HTTP authentication request is received. **Parameters** @@ -2123,7 +2123,7 @@ Invoked when an HTTP authentication request is received. onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler, error: SslError }) => void) -Invoked when an SSL error occurs during resource loading. +Called when an SSL error occurs during resource loading. **Parameters** @@ -2176,7 +2176,7 @@ Invoked when an SSL error occurs during resource loading. onClientAuthenticationRequest(callback: (event: {handler : ClientAuthenticationHandler, host : string, port : number, keyTypes : Array, issuers : Array}) => void) -Invoked when an SSL client certificate request is received. +Called when an SSL client certificate request is received. **Parameters** @@ -2231,7 +2231,7 @@ Invoked when an SSL client certificate request is received. onPermissionRequest(callback: (event?: { request: PermissionRequest }) => void) -Invoked when a permission request is received. +Called when a permission request is received. **Parameters** @@ -2320,7 +2320,7 @@ Shows a context menu after the user clicks the right mouse button or long presse onScroll(callback: (event: {xOffset: number, yOffset: number}) => void) -Invoked when the scrollbar of the page scrolls. +Called when the scrollbar of the page scrolls. **Parameters** @@ -2398,7 +2398,7 @@ Registers a callback for receiving a request to obtain the geolocation informati onGeolocationHide(callback: () => void) -Triggered to notify the user that the request for obtaining the geolocation information received when **[onGeolocationShow](#ongeolocationshow)** is called has been canceled. +Called to notify the user that the request for obtaining the geolocation information received when **[onGeolocationShow](#ongeolocationshow)** is called has been canceled. **Parameters** @@ -2430,7 +2430,7 @@ Triggered to notify the user that the request for obtaining the geolocation info onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler }) => void) -Registers a callback for the component's entering into full screen mode. +Called when the component enters full screen mode. **Parameters** @@ -2463,7 +2463,7 @@ Registers a callback for the component's entering into full screen mode. onFullScreenExit(callback: () => void) -Registers a callback for the component's exiting full screen mode. +Called when the component exits full screen mode. **Parameters** @@ -2568,7 +2568,7 @@ Registers a callback for window closure. onSearchResultReceive(callback: (event?: {activeMatchOrdinal: number, numberOfMatches: number, isDoneCounting: boolean}) => void): WebAttribute -Invoked to notify the caller of the search result on the web page. +Called to notify the caller of the search result on the web page. **Parameters** @@ -2603,7 +2603,7 @@ Invoked to notify the caller of the search result on the web page. onDataResubmitted(callback: (event: {handler: DataResubmissionHandler}) => void) -Invoked when the web form data is resubmitted. +Called when the web form data is resubmitted. **Parameters** @@ -2636,7 +2636,7 @@ Invoked when the web form data is resubmitted. onPageVisible(callback: (event: {url: string}) => void) -Invoked when the old page is not displayed and the new page is about to be visible. +Called when the old page is not displayed and the new page is about to be visible. **Parameters** @@ -2668,7 +2668,7 @@ Invoked when the old page is not displayed and the new page is about to be visib onInterceptKeyEvent(callback: (event: KeyEvent) => boolean) -Invoked when the key event is intercepted, before being consumed by the Webview. +Called when the key event is intercepted, before being consumed by the Webview. **Parameters** @@ -2695,7 +2695,7 @@ Invoked when the key event is intercepted, before being consumed by the Webview. Column() { Web({ src:'www.example.com', controller: this.controller }) .onInterceptKeyEvent((event) => { - if (event.keyCode == 2017 || event.keyCode == 2018) { + if (event.keyCode == 2017 || event.keyCode == 2018) { console.info(`onInterceptKeyEvent get event.keyCode ${event.keyCode}`) return true; } @@ -2710,7 +2710,7 @@ Invoked when the key event is intercepted, before being consumed by the Webview. onTouchIconUrlReceived(callback: (event: {url: string, precomposed: boolean}) => void) -Invoked when an apple-touch-icon URL is received. +Called when an apple-touch-icon URL is received. **Parameters** @@ -2743,7 +2743,7 @@ Invoked when an apple-touch-icon URL is received. onFaviconReceived(callback: (event: {favicon: image.PixelMap}) => void) -Invoked when this web page receives a new favicon. +Called when this web page receives a new favicon. **Parameters** @@ -3243,7 +3243,7 @@ Performs HTTP authentication with the user name and password provided by the use isHttpAuthInfoSaved(): boolean -Uses the password cached on the server for authentication. +Uses the account name and password cached on the server for authentication. **Return value** @@ -4160,7 +4160,7 @@ This API is deprecated since API version 9. You are advised to use [loadUrl onActive(): void -Invoked when the **\** component enters the active state. +Called when the **\** component enters the active state. This API is deprecated since API version 9. You are advised to use [onActive9+](../apis/js-apis-webview.md#onactive). @@ -4189,7 +4189,7 @@ This API is deprecated since API version 9. You are advised to use [onActive** component enters the inactive state. +Called when the **\** component enters the inactive state. This API is deprecated since API version 9. You are advised to use [onInactive9+](../apis/js-apis-webview.md#oninactive). @@ -4319,7 +4319,7 @@ Zooms out of this web page by 20%. refresh() -Invoked when the **\** component refreshes the web page. +Called when the **\** component refreshes the web page. This API is deprecated since API version 9. You are advised to use [refresh9+](../apis/js-apis-webview.md#refresh). @@ -4973,39 +4973,6 @@ Sets the cookie. This API returns the result synchronously. Returns **true** if } ``` -### saveCookieSync9+ -saveCookieSync(): boolean - -Saves the cookies in the memory to the drive. This API returns the result synchronously. - -**Return value** - -| Type | Description | -| ------- | -------------------- | -| boolean | Operation result.| - -**Example** - - ```ts - // xxx.ets - @Entry - @Component - struct WebComponent { - controller: WebController = new WebController() - - build() { - Column() { - Button('saveCookieSync') - .onClick(() => { - let result = this.controller.getCookieManager().saveCookieSync() - console.log("result: " + result) - }) - Web({ src: 'www.example.com', controller: this.controller }) - } - } - } - ``` - ### getCookie9+ getCookie(url: string): string @@ -5087,6 +5054,39 @@ Sets a cookie value for the specified URL. } ``` +### saveCookieSync9+ +saveCookieSync(): boolean + +Saves the cookies in the memory to the drive. This API returns the result synchronously. + +**Return value** + +| Type | Description | +| ------- | -------------------- | +| boolean | Operation result.| + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController() + + build() { + Column() { + Button('saveCookieSync') + .onClick(() => { + let result = web_webview.WebCookieManager.saveCookieSync() + console.log("result: " + result) + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` ### saveCookieAsync9+ saveCookieAsync(): Promise\ @@ -5466,6 +5466,103 @@ Enumerates the error codes returned by **onSslErrorEventReceive** API. | On | The web dark mode is enabled. | | Auto | The web dark mode setting follows the system settings. | +## WebAsyncController + +Implements a **WebAsyncController** object, which can be used to control the behavior of a **\** component with asynchronous callbacks. A **WebAsyncController **object controls one **\** component. + +### Creating an Object + +``` +webController: WebController = new WebController(); +webAsyncController: WebAsyncController = new WebAsyncController(webController); +``` + +### storeWebArchive9+ + +storeWebArchive(baseName: string, autoName: boolean, callback: AsyncCallback\): void + +Stores this web page. This API uses an asynchronous callback to return the result. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ----------------------------------- | +| baseName | string | Yes | Save path. The value cannot be null. | +| autoName | boolean | Yes | Whether to automatically generate a file name.
The value **false** means not to automatically generate a file name.
The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. | +| callback | AsyncCallback\ | Yes | Callback used to return the save path if the operation is successful and null otherwise. | + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController() + build() { + Column() { + Button('saveWebArchive') + .onClick(() => { + let webAsyncController = new web_webview.WebAsyncController(this.controller) + webAsyncController.storeWebArchive("/data/storage/el2/base/", true, (filename) => { + if (filename != null) { + console.info(`save web archive success: ${filename}`) + } + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +### storeWebArchive9+ + +storeWebArchive(baseName: string, autoName: boolean): Promise\ + +Stores this web page. This API uses a promise to return the result. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ----------------------------------- | +| baseName | string | Yes | Save path. The value cannot be null. | +| autoName | boolean | Yes | Whether to automatically generate a file name.
The value **false** means not to automatically generate a file name.
The value **true** means to automatically generate a file name based on the URL of current page and the **baseName** value. In this case, **baseName** is regarded as a directory. | + +**Return value** + +| Type | Description | +| --------------- | -------------------------------- | +| Promise\ | Promise used to return the save path if the operation is successful and null otherwise. | + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController(); + build() { + Column() { + Button('saveWebArchive') + .onClick(() => { + let webAsyncController = new web_webview.WebAsyncController(this.controller); + webAsyncController.storeWebArchive("/data/storage/el2/base/", true) + .then(filename => { + if (filename != null) { + console.info(`save web archive success: ${filename}`) + } + }) + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + ## WebMessagePort9+ Implements a **WebMessagePort** instance, which can be used to send and receive messages. diff --git a/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md b/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md index 97b08d90ca88b2cef08ac931cc6a6405c2236dd5..0a33bf8135951134bb63fcd80caba5c00b77e683 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md +++ b/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md @@ -35,9 +35,9 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | selectedBackgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the selected item.
Default value: **0x1F0A59F7** | | popupBackground | [ResourceColor](ts-types.md#resourcecolor) | Background color of the pop-up text.
Default value: **0xFFF1F3F5** | | usingPopup | boolean | Whether to use pop-up text.
Default value: **false** | -| selectedFont | [Font](ts-types.md#font) | Font style of the selected text.
Default value:
{
fontSize:10,
fontStyle:FontStyle.Normal,
fontWeight:FontWeight.Normal,
fontFamily:HarmonyOS Sans
} | -| popupFont | [Font](ts-types.md#font) | Font style of the pop-up text.
Default value:
{
fontSize:10,
fontStyle:FontStyle.Normal,
fontWeight:FontWeight.Normal,
fontFamily:HarmonyOS Sans
} | -| font | [Font](ts-types.md#font) | Default font style of the alphabetic index bar.
Default value:
{
fontSize:10,
fontStyle:FontStyle.Normal,
fontWeight:FontWeight.Normal,
fontFamily:HarmonyOS Sans
} | +| selectedFont | [Font](ts-types.md#font) | Font style of the selected text.
Default value:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | +| popupFont | [Font](ts-types.md#font) | Font style of the pop-up text.
Default value:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | +| font | [Font](ts-types.md#font) | Default font style of the alphabetic index bar.
Default value:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | | itemSize | string \| number | Size of an item in the alphabetic index bar. The item is a square, and the side length needs to be set. This attribute cannot be set to a percentage.
Default value: **24.0** | | alignStyle | IndexerAlign | Alignment style of the alphabetic index bar. Left alignment and right alignment are supported.
Default value: **IndexerAlign.Right**| | selected | number | Index of the selected item.
Default value: **0**| diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md index 20c69e4a113344944d47b775965bedcaa77569ad..c2ade1369554bcbc167d932b16340d48e005098f 100644 --- a/en/application-dev/reference/errorcodes/Readme-EN.md +++ b/en/application-dev/reference/errorcodes/Readme-EN.md @@ -33,6 +33,8 @@ - Security - [Ability Access Control Error Codes](errorcode-access-token.md) - [HUKS Error Codes](errorcode-huks.md) + - [Crypto Framework Error Codes](errorcode-crypto-framework.md) + - [Certificate Error Codes](errorcode-cert.md) - [User Authentication Error Codes](errorcode-useriam.md) - Data Management - [RDB Error Codes](errorcode-data-rdb.md) @@ -55,6 +57,7 @@ - [HiDebug Error Codes](errorcode-hiviewdfx-hidebug.md) - [Input Method Framework Error Codes](errorcode-inputmethod-framework.md) - [Pasteboard Error Codes](errorcode-pasteboard.md) + - [Time and Time Zone Service Error Codes](errorcode-time.md) - [Webview Error Codes](errorcode-webview.md) - Account Management - [Account Error Codes](errorcode-account.md) diff --git a/en/application-dev/reference/errorcodes/errorcode-time.md b/en/application-dev/reference/errorcodes/errorcode-time.md new file mode 100644 index 0000000000000000000000000000000000000000..d63b3914ad6f480fdaa3808cf98ba25e390c7ebc --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-time.md @@ -0,0 +1,25 @@ +# Time and Time Zone Service Error Codes + +## -1 Screen Unlock Error + +**Error Message** + +The parameter check failed or permission denied or system error. + +**Description** + +This error code is reported when a parameter check failure, permission verification failure, or system operation error occurs. + +**Possible Cause** + + +1. The input parameter is invalid. +2. The required permission is not configured. For example, **ohos.permission.SET_TIME** is not configured for setting the time or **ohos.permission.SET_TIME_ZONE** is not configured for setting the time zone. +3. The system is not running properly due to a common kernel error, such as a memory allocation and multi-thread processing error. + +**Solution** + +1. Make sure input parameters are passed in as required. +2. Configure the **ohos.permission.SET_TIME** permission for setting the time and the **ohos.permission.SET_TIME_ZONE** permission for setting the time zone. +3. Make sure the memory is sufficient. + diff --git a/en/application-dev/windowmanager/application-window-fa.md b/en/application-dev/windowmanager/application-window-fa.md index b2123e720b1bf1cb15cfe648597e6f82e7b3dae4..ee7848d49aaccd039c59a1bac2553f0b485ecc1c 100644 --- a/en/application-dev/windowmanager/application-window-fa.md +++ b/en/application-dev/windowmanager/application-window-fa.md @@ -52,7 +52,7 @@ You can create a subwindow, such as a dialog box, and set its properties. let windowClass = null; // Method 1: Create a subwindow. - let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP, ctx: this.context}; + let config = {name: "subWindow", windowType: window.WindowType.TYPE_APP}; window.createWindow(config, (err, data) => { if (err.code) { console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err)); diff --git a/en/application-dev/windowmanager/application-window-stage.md b/en/application-dev/windowmanager/application-window-stage.md index 709d58ba9f469f11a3675f8fd4326e1b490a1b5d..d960b9c236f374ed2e56ae447021899554bce2f4 100644 --- a/en/application-dev/windowmanager/application-window-stage.md +++ b/en/application-dev/windowmanager/application-window-stage.md @@ -390,4 +390,3 @@ A floating window is created based on an existing task. It is always displayed i }; ``` - \ No newline at end of file diff --git a/en/device-dev/device-test/xdevice.md b/en/device-dev/device-test/xdevice.md index 0b33efa70e1d06c45673c287a4c0373f1db6f8cc..dd65022b37a1397978e714f0d90c425aafa50bc3 100644 --- a/en/device-dev/device-test/xdevice.md +++ b/en/device-dev/device-test/xdevice.md @@ -476,7 +476,7 @@ Check whether xDevice runs properly. The COM port whose **type** is **cmd** corresponds to the AT command serial port on the board. The port is used to send commands to the device. In the example, the **ChA(COM20)** serial port is used. - L0-1 + ![L0-1](figures/L0-1.PNG) IP camera devices have two connection modes. One is to connect through the local serial port, and the other is to connect through the IP address of the local area network. @@ -492,7 +492,7 @@ Check whether xDevice runs properly. Add an NFS sharing path, for example, **D:\HS\NFS_Share_File -public 鈥揳lldirs**. Note that the FTP IP address 192.168.1.10 is the IP address of the development board. - + ![](figures/NFS-2.PNG) 3. Stop the NFS server and restart the NFS server to make the added sharing path take effect. diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-camera-sync.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-camera-sync.md new file mode 100644 index 0000000000000000000000000000000000000000..c20c9e4c50f8de7ba2c8a0323f19d2000e4007ad --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-camera-sync.md @@ -0,0 +1,522 @@ +# Multimedia Subsystem ChangeLog + +Compared with OpenHarmony 3.2 Beta4, OpenHarmony3.2.10.3 has the following changes in APIs of the camera component in the multimedia subsystem. + +## cl.subsystemname.1 Camera API Changed +1. All the APIs of the camera component are changed to system APIs in the API version 9. +2. Some functional APIs are added and some others are deprecated to: + +- Improve the usability of camera APIs. +- Help you quickly understand camera APIs and use them for development. +- Facilitate expansion of framework functions in later versions, and reduce coupling between framework modules. + +You need to refer to the following change description to adapt your application. + +**Change Impacts** + +JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version. + +**Key API/Component Changes** + +| Module | Class | Method/Attribute/Enum/Constant | Is System API| Change Type| +| ---------------------- | ----------------------- | ------------------------------------------------------------ | --------------- | -------- | +| ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | Yes | Added | +| ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback): void;
function getCameraManager(context: Context): Promise; | Yes | Deprecated | +| ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101,
OPERATION_NOT_ALLOWED = 7400102,
SESSION_NOT_CONFIG = 7400103,
SESSION_NOT_RUNNING = 7400104,
SESSION_CONFIG_LOCKED = 7400105,
DEVICE_SETTING_LOCKED = 7400106,
CONFILICT_CAMERA = 7400107,
DEVICE_DISABLED = 7400108,
SERVICE_FATAL_ERROR = 7400201 | Yes | Added | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array;
getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;
createCameraInput(camera: CameraDevice): CameraInput;
createCameraInput(position: CameraPosition, type: CameraType): CameraInput;
createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;
createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;
createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;
createMetadataOutput(metadataObjectTypes: Array): MetadataOutput;
createCaptureSession(): CaptureSession; | Yes | Added | +| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>;
getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise;
createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise;
createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void;
createCameraInput(position: CameraPosition, type: CameraType): Promise;
createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise;
createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise;
createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise;
createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise;
createCaptureSession(callback: AsyncCallback): void;
createCaptureSession(): Promise; | Yes | Deprecated | +| ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | Yes | Added | +| ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | Yes | Deprecated | +| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | Yes | Added | +| ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback): void;
release(): Promise;
on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | Yes | Deprecated | +| ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1
ERROR_NO_PERMISSION = 0
ERROR_DEVICE_PREEMPTED = 1
ERROR_DEVICE_DISCONNECTED = 2
ERROR_DEVICE_IN_USE = 3
ERROR_DRIVER_ERROR = 4 | Yes | Deprecated | +| ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | Yes | Deprecated | +| ohos.multimedia.camera | CaptureSession | beginConfig(): void;
addInput(cameraInput: CameraInput): void;
removeInput(cameraInput: CameraInput): void;
addOutput(cameraOutput: CameraOutput): void;
removeOutput(cameraOutput: CameraOutput): void;
hasFlash(): boolean;
isFlashModeSupported(flashMode: FlashMode): boolean;
getFlashMode(): FlashMode;
setFlashMode(flashMode: FlashMode): void;
isExposureModeSupported(aeMode: ExposureMode): boolean;
getExposureMode(): ExposureMode;
setExposureMode(aeMode: ExposureMode): void;
getMeteringPoint(): Point;
setMeteringPoint(point: Point): void;
getExposureBiasRange(): Array;
setExposureBias(exposureBias: number): void;
getExposureValue(): number;
isFocusModeSupported(afMode: FocusMode): boolean;
getFocusMode(): FocusMode;
setFocusMode(afMode: FocusMode): void;
setFocusPoint(point: Point): void;
getFocusPoint(): Point;
getFocalLength(): number;
getZoomRatioRange(): Array;
getZoomRatio(): number;
setZoomRatio(zoomRatio: number): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;
getActiveVideoStabilizationMode(): VideoStabilizationMode;
setVideoStabilizationMode(mode: VideoStabilizationMode): void;
on(type: 'error', callback: ErrorCallback): void; | Yes | Added | +| ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback): void;
beginConfig(): Promise;
addInput(cameraInput: CameraInput, callback: AsyncCallback): void;
addInput(cameraInput: CameraInput): Promise;
removeInput(cameraInput: CameraInput, callback: AsyncCallback): void;
removeInput(cameraInput: CameraInput): Promise;
addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise;
removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise;
hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise;
getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise;
setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise;
on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | +| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0
ERROR_TIMEOUT = 1 | Yes | Deprecated | +| ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | Yes | Deprecated | +| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Added | +| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | +| ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | Yes | Deprecated | +| ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | Yes | Deprecated | +| ohos.multimedia.camera | PhotoOutput | capture(): Promise;
isMirrorSupported(): boolean;
on(type: 'error', callback: ErrorCallback): void; | Yes | Added | +| ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback): void;
isMirrorSupported(): Promise;
on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | +| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0
ERROR_INSUFFICIENT_RESOURCES = 1
ERROR_TIMEOUT = 2 | Yes | Deprecated | +| ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | Yes | Deprecated | +| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Added | +| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | +| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0 | Yes | Deprecated | +| ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | Yes | Deprecated | +| ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType;
readonly timestamp: number; | Yes | Added | +| ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback): void;
getType(): Promise;
getTimestamp(callback: AsyncCallback): void;
getTimestamp(): Promise;
getBoundingBox(callback: AsyncCallback): void;
getBoundingBox(): Promise; | Yes | Deprecated | +| ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | Yes | Added | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Added | +| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | +| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0 | Yes | Deprecated | +| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | Yes | Deprecated | + +**Adaptation Guide** + +In addition to the new APIs and deprecated APIs, you need to adapt your application to the changed APIs. + +In Beta4 and later versions, the following APIs are changed. + +**New APIs** + +1. **CameraErrorCode** enums + + Enum: INVALID_ARGUMENT; value: 7400101 + + Enum: OPERATION_NOT_ALLOWED; value: 7400102 + + Enum: SESSION_NOT_CONFIG; value: 7400103 + + Enum: SESSION_NOT_RUNNING; value: 7400104 + + Enum: SESSION_CONFIG_LOCKED; value: 7400105 + + Enum: DEVICE_SETTING_LOCKED; value: 7400106 + + Enum: CONFILICT_CAMERA; value: 7400107 + + Enum: DEVICE_DISABLED; value: 7400108 + + Enum: SERVICE_FATAL_ERROR; value: 7400201 + +2. Added **capture(): Promise** to the **PhotoOutput** API. + +3. Added the readonly type **MetadataObjectType** to the **MetadataObject** API. + +4. Added **readonly timestamp: number** to the **MetadataObject** API. + +5. Added **readonly boundingBox: Rect** to the **MetadataObject** API. + +**Deprecated APIs** + +1. Deprecated the **release(callback: AsyncCallback): void** and **release(): Promise** APIs in **CameraInput**. + +2. Deprecated the **CameraInputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_NO_PERMISSION** = **0**, **ERROR_DEVICE_PREEMPTED** = **1**, **ERROR_DEVICE_DISCONNECTED** = **2**, **ERROR_DEVICE_IN_USE** = **3**, **ERROR_DRIVER_ERROR** = **4** + +3. Deprecated the **CameraInputError** API and its attribute **CameraInputErrorCode**. + +4. Deprecated the **CaptureSessionErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_INSUFFICIENT_RESOURCES** = **0**, **ERROR_TIMEOUT** = **1** + +5. Deprecated the **CaptureSessionError** API and its attribute **CaptureSessionErrorCode**. + +6. Deprecated the **PreviewOutputErrorCode** enum and its value: **ERROR_UNKNOWN** = **-1** + +7. Deprecated the **PreviewOutputError** API and its attribute **PreviewOutputErrorCode**. + +8. Deprecated the **PhotoOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_DRIVER_ERROR** = **0**, **ERROR_INSUFFICIENT_RESOURCES** = **1**, **ERROR_TIMEOUT** = **2** + +9. Deprecated the **PhotoOutputError** API and its attribute **PhotoOutputErrorCode**. + +10. Deprecated the **VideoOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_DRIVER_ERROR** = **0** + +11. Deprecated the **VideoOutputError** API and its attribute **VideoOutputErrorCode**. + +12. Deprecated **getType(callback: AsyncCallback): void** in the **MetadataObject** API. + +13. Deprecated **getType(): Promise** in the **MetadataObject** API. + +14. Deprecated **getTimestamp(callback: AsyncCallback): void** in the **MetadataObject** API. + +15. Deprecated **getTimestamp(): Promise** in the **MetadataObject** API. + +16. Deprecated **getBoundingBox(callback: AsyncCallback): void** in the **MetadataObject** API. + +17. Deprecated **getBoundingBox(): Promise** in the **MetadataObject** API. + +18. Deprecated the **MetadataOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_INSUFFICIENT_RESOURCES** = **0** + +19. Deprecated the **MetadataOutputError** API and its attribute **MetadataOutputErrorCode**. + +**Changed APIs** + +1. Changed the return modes of the **getCameraManager** API in the camera module from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getCameraManager(context: Context, callback: AsyncCallback): void** and **getCameraManager(context: Context): Promise** are changed to **getCameraManager(context: Context): CameraManager**. + + The sample code is as follows: + + ``` + let cameraManager = camera.getCameraManager(context); + ``` + +2. Changed the return modes of the **getSupportedCameras** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getSupportedCameras(callback: AsyncCallback>): void** and **getSupportedCameras(): Promise>** are changed to **getSupportedCameras(): Array**. + + The sample code is as follows: + + ``` + let cameras = cameraManager.getSupportedCameras(); + ``` + +3. Changed the return modes of the **getSupportedOutputCapability** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void** and **getSupportedOutputCapability(camera: CameraDevice): Promise** are changed to **getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability**. + + The sample code is as follows: + + ``` + let cameraDevice = cameras[0]; + let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice); + ``` + +4. Changed the return modes of the **createCameraInput(camera: CameraDevice)** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCameraInput(camera: CameraDevice, callback: AsyncCallback): void** and **createCameraInput(camera: CameraDevice): Promise** are changed to **createCameraInput(camera: CameraDevice): CameraInput**. + + The sample code is as follows: + + ``` + let cameraDevice = cameras[0]; + let cameraInput = cameraManager.createCameraInput(cameraDevice); + ``` + +5. Changed the return modes of the **createCameraInput(position: CameraPosition, type: CameraType)** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void** and **createCameraInput(position: CameraPosition, type: CameraType): Promise** are changed to **createCameraInput(position: CameraPosition, type: CameraType): CameraInput**. + + The sample code is as follows: + + ``` + let cameraDevice = cameras[0]; + let position = cameraDevice.cameraPosition; + let type = cameraDevice.cameraType; + let cameraInput = cameraManager.createCameraInput(position, type); + ``` + +6. Changed the return modes of the **createPreviewOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void** and **createPreviewOutput(profile: Profile, surfaceId: string): Promise** are changed to **createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput**. + + The sample code is as follows: + + ``` + let profile = cameraoutputcapability.previewProfiles[0]; + let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId); + ``` + +7. Changed the return modes of the **createPhotoOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void** and **createPhotoOutput(profile: Profile, surfaceId: string): Promise** are changed to **createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput**. + + The sample code is as follows: + + ``` + let profile = cameraoutputcapability.photoProfiles[0]; + let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId); + ``` + +8. Changed the return modes of the **createVideoOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void** and **createVideoOutput(profile: VideoProfile, surfaceId: string): Promise** are changed to **createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput**. + + The sample code is as follows: + + ``` + let profile = cameraoutputcapability.videoProfiles[0]; + let videoOutput = cameraManager.createVideoOutput(profile, surfaceId); + ``` + +9. Changed the return modes of the **createMetadataOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void** and **createMetadataOutput(metadataObjectTypes: Array): Promise** are changed to **createMetadataOutput(metadataObjectTypes: Array): MetadataOutput**. + + The sample code is as follows: + + ``` + let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; + let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes); + ``` + +10. Changed the return modes of the **createCaptureSession** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCaptureSession(callback: AsyncCallback): void** and **createCaptureSession(): Promise** are changed to **createCaptureSession(): CaptureSession**. + + The sample code is as follows: + + ``` + let captureSession = cameraManager.createCaptureSession(); + ``` + +11. Changed the enum **CAMERA_TYPE_UNSPECIFIED** of **CameraType** to **CAMERA_TYPE_DEFAULT**. + +12. Changed the return value type of the **on** API in CameraInput from **CameraInputError** to **BusinessError**. Therefore, the original API **on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void** is changed to **on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void**. + + The sample code is as follows: + + ``` + let cameraDevice = cameras[0]; + cameraInput.on('error', cameraDevice, (BusinessError) => { + + }) + ``` + +13. Changed the return modes of the **beginConfig** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **beginConfig(callback: AsyncCallback): void** and **beginConfig(): Promise** are changed to **beginConfig(): void**. + + The sample code is as follows: + + ``` + captureSession.beginConfig(); + ``` + +14. Changed the return modes of the **addInput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **addInput(cameraInput: CameraInput, callback: AsyncCallback): void** and **addInput(cameraInput: CameraInput): Promise** are changed to **addInput(cameraInput: CameraInput): void**. + + The sample code is as follows: + + ``` + captureSession.addInput(cameraInput); + ``` + +15. Changed the return modes of the **removeInput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **removeInput(cameraInput: CameraInput, callback: AsyncCallback): void** and **removeInput(cameraInput: CameraInput): Promise** are changed to **removeInput(cameraInput: CameraInput): void**. + + The sample code is as follows: + + ``` + captureSession.removeInput(cameraInput); + ``` + +16. Changed the return modes of the **addOutput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void** and **addOutput(cameraOutput: CameraOutput): Promise** are changed to **addOutput(cameraOutput: CameraOutput): void**. + + The sample code is as follows: + + ``` + captureSession.addOutput(previewOutput); + ``` + +17. Changed the return modes of the **removeOutput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void** and **removeOutput(cameraOutput: CameraOutput): Promise** are changed to **removeOutput(cameraOutput: CameraOutput): void**. + + The sample code is as follows: + + ``` + captureSession.removeOutput(previewOutput); + ``` + +18. Changed the return modes of the **hasFlash** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **hasFlash(callback: AsyncCallback): void** and **hasFlash(): Promise** are changed to **hasFlash(): boolean**. + + The sample code is as follows: + + ``` + let status = captureSession.hasFlash(); + ``` + +19. Changed the return modes of the **isFlashModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void** and **isFlashModeSupported(flashMode: FlashMode): Promise** are changed to **isFlashModeSupported(flashMode: FlashMode): boolean**. + + The sample code is as follows: + + ``` + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); + ``` + +20. Changed the return modes of the **getFlashMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFlashMode(callback: AsyncCallback): void** and **getFlashMode(): Promise** are changed to **getFlashMode(): FlashMode**. + + The sample code is as follows: + + ``` + let flashMode = captureSession.getFlashMode(); + ``` + +21. Changed the return modes of the **isExposureModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void** and **isExposureModeSupported(aeMode: ExposureMode): Promise** are changed to **isExposureModeSupported(aeMode: ExposureMode): boolean**. + + The sample code is as follows: + + ``` + let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED); + ``` + +22. Changed the return modes of the **getExposureMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureMode(callback: AsyncCallback): void** and **getExposureMode(): Promise** are changed to **getExposureMode(): ExposureMode**. + + The sample code is as follows: + + ``` + let exposureMode = captureSession.getExposureMode(); + ``` + +23. Changed the return modes of the **setExposureMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void** and **setExposureMode(aeMode: ExposureMode): Promise** are changed to **setExposureMode(aeMode: ExposureMode): void**. + + The sample code is as follows: + + ``` + captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED); + ``` + +24. Changed the return modes of the **getMeteringPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getMeteringPoint(callback: AsyncCallback): void** and **getMeteringPoint(): Promise** are changed to **getMeteringPoint(): Point**. + + The sample code is as follows: + + ``` + let exposurePoint = captureSession.getMeteringPoint(); + ``` + +25. Changed the return modes of the **setMeteringPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setMeteringPoint(point: Point, callback: AsyncCallback): void** and **setMeteringPoint(point: Point): Promise** are changed to **setMeteringPoint(point: Point): void**. + + The sample code is as follows: + + ``` + let Point2 = {x: 2, y: 2}; + captureSession.setMeteringPoint(Point2); + ``` + +26. Changed the return modes of the **getExposureBiasRange** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureBiasRange(callback: AsyncCallback>): void** and **getExposureBiasRange(): Promise>** are changed to **getExposureBiasRange(): Array**. + + The sample code is as follows: + + ``` + let biasRangeArray = captureSession.getExposureBiasRange(); + ``` + +27. Changed the return modes of the **setExposureBias** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setExposureBias(exposureBias: number, callback: AsyncCallback): void** and **setExposureBias(exposureBias: number): Promise** are changed to **setExposureBias(exposureBias: number): void**. + + The sample code is as follows: + + ``` + let exposureBias = biasRangeArray[0]; + captureSession.setExposureBias(exposureBias); + ``` + +28. Changed the return modes of the **getExposureValue** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureValue(callback: AsyncCallback): void** and **getExposureValue(): Promise** are changed to **getExposureValue(): number**. + + The sample code is as follows: + + ``` + let exposureValue = captureSession.getExposureValue(); + ``` + +29. Changed the return modes of the **isFocusModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void** and **isFocusModeSupported(afMode: FocusMode): Promise** are changed to **isFocusModeSupported(afMode: FocusMode): boolean**. + + The sample code is as follows: + + ``` + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); + ``` + +30. Changed the return modes of the **getFocusMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocusMode(callback: AsyncCallback): void** and **getFocusMode(): Promise** are changed to **getFocusMode(): FocusMode**. + + The sample code is as follows: + + ``` + let afMode = captureSession.getFocusMode(); + ``` + +31. Changed the return modes of the **setFocusMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setFocusMode(afMode: FocusMode, callback: AsyncCallback): void** and **setFocusMode(afMode: FocusMode): Promise** are changed to **setFocusMode(afMode: FocusMode): void**. + + The sample code is as follows: + + ``` + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO); + ``` + +32. Changed the return modes of the **setFocusPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setFocusPoint(point: Point, callback: AsyncCallback): void** and **setFocusPoint(point: Point): Promise** are changed to **setFocusPoint(point: Point): void**. + + The sample code is as follows: + + ``` + let Point2 = {x: 2, y: 2}; + captureSession.setFocusPoint(Point2); + ``` + +33. Changed the return modes of the **getFocusPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocusPoint(callback: AsyncCallback): void** and **getFocusPoint(): Promise** are changed to **getFocusPoint(): Point**. + + The sample code is as follows: + + ``` + let point = captureSession.getFocusPoint(); + ``` + +34. Changed the return modes of the **getFocalLength** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocalLength(callback: AsyncCallback): void** and **getFocalLength(): Promise** are changed to **getFocalLength(): number**. + + The sample code is as follows: + + ``` + let focalLength = captureSession.getFocalLength(); + ``` + +35. Changed the return modes of the **getZoomRatioRange** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getZoomRatioRange(callback: AsyncCallback>): void** and **getZoomRatioRange(): Promise>** are changed to **getZoomRatioRange(): Array**. + + The sample code is as follows: + + ``` + let zoomRatioRange = captureSession.getZoomRatioRange(); + ``` + +36. Changed the return modes of the **getZoomRatio** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getZoomRatio(callback: AsyncCallback): void** and **getZoomRatio(): Promise** are changed to **getZoomRatio(): number**. + + The sample code is as follows: + + ``` + let zoomRatio = captureSession.getZoomRatio(); + ``` + +37. Changed the return modes of the **setZoomRatio** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setZoomRatio(zoomRatio: number, callback: AsyncCallback): void** and **setZoomRatio(zoomRatio: number): Promise** are changed to **setZoomRatio(zoomRatio: number): void**. + + The sample code is as follows: + + ``` + let zoomRatio = zoomRatioRange[0]; + captureSession.setZoomRatio(zoomRatio); + ``` + +38. Changed the return modes of the **isVideoStabilizationModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void** and **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise** are changed to **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean**. + + The sample code is as follows: + + ``` + let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF); + ``` + +39. Changed the return modes of the **getActiveVideoStabilizationMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getActiveVideoStabilizationMode(callback: AsyncCallback): void** and **getActiveVideoStabilizationMode(): Promise** are changed to **getActiveVideoStabilizationMode(): VideoStabilizationMode**. + + The sample code is as follows: + + ``` + let vsMode = captureSession.getActiveVideoStabilizationMode(); + ``` + +40. Changed the return modes of the **setVideoStabilizationMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void** and **setVideoStabilizationMode(mode: VideoStabilizationMode): Promise** are changed to **setVideoStabilizationMode(mode: VideoStabilizationMode): void**. + + The sample code is as follows: + + ``` + captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF); + ``` + +41. Changed the **on(type:'error') callback** type in CaptureSession from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. + + The sample code is as follows: + + ``` + captureSession.on('error', (BusinessError) => { + + }) + ``` + +42. Changed the **on(type:'error') callback** type in PreviewOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. + + The sample code is as follows: + + ``` + previewOutput.on('error', (BusinessError) => { + + }) + ``` + +43. Changed the return modes of the **isMirrorSupported** API in PhotoOutput from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isMirrorSupported(callback: AsyncCallback): void** and **isMirrorSupported(): Promise** are changed to **isMirrorSupported(): boolean**. + + The sample code is as follows: + + ``` + let isSupported = photoOutput.isMirrorSupported(); + ``` + +44. Changed the **on(type:'error') callback** type in PhotoOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. + + The sample code is as follows: + + ``` + PhotoOutput.on('error', (BusinessError) => { + + }) + ``` + +45. Changed the **on(type:'error') callback** type in VideoOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. + + The sample code is as follows: + + ``` + VideoOutput.on('error', (BusinessError) => { + + }) + ``` + +46. Changed the **on(type:'error') callback** type in MetadataOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. + + The sample code is as follows: + + ``` + MetadataOutput.on('error', (BusinessError) => { + + }) + ``` \ No newline at end of file diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-bundlemanager.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-bundlemanager.md new file mode 100644 index 0000000000000000000000000000000000000000..e0f29bcac24ac3261ae12ea6810ab5da6c4907b8 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-bundlemanager.md @@ -0,0 +1,41 @@ +# Bundle Manager Subsystem ChangeLog + +## cl.bundlemanager.1 Field Change of the ApplicationInfo Struct in API Version 9 + +The **entryDir** field is deleted from the **ApplicationInfo** struct [[bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/monthly_20221018/api/bundleManager/applicationInfo.d.ts)] in API version 9. + +**Change Impacts** + +There is no impact on applications that use the APIs of versions earlier than 9. The applications that use the APIs of version 9 must adapt to the new modules and APIs. + +**Key API/Component Changes** + +The following table describes the changed fields in the **ApplicationInfo** struct. + +| Deleted Field| Added or Changed Field in API Version 9| Type| +| --- | --- | --- | +| entryDir | None | string | + +**Adaptation Guide** + +When importing the bundle management query module, delete the **entryDir** field from the **ApplicationInfo** struct of API version 9. + +## cl.bundlemanager.2 Field Change of the HapModuleInfo Struct in API Version 9 + +The **moduleSourceDir** field is deleted from the **HapModuleInfo** struct [[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/monthly_20221018/api/bundleManager/hapModuleInfo.d.ts)] in API version 9. + +**Change Impacts** + +There is no impact on applications that use the APIs of versions earlier than 9. The applications that use the APIs of version 9 must adapt to the new modules and APIs. + +**Key API/Component Changes** + +The following table describes the changed fields in the **HapModuleInfo** struct. + +| Deleted Field| Added or Changed Field in API Version 9| Type| +| --- | --- | --- | +| moduleSourceDir | None | string | + +**Adaptation Guide** + +When importing the bundle manager query module, delete the **moduleSourceDir** field from the **HapModuleInfo** struct of API version 9. \ No newline at end of file diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-window.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-window.md new file mode 100644 index 0000000000000000000000000000000000000000..b3514e82cca44c154a70b999e6cc62a54d47ff92 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-window.md @@ -0,0 +1,63 @@ +# Window Subsystem ChangeLog + +## cl.window.1 Change of Window Stage Lifecycle Listener Types + +Changed the enumerated listener types of the window stage lifecycle in version 3.2.10.5 and later. + +**Change Impacts** + +Application lifecycle listeners developed using **FOREGROUND** and **BACKGROUND** in versions earlier than 3.2.10.5 will be invalidated in version 3.2.10.5 and later. + +**Key API/Component Changes** + +## WindowStageEventType9+ + +Before change + +| Name | Value | Description | +| ---------- | ---- | ---------- | +| FOREGROUND | 1 | The window stage is running in the foreground.| +| BACKGROUND | 4 | The window stage is running in the background.| + +After change +| Name | Value | Description | +| ------ | ---- | ---------- | +| SHOWN | 1 | The window stage is running in the foreground.| +| HIDDEN | 4 | The window stage is running in the background.| + +**Adaptation Guide** + +When registering lifecycle listeners, change the foreground and background event types to **SHOWN** and **HIDDEN**, respectively. + +``` +import Ability from '@ohos.application.Ability'; + +class myAbility extends Ability { + onWindowStageCreate(windowStage) { + console.log('onWindowStageCreate'); + try { + windowStage.on('windowStageEvent', (stageEventType) => { + switch (stageEventType) { + case window.WindowStageEventType.SHOWN: + console.log("windowStage shown"); + break; + case window.WindowStageEventType.ACTIVE: + console.log("windowStage active"); + break; + case window.WindowStageEventType.INACTIVE: + console.log("windowStage inActive"); + break; + case window.WindowStageEventType.HIDDEN: + console.log("windowStage hidden"); + break; + default: + break; + } + } ) + } catch (exception) { + console.error('Failed to enable the listener for window stage event changes. Cause:' + + JSON.stringify(exception)); + }; + } +}; +``` diff --git a/zh-cn/application-dev/ability-deprecated/fa-brief.md b/zh-cn/application-dev/ability-deprecated/fa-brief.md index 304cbc0be9f90d6ac83699c5b3da83aef02fb623..0e076ebc937aa8e0726361f865285fb181068c10 100644 --- a/zh-cn/application-dev/ability-deprecated/fa-brief.md +++ b/zh-cn/application-dev/ability-deprecated/fa-brief.md @@ -52,9 +52,9 @@ FA妯″瀷鐨勫簲鐢ㄥ寘鐨勫伐绋嬬洰褰曠粨鏋勶紝璇峰弬鑰僛OpenHarmony宸ョ▼浠嬬粛](h - [`DistributeGraffiti`锛氬垎甯冨紡娑傞甫锛圓rkTS锛夛紙API8锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/DistributedGraffiti) - [鍒嗗竷寮忚皟搴﹀惎鍔ㄨ繙绋婩A锛圝S锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteStartFA) - [鍒嗗竷寮忔柊闂诲鎴风锛圝S锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/NewsDemo) -- [鍒嗗竷寮忔墜鍐欐澘锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) +- [鍒嗗竷寮忔墜鍐欐澘锛圓rkTS锛夛紙Full SDK锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) - [鍒嗗竷寮忛壌鏉冿紙JS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/GameAuthOpenH) -- [鍒嗗竷寮忔父鎴忔墜鏌勶紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) -- [鍒嗗竷寮忛偖浠讹紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) -- [鍒嗗竷寮忎翰瀛愭棭鏁欑郴缁燂紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) -- [鍒嗗竷寮忛仴鎺у櫒锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) \ No newline at end of file +- [鍒嗗竷寮忔父鎴忔墜鏌勶紙ArkTS锛夛紙Full SDK锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) +- [鍒嗗竷寮忛偖浠讹紙ArkTS锛夛紙Full SDK锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) +- [鍒嗗竷寮忎翰瀛愭棭鏁欑郴缁燂紙ArkTS锛夛紙Full SDK锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) +- [鍒嗗竷寮忛仴鎺у櫒锛圓rkTS锛夛紙Full SDK锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) \ No newline at end of file diff --git a/zh-cn/application-dev/ability-deprecated/stage-ability.md b/zh-cn/application-dev/ability-deprecated/stage-ability.md index f7892537e8102e903888e672e1df4ef29cac6d45..2c9e4d582b569af61f5c54999967979288fbc23b 100644 --- a/zh-cn/application-dev/ability-deprecated/stage-ability.md +++ b/zh-cn/application-dev/ability-deprecated/stage-ability.md @@ -300,3 +300,13 @@ struct Index { } } ``` + +## 鐩稿叧瀹炰緥 + +鍩轰簬Stage妯″瀷涓嬬殑Ability寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 + +- [Ability鍐呭拰Ability闂撮〉闈㈢殑璺宠浆锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Ability/StageAbility) + +- [Stage妯″瀷涓婣bility鐨勫垱寤哄拰浣跨敤锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Ability/StageAbilityDemo) + +- [Ability鍐呴〉闈㈤棿鐨勮烦杞紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Ability/PagesRouter) \ No newline at end of file diff --git a/zh-cn/application-dev/ability-deprecated/stage-serviceextension.md b/zh-cn/application-dev/ability-deprecated/stage-serviceextension.md index f52701d88dfd1d9bca4be663ff8652c44e480a0b..fe88505ddb374eb686c765538eaf457caca262f9 100644 --- a/zh-cn/application-dev/ability-deprecated/stage-serviceextension.md +++ b/zh-cn/application-dev/ability-deprecated/stage-serviceextension.md @@ -75,4 +75,7 @@ OpenHarmony褰撳墠涓嶆敮鎸佷笁鏂瑰簲鐢ㄥ垱寤篠erviceExtensionAbility銆 ## 鐩稿叧瀹炰緥 閽堝ServiceExtensionAbility寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 + +- [`AbilityConnectServiceExtension`锛欰bility涓嶴erviceExtensionAbility閫氫俊锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/AbilityConnectServiceExtension) + - [`ServiceExtAbility`锛歋tageExtAbility鐨勫垱寤轰笌浣跨敤锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ServiceExtAbility) diff --git a/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md b/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md index bf332bf895584a9002d942a1296c1759915f4309..e8c032c0966dfdfca580da475b2bb30ff2e0ef8a 100644 --- a/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md +++ b/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md @@ -72,4 +72,6 @@ 4. want鍐卼ype涓嶄负绌猴紝涓旇skills鍐卼ype鍖呭惈锛屽尮閰嶆垚鍔熴 -2. 褰撴湁澶氫釜鍖归厤搴旂敤鏃讹紝浼氳搴旂敤閫夋嫨鍣ㄥ睍绀虹粰鐢ㄦ埛杩涜閫夋嫨銆stage-want1 +2. 褰撴湁澶氫釜鍖归厤搴旂敤鏃讹紝浼氳搴旂敤閫夋嫨鍣ㄥ睍绀虹粰鐢ㄦ埛杩涜閫夋嫨銆 + + ![stage-want1](figures/stage-want1.png) diff --git a/zh-cn/application-dev/application-models/application-context-stage.md b/zh-cn/application-dev/application-models/application-context-stage.md index 029191ebf9e20146981707e53952e1435ee41c38..6f42b99409c997d8f7e9608db050df727f431163 100644 --- a/zh-cn/application-dev/application-models/application-context-stage.md +++ b/zh-cn/application-dev/application-models/application-context-stage.md @@ -6,10 +6,12 @@ [Context](../reference/apis/js-apis-inner-application-context.md)鏄簲鐢ㄤ腑瀵硅薄鐨勪笂涓嬫枃锛屽叾鎻愪緵浜嗗簲鐢ㄧ殑涓浜涘熀纭淇℃伅锛屼緥濡俽esourceManager锛堣祫婧愮鐞嗭級銆乤pplicationInfo锛堝綋鍓嶅簲鐢ㄤ俊鎭級銆乨ir锛堝簲鐢ㄥ紑鍙戣矾寰勶級銆乤rea锛堟枃浠跺垎鍖猴級绛夛紝浠ュ強搴旂敤鐨勪竴浜涘熀鏈柟娉曪紝渚嬪createBundleContext()銆乬etApplicationContext()绛夈俇IAbility缁勪欢鍜屽悇绉岴xtensionAbility娲剧敓绫荤粍浠堕兘鏈夊悇鑷笉鍚岀殑Context绫汇傚垎鍒湁鍩虹被Context銆丄pplicationContext銆丄bilityStageContext銆乁IAbilityContext銆丒xtensionContext銆丼erviceExtensionContext绛塁ontext銆 - 鍚勭被Context鐨勭户鎵垮叧绯 - context-inheritance + + ![context-inheritance](figures/context-inheritance.png) - 鍚勭被Context鐨勬寔鏈夊叧绯 - context-holding + + ![context-holding](figures/context-holding.png) - 鍚勭被Context鐨勮幏鍙栨柟寮 - 鑾峰彇[UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md)銆傛瘡涓猆IAbility涓兘鍖呭惈浜嗕竴涓狢ontext灞炴э紝鎻愪緵鎿嶄綔Ability銆佽幏鍙朅bility鐨勯厤缃俊鎭佸簲鐢ㄥ悜鐢ㄦ埛鐢宠鎺堟潈绛夎兘鍔涖 @@ -93,8 +95,9 @@ 鑾峰彇璺緞鐨勮兘鍔涙槸鍩虹被Context涓彁渚涚殑鑳藉姏锛屽洜姝ゅ湪ApplicationContext銆丄bilityStageContext銆乁IAbilityContext鍜孍xtensionContext涓潎鍙互鑾峰彇锛屽湪鍚勭被Context涓幏鍙栧埌鐨勮矾寰勪細鏈変竴浜涘樊鍒紝鍏蜂綋宸埆濡備笅鍥炬墍绀恒 - **鍥1** Context涓幏鍙栫殑搴旂敤寮鍙戣矾寰 -context-dir + **鍥1** Context涓幏鍙栫殑搴旂敤寮鍙戣矾寰 + + ![context-dir](figures/context-dir.png) - 閫氳繃ApplicationContext鑾峰彇鐨勫簲鐢ㄧ骇鍒矾寰勩傚簲鐢ㄥ叏灞淇℃伅寤鸿瀛樻斁鐨勮矾寰勶紝瀛樻斁鍦ㄦ璺緞鐨勬枃浠跺唴瀹逛粎鍦ㄥ簲鐢ㄥ嵏杞芥椂浼氳鍒犻櫎銆 | 灞炴 | 璺緞 | @@ -306,4 +309,5 @@ export default class EntryAbility extends UIAbility { 搴旂敤闇瑕佽幏鍙栫敤鎴风殑闅愮淇℃伅鎴栦娇鐢ㄧ郴缁熻兘鍔涙椂锛屼緥濡傝幏鍙栦綅缃俊鎭佽闂棩鍘嗐佷娇鐢ㄧ浉鏈烘媿鎽勭収鐗囨垨褰曞埗瑙嗛绛夛紝闇瑕佸悜鐢ㄦ埛鐢宠鎺堟潈锛岀ず鎰忔晥鏋滃涓嬪浘鎵绀恒傚叿浣撲娇鐢ㄨ鍙傝[璁块棶鎺у埗鎺堟潈鐢宠鎸囧](../security/accesstoken-guidelines.md)銆 **鍥2** 鍚戠敤鎴风敵璇锋棩鍘嗚闂巿鏉 -application-context-stage \ No newline at end of file + + ![application-context-stage](figures/application-context-stage.png) \ No newline at end of file diff --git a/zh-cn/application-dev/application-models/data-share-via-want.md b/zh-cn/application-dev/application-models/data-share-via-want.md index 7ae2b4b8c3aa94cda0fadc6c6f8b2d31339e3133..ec4e6012e937474f2e2866dde4ca7af7aee33e0e 100644 --- a/zh-cn/application-dev/application-models/data-share-via-want.md +++ b/zh-cn/application-dev/application-models/data-share-via-want.md @@ -65,7 +65,8 @@ - "ability.picker.fileNames"涓"ability.picker.fileSizes"涓烘暟缁勶紝鍏舵湁涓涓瀵瑰簲鍏崇郴銆 渚嬪锛氬綋"ability.picker.type"涓衡渁pplication/pdf鈥濓紝"ability.picker.fileNames"涓衡淸"鎺ュ彛鏂囨。.pdf"]鈥濓紝"ability.picker.fileSizes"涓衡淸350 \* 1024]鈥濇椂锛屽簲鐢ㄩ夋嫨鍣ㄥ皢浠ヤ笅褰㈠紡灞曠ず銆 - stage-want2 + + ![stage-want2](figures/stage-want2.png) 绀轰緥浠g爜涓渁bility.want.params.INTENT鈥濆瓧娈垫槸涓涓祵濂梂ant锛屽唴閮ㄦ墍鍚玜ction銆乼ype绛夊瓧娈靛皢鐢卞簲鐢ㄩ夋嫨鍣ㄨ繘琛岄殣寮忓尮閰嶏紝鍏蜂綋闅愬紡鍖归厤瑙勫垯鍙弬鑰僛闅愬紡Want鍖归厤鍘熺悊璇﹁В](explicit-implicit-want-mappings.md#闅愬紡want鍖归厤鍘熺悊璇﹁В)銆傚綋鐢ㄦ埛閫夋嫨鍏蜂綋搴旂敤鍚庯紝鈥渁bility.want.params.INTENT鈥濆瓧娈电殑宓屽Want灏嗕紶閫掕嚦鎵閫夊簲鐢ㄣ diff --git a/zh-cn/application-dev/application-models/dataability-overview.md b/zh-cn/application-dev/application-models/dataability-overview.md index 40a2b556a376ace6c5f4eb9dcc77d052ae175c22..376f203c98d79c7fd346daee34aa100a03351c33 100644 --- a/zh-cn/application-dev/application-models/dataability-overview.md +++ b/zh-cn/application-dev/application-models/dataability-overview.md @@ -8,3 +8,9 @@ DataAbility锛屽嵆"浣跨敤Data妯℃澘鐨凙bility"锛屼富瑕佺敤浜庡澶栭儴鎻愪緵缁 鏁版嵁鐨勫瓨鏀惧舰寮忓鏍凤紝鍙互鏄暟鎹簱锛屼篃鍙互鏄鐩樹笂鐨勬枃浠躲侱ataAbility瀵瑰鎻愪緵瀵规暟鎹殑澧炪佸垹銆佹敼銆佹煡锛屼互鍙婃墦寮鏂囦欢绛夋帴鍙o紝杩欎簺鎺ュ彛鐨勫叿浣撳疄鐜扮敱寮鍙戣呮彁渚涖 + +## 鐩稿叧瀹炰緥 + +鍩轰簬DataAbility缁勪欢鐨勫紑鍙戯紝浠ヤ笅鐩稿叧瀹炰緥鍙緵鍙傝冿細 + +- [`DataAbility`锛欴ataAbility鐨勫垱寤轰笌璁块棶锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/DataAbility) \ No newline at end of file diff --git a/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md b/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md index ab6878dc57b170c1eac98c6482a497189a0b7765..9634afc64125c334541bac3ae66b5b84ee6f9ade 100644 --- a/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md +++ b/zh-cn/application-dev/application-models/explicit-implicit-want-mappings.md @@ -59,7 +59,9 @@ - 璋冪敤鏂逛紶鍏ョ殑want鍙傛暟鐨刟ction涓嶄负绌猴紝寰呭尮閰岮bility鐨剆kills閰嶇疆涓殑actions涓嶄负绌轰笖涓嶅寘鍚皟鐢ㄦ柟浼犲叆鐨剋ant鍙傛暟鐨刟ction锛屽垯action鍖归厤澶辫触銆 - **鍥1** want鍙傛暟鐨刟ction鍖归厤瑙勫垯聽聽want-action + **鍥1** want鍙傛暟鐨刟ction鍖归厤瑙勫垯 + + ![want-action](figures/want-action.png) ### want鍙傛暟鐨別ntities鍖归厤瑙勫垯 @@ -76,16 +78,18 @@ - 璋冪敤鏂逛紶鍏ョ殑want鍙傛暟鐨別ntities涓嶄负绌猴紝寰呭尮閰岮bility鐨剆kills閰嶇疆涓殑entities涓嶄负绌轰笖涓嶅畬鍏ㄥ寘鍚皟鐢ㄦ柟浼犲叆鐨剋ant鍙傛暟鐨別ntities锛屽垯entities鍖归厤澶辫触銆 - **鍥2** want鍙傛暟鐨別ntities鍖归厤瑙勫垯 -want-entities + **鍥2** want鍙傛暟鐨別ntities鍖归厤瑙勫垯 + + ![want-entities](figures/want-entities.png) ### want鍙傛暟鐨剈ri鍜宼ype鍖归厤瑙勫垯 璋冪敤鏂逛紶鍏ョ殑want鍙傛暟涓缃畊ri鍜宼ype鍙傛暟鍙戣捣缁勪欢鍚姩璇锋眰锛岀郴缁熶細閬嶅巻褰撳墠绯荤粺宸插畨瑁呯殑缁勪欢鍒楄〃锛屽苟閫愪釜鍖归厤寰呭尮閰岮bility鐨剆kills閰嶇疆涓殑uris鏁扮粍锛屽鏋滃緟鍖归厤Ability鐨剆kills閰嶇疆涓殑uris鏁扮粍涓彧瑕佹湁涓涓彲浠ュ尮閰嶈皟鐢ㄦ柟浼犲叆鐨剋ant鍙傛暟涓缃殑uri鍜宼ype鍗充负鍖归厤鎴愬姛銆 - **鍥3** want鍙傛暟涓璾ri鍜宼ype鐨嗕笉涓虹┖鏃剁殑鍖归厤瑙勫垯 -want-uri-type1 + **鍥3** want鍙傛暟涓璾ri鍜宼ype鐨嗕笉涓虹┖鏃剁殑鍖归厤瑙勫垯 + + ![want-uri-type1](figures/want-uri-type1.png) 瀹為檯搴旂敤涓紝uri鍜宼ype鍏卞瓨鍦ㄥ洓绉嶆儏鍐碉紝涓嬮潰灏嗚瑙e洓绉嶆儏鍐电殑鍏蜂綋鍖归厤瑙勫垯锛 @@ -110,8 +114,9 @@ 涓嬪浘涓轰簡绠鍖栨弿杩帮紝绉皐ant涓紶鍏ョ殑uri涓簑_uri锛岀Оwant涓紶鍏ョ殑type涓簑_type, 寰呭尮閰岮bility鐨剆kills閰嶇疆涓璾ris涓簊_uris锛屽叾涓瘡涓厓绱犱负s_uri锛涙寜鑷笂鑰屼笅椤哄簭鍖归厤銆 - **鍥4** want鍙傛暟涓璾ri鍜宼ype鐨勫叿浣撳尮閰嶈鍒 -want-uri-type2 + **鍥4** want鍙傛暟涓璾ri鍜宼ype鐨勫叿浣撳尮閰嶈鍒 + +![want-uri-type2](figures/want-uri-type2.png) ### uri鍖归厤瑙勫垯 diff --git a/zh-cn/application-dev/application-models/inter-device-interaction-hop-overview.md b/zh-cn/application-dev/application-models/inter-device-interaction-hop-overview.md index ebed9309715fb41bfda47bf8ff6555dea63c483d..ab47c350f8e422d02da43f1a109cedc3f2d17c45 100644 --- a/zh-cn/application-dev/application-models/inter-device-interaction-hop-overview.md +++ b/zh-cn/application-dev/application-models/inter-device-interaction-hop-overview.md @@ -35,8 +35,9 @@ OpenHarmony娴佽浆鎻愪緵浜嗕竴缁凙PI搴擄紝鍙鐢ㄦ埛搴旂敤绋嬪簭鏇磋交鏉俱佸揩 娴佽浆鏋舵瀯濡備笅鍥炬墍绀恒 - **鍥1** 娴佽浆鏋舵瀯鍥 -hop-structure + **鍥1** 娴佽浆鏋舵瀯鍥 + + ![hop-structure](figures/hop-structure.png) - 璺ㄧ杩佺Щ浠诲姟绠$悊锛氬湪杩佺Щ鍙戣捣绔紝鎺ュ彈鐢ㄦ埛杩佺Щ鐨勬剰鍥撅紝鎻愪緵杩佺Щ娴佽浆鍏ュ彛锛岃縼绉荤粨鏋滄樉绀虹瓑鑳藉姏銆傦紙璇ヨ兘鍔涘皻鏈瀯寤恒傦級 diff --git a/zh-cn/application-dev/application-models/serviceextensionability.md b/zh-cn/application-dev/application-models/serviceextensionability.md index 163ec6b69b3fe1c308ae68e2648e75f04b6e5097..5234b4971dd4aaeccc2d9810c9bfc7ede4e2152c 100644 --- a/zh-cn/application-dev/application-models/serviceextensionability.md +++ b/zh-cn/application-dev/application-models/serviceextensionability.md @@ -287,4 +287,5 @@ ServiceExtensionAbility鏈嶅姟缁勪欢鍦╗onConnect()](../reference/apis/js-apis-ap 閽堝ServiceExtensionAbility寮鍙戯紝鏈変互涓嬬浉鍏崇ず渚嬪彲渚涘弬鑰冿細 -[ServiceExtAbility锛歋tageExtAbility鐨勫垱寤轰笌浣跨敤锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ServiceExtAbility) +- [`AbilityConnectServiceExtension`锛欰bility涓嶴erviceExtensionAbility閫氫俊锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/AbilityConnectServiceExtension) +- [`ServiceExtAbility`锛歋tageExtAbility鐨勫垱寤轰笌浣跨敤锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ability/ServiceExtAbility) diff --git a/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md b/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md index b7f3c97e2b976f1ad74591d3c2c39f798efd3ceb..edd0cd1c80f2b139d3c90bfe1aae372d130b64bd 100644 --- a/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md +++ b/zh-cn/application-dev/application-models/uiability-data-sync-with-ui.md @@ -92,7 +92,8 @@ EventHub鎻愪緵浜哢IAbility缁勪欢/ExtensionAbility缁勪欢绾у埆鐨勪簨浠舵満鍒讹紝 globalThis鏄疉rkTS寮曟搸瀹炰緥鍐呴儴鐨勪竴涓叏灞瀵硅薄锛屽紩鎿庡唴閮ㄧ殑UIAbility/ExtensionAbility/Page閮藉彲浠ヤ娇鐢紝鍥犳鍙互浣跨敤globalThis鍏ㄥ眬瀵硅薄杩涜鏁版嵁鍚屾銆 **鍥1** 浣跨敤globalThis杩涜鏁版嵁鍚屾 -globalThis1 + + ![globalThis1](figures/globalThis1.png) 濡備笂鍥炬墍绀猴紝涓嬮潰浠庡涓嬩笁涓満鏅拰涓涓敞鎰忕偣鏉ヤ粙缁峠lobalThis鐨勪娇鐢細 @@ -209,6 +210,7 @@ globalThis涓篬ArkTS寮曟搸瀹炰緥](thread-model-stage.md)涓嬬殑鍏ㄥ眬瀵硅薄锛屽彲 ### globalThis浣跨敤鐨勬敞鎰忎簨椤 **鍥2** globalThis娉ㄦ剰浜嬮」 + ![globalThis2](figures/globalThis2.png) - Stage妯″瀷涓嬭繘绋嬪唴鐨刄IAbility缁勪欢鍏变韩ArkTS寮曟搸瀹炰緥锛屼娇鐢╣lobalThis鏃堕渶瑕侀伩鍏嶅瓨鏀剧浉鍚屽悕绉扮殑瀵硅薄銆備緥濡侫bilityA鍜孉bilityB鍙互浣跨敤globalThis鍏变韩鏁版嵁锛屽湪瀛樻斁鐩稿悓鍚嶇О鐨勫璞℃椂锛屽厛瀛樻斁鐨勫璞′細琚悗瀛樻斁鐨勫璞¤鐩栥 diff --git a/zh-cn/application-dev/application-models/uiability-intra-device-interaction.md b/zh-cn/application-dev/application-models/uiability-intra-device-interaction.md index b1269e79b7b90a9da7d6782ad405ff51182caa76..e4e601703a0d09f219472bbf94aa4ea9f877f344 100644 --- a/zh-cn/application-dev/application-models/uiability-intra-device-interaction.md +++ b/zh-cn/application-dev/application-models/uiability-intra-device-interaction.md @@ -196,7 +196,8 @@ UIAbility鏄郴缁熻皟搴︾殑鏈灏忓崟鍏冦傚湪璁惧鍐呯殑鍔熻兘妯″潡涔嬮棿璺 ``` 鏁堟灉绀烘剰濡備笅鍥炬墍绀猴紝鐐瑰嚮鈥滄墦寮PDF鏂囨。鈥濇椂锛屼細寮瑰嚭閫夋嫨妗嗕緵鐢ㄦ埛閫夋嫨銆 - uiability-intra-device-interaction + + ![uiability-intra-device-interaction](figures/uiability-intra-device-interaction.png) 3. 鍦ㄦ枃妗e簲鐢ㄤ娇鐢ㄥ畬鎴愪箣鍚庯紝濡傞渶瑕佸仠姝㈠綋鍓峌IAbility瀹炰緥锛岄氳繃璋冪敤terminateSelf()鏂规硶瀹炵幇銆 @@ -441,8 +442,9 @@ Call璋冪敤鐨勪娇鐢ㄥ満鏅富瑕佸寘鎷細 Call璋冪敤绀烘剰鍥惧涓嬫墍绀恒 - **鍥1** Call璋冪敤绀烘剰鍥 -call + **鍥1** Call璋冪敤绀烘剰鍥 + + ![call](figures/call.png) - CallerAbility璋冪敤startAbilityByCall鎺ュ彛鑾峰彇Caller锛屽苟浣跨敤Caller瀵硅薄鐨刢all鏂规硶鍚慍alleeAbility鍙戦佹暟鎹 diff --git a/zh-cn/application-dev/application-models/uiability-launch-type.md b/zh-cn/application-dev/application-models/uiability-launch-type.md index 3a243f08750269e021c491f1cb1727e9c29d9074..181ebbd249cd898b5d4d46745cb9b79c9161fcf9 100644 --- a/zh-cn/application-dev/application-models/uiability-launch-type.md +++ b/zh-cn/application-dev/application-models/uiability-launch-type.md @@ -17,8 +17,9 @@ singleton鍚姩妯″紡涓哄崟瀹炰緥妯″紡锛屼篃鏄粯璁ゆ儏鍐典笅鐨勫惎鍔ㄦā寮 姣忔璋冪敤startAbility()鏂规硶鏃讹紝濡傛灉搴旂敤杩涚▼涓绫诲瀷鐨刄IAbility瀹炰緥宸茬粡瀛樺湪锛屽垯澶嶇敤绯荤粺涓殑UIAbility瀹炰緥銆傜郴缁熶腑鍙瓨鍦ㄥ敮涓涓涓UIAbility瀹炰緥锛屽嵆鍦ㄦ渶杩戜换鍔″垪琛ㄤ腑鍙瓨鍦ㄤ竴涓绫诲瀷鐨刄IAbility瀹炰緥銆 - **鍥1** 鍗曞疄渚嬫ā寮忔紨绀烘晥鏋 -uiability-launch-type1 + **鍥1** 鍗曞疄渚嬫ā寮忔紨绀烘晥鏋 + + ![uiability-launch-type1](figures/uiability-launch-type1.png) > ![icon-note.gif](public_sys-resources/icon-note.gif) **璇存槑锛** > 搴旂敤鐨刄IAbility瀹炰緥宸插垱寤猴紝璇IAbility閰嶇疆涓哄崟瀹炰緥妯″紡锛屽啀娆¤皟鐢╯tartAbility()鏂规硶鍚姩璇IAbility瀹炰緥锛屾鏃跺彧浼氳繘鍏ヨUIAbility鐨刐onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)鍥炶皟锛屼笉浼氳繘鍏ュ叾onCreate()鍜宱nWindowStageCreate()鐢熷懡鍛ㄦ湡鍥炶皟銆 @@ -45,8 +46,9 @@ singleton鍚姩妯″紡涓哄崟瀹炰緥妯″紡锛屼篃鏄粯璁ゆ儏鍐典笅鐨勫惎鍔ㄦā寮 standard鍚姩妯″紡涓烘爣鍑嗗疄渚嬫ā寮忥紝姣忔璋冪敤startAbility()鏂规硶鏃讹紝閮戒細鍦ㄥ簲鐢ㄨ繘绋嬩腑鍒涘缓涓涓柊鐨勮绫诲瀷UIAbility瀹炰緥銆傚嵆鍦ㄦ渶杩戜换鍔″垪琛ㄤ腑鍙互鐪嬪埌鏈夊涓绫诲瀷鐨刄IAbility瀹炰緥銆傝繖绉嶆儏鍐典笅鍙互灏哢IAbility閰嶇疆涓簊tandard锛堟爣鍑嗗疄渚嬫ā寮忥級銆 - **鍥2** 鏍囧噯瀹炰緥妯″紡婕旂ず鏁堟灉 -standard-mode + **鍥2** 鏍囧噯瀹炰緥妯″紡婕旂ず鏁堟灉 + + ![standard-mode](figures/standard-mode.png) standard鍚姩妯″紡鐨勫紑鍙戜娇鐢紝鍦╗module.json5閰嶇疆鏂囦欢](../quick-start/module-configuration-file.md)涓殑"launchType"瀛楁閰嶇疆涓"standard"鍗冲彲銆 @@ -72,8 +74,9 @@ specified鍚姩妯″紡涓烘寚瀹氬疄渚嬫ā寮忥紝閽堝涓浜涚壒娈婂満鏅娇鐢紙 鍦║IAbility瀹炰緥鍒涘缓涔嬪墠锛屽厑璁稿紑鍙戣呬负璇ュ疄渚嬪垱寤轰竴涓敮涓鐨勫瓧绗︿覆Key锛屽垱寤虹殑UIAbility瀹炰緥缁戝畾Key涔嬪悗锛屽悗缁瘡娆¤皟鐢╯tartAbility()鏂规硶鏃讹紝閮戒細璇㈤棶搴旂敤浣跨敤鍝釜Key瀵瑰簲鐨刄IAbility瀹炰緥鏉ュ搷搴攕tartAbility()璇锋眰銆傝繍琛屾椂鐢盪IAbility鍐呴儴涓氬姟鍐冲畾鏄惁鍒涘缓澶氬疄渚嬶紝濡傛灉鍖归厤鏈夎UIAbility瀹炰緥鐨凨ey锛屽垯鐩存帴鎷夎捣涓庝箣缁戝畾鐨刄IAbility瀹炰緥锛屽惁鍒欏垱寤轰竴涓柊鐨刄IAbility瀹炰緥銆 - **鍥3** 鎸囧畾瀹炰緥妯″紡婕旂ず鏁堟灉 -uiability-launch-type2 + **鍥3** 鎸囧畾瀹炰緥妯″紡婕旂ず鏁堟灉 + + ![uiability-launch-type2](figures/uiability-launch-type2.png) > ![icon-note.gif](public_sys-resources/icon-note.gif) **璇存槑锛** > 搴旂敤鐨刄IAbility瀹炰緥宸插垱寤猴紝璇IAbility閰嶇疆涓烘寚瀹氬疄渚嬫ā寮忥紝鍐嶆璋冪敤startAbility()鏂规硶鍚姩璇IAbility瀹炰緥锛屼笖[AbilityStage](abilitystage.md)鐨刐onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant)鍥炶皟鍖归厤鍒颁竴涓凡鍒涘缓鐨刄IAbility瀹炰緥銆傛鏃讹紝鍐嶆鍚姩璇IAbility鏃讹紝鍙細杩涘叆璇IAbility鐨刐onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)鍥炶皟锛屼笉浼氳繘鍏ュ叾onCreate()鍜宱nWindowStageCreate()鐢熷懡鍛ㄦ湡鍥炶皟銆 diff --git a/zh-cn/application-dev/application-models/uiability-lifecycle.md b/zh-cn/application-dev/application-models/uiability-lifecycle.md index 068b56748aef275ea1b3438911bf75f4a50eabdf..d05dcdf641aa0eff21cbd2d942a251c06481f502 100644 --- a/zh-cn/application-dev/application-models/uiability-lifecycle.md +++ b/zh-cn/application-dev/application-models/uiability-lifecycle.md @@ -7,8 +7,9 @@ UIAbility鐨勭敓鍛藉懆鏈熷寘鎷珻reate銆丗oreground銆丅ackground銆丏estroy鍥涗釜鐘舵侊紝濡備笅鍥炬墍绀恒 - **鍥1** UIAbility鐢熷懡鍛ㄦ湡鐘舵 -Ability-Life-Cycle + **鍥1** UIAbility鐢熷懡鍛ㄦ湡鐘舵 + + ![Ability-Life-Cycle](figures/Ability-Life-Cycle.png) ## 鐢熷懡鍛ㄦ湡鐘舵佽鏄 @@ -36,8 +37,9 @@ export default class EntryAbility extends UIAbility { UIAbility瀹炰緥鍒涘缓瀹屾垚涔嬪悗锛屽湪杩涘叆Foreground涔嬪墠锛岀郴缁熶細鍒涘缓涓涓猈indowStage銆俉indowStage鍒涘缓瀹屾垚鍚庝細杩涘叆onWindowStageCreate()鍥炶皟锛屽彲浠ュ湪璇ュ洖璋冧腑璁剧疆UI鐣岄潰鍔犺浇銆佽缃甒indowStage鐨勪簨浠惰闃呫 - **鍥2** WindowStageCreate鍜學indowStageDestory鐘舵 -Ability-Life-Cycle-WindowStage + **鍥2** WindowStageCreate鍜學indowStageDestory鐘舵 + + ![Ability-Life-Cycle-WindowStage](figures/Ability-Life-Cycle-WindowStage.png) 鍦╫nWindowStageCreate()鍥炶皟涓氳繃loadContent()鏂规硶璁剧疆搴旂敤瑕佸姞杞界殑椤甸潰骞舵牴鎹渶瑕佽闃匴indowStage鐨刐浜嬩欢](../reference/apis/js-apis-window.md#windowstageeventtype9)锛堣幏鐒/澶辩劍銆佸彲瑙/涓嶅彲瑙侊級銆 diff --git a/zh-cn/application-dev/application-models/want-overview.md b/zh-cn/application-dev/application-models/want-overview.md index 6fae778dd8951cb648d0f4cb00612d3a136941d8..9162336c8578dead65e5c6bfa74ddead3e636061 100644 --- a/zh-cn/application-dev/application-models/want-overview.md +++ b/zh-cn/application-dev/application-models/want-overview.md @@ -5,9 +5,9 @@ [Want](../reference/apis/js-apis-app-ability-want.md)鏄璞¢棿淇℃伅浼犻掔殑杞戒綋锛屽彲浠ョ敤浜庡簲鐢ㄧ粍浠堕棿鐨勪俊鎭紶閫掋傚叾浣跨敤鍦烘櫙涔嬩竴鏄綔涓簊tartAbility()鐨勫弬鏁帮紝鍖呭惈浜嗘寚瀹氱殑鍚姩鐩爣浠ュ強鍚姩鏃堕渶鎼哄甫鐨勭浉鍏虫暟鎹紝濡俠undleName鍜宎bilityName瀛楁鍒嗗埆鎸囨槑鐩爣Ability鎵鍦ㄥ簲鐢ㄧ殑鍖呭悕浠ュ強瀵瑰簲鍖呭唴鐨凙bility鍚嶇О銆傚綋UIAbilityA鍚姩UIAbilityB骞堕渶瑕佷紶鍏ヤ竴浜涙暟鎹粰UIAbilityB鏃讹紝Want鍙互浣滀负涓涓浇浣撳皢鏁版嵁浼犵粰UIAbilityB銆 - **鍥1** Want鐢ㄦ硶绀烘剰 -usage-of-want + **鍥1** Want鐢ㄦ硶绀烘剰 + ![usage-of-want](figures/usage-of-want.png) ## Want鐨勭被鍨 diff --git a/zh-cn/application-dev/connectivity/socket-connection.md b/zh-cn/application-dev/connectivity/socket-connection.md index 2c04d2270a2f2b9c0e9a4551fe06bd1d91483620..815b0fde28387264cf5cf0c6effe7d27f8c44c44 100644 --- a/zh-cn/application-dev/connectivity/socket-connection.md +++ b/zh-cn/application-dev/connectivity/socket-connection.md @@ -125,6 +125,6 @@ UDP涓嶵CP娴佺▼澶т綋绫讳技锛屼笅闈互TCP涓轰緥锛 ## 鐩稿叧瀹炰緥 閽堝Socket杩炴帴寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 -- [`Socket`锛歋ocket 杩炴帴锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Socket) +- [`Socket`锛歋ocket 杩炴帴锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Socket) - [浣跨敤UDP瀹炵幇涓庢湇鍔$閫氫俊锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/UdpDemoOH) - [浣跨敤TCP瀹炵幇涓庢湇鍔$閫氫俊锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/TcpSocketDemo) \ No newline at end of file diff --git a/zh-cn/application-dev/database/database-preference-guidelines.md b/zh-cn/application-dev/database/database-preference-guidelines.md index 6094421564b42b230011e98f1f66a55e0f239b0c..32584c975dd0ff29d479478bd08672abe4742751 100644 --- a/zh-cn/application-dev/database/database-preference-guidelines.md +++ b/zh-cn/application-dev/database/database-preference-guidelines.md @@ -208,4 +208,6 @@ 閽堝棣栭夐」寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 -- [`Preferences`锛氶閫夐」锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/data/Preferences) \ No newline at end of file +- [`Preferences`锛氶閫夐」锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/data/Preferences) + +- [棣栭夐」锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Data/Preferences) \ No newline at end of file diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index 46f40d627eb8894fc3ce46167965f2d446a018ee..7c2cb97f3eab54bb3e8db5f746d32ab408474306 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -423,5 +423,9 @@ ## 鐩稿叧瀹炰緥 閽堝鍏崇郴鍨嬫暟鎹簱寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 + - [`DistributedRdb`锛氬垎甯冨紡鍏崇郴鍨嬫暟鎹簱锛圓rkTS锛夛紙API8锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/data/DistributedRdb) -- [鍏崇郴鍨嬫暟鎹簱锛圝S锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Data/JSRelationshipData) \ No newline at end of file + +- [鍏崇郴鍨嬫暟鎹簱锛圝S锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/Data/JSRelationshipData) + +- [鍏崇郴鍨嬫暟鎹簱锛圓rkS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Data/Rdb) \ No newline at end of file diff --git a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-overview.md b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-overview.md index 4957e7a992b873fc1063325ea5e8e9a61df00e5a..ae2026a593a8d6fe32793e008890babbd6434519 100644 --- a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-overview.md +++ b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-overview.md @@ -36,5 +36,5 @@ 瑙i櫎娉ㄥ唽搴旂敤鍒嗙粍鍙樺寲鍥炶皟鐩戝惉銆 ## 璁惧浣跨敤淇℃伅缁熻浣跨敤鏉冮檺 -- 璁惧浣跨敤淇℃伅缁熻鐨剄ueryBundleActiveStates銆乹ueryBundleStateInfos銆乹ueryBundleStateInfoByInterval銆乹ueryBundleActiveEventStates銆乹ueryAppNotificationNumber銆乹ueryAppUsagePriorityGroup(bundleName?)銆乻etBundleGroup銆乺egisterGroupCallBack銆乽nRegisterGroupCallBack鎺ュ彛涓虹郴缁焌pi锛岃皟鐢ㄥ墠闇瑕佺敵璇穙hos.permission.BUNDLE_ACTIVE_INFO鏉冮檺銆 -- 璁惧浣跨敤淇℃伅缁熻鐨剄ueryCurrentBundleActiveStates銆乹ueryAppUsagePriorityGroup()銆乮sIdleState锛堜笁鏂瑰簲鐢ㄥ彧鑳芥煡璇㈣嚜韬殑绌洪棽鐘舵侊級鎺ュ彛涓轰笁鏂筧pi锛岃皟鐢ㄦ椂涓嶉渶瑕佺敵璇锋潈闄愩 \ No newline at end of file +- 璁惧浣跨敤淇℃伅缁熻鐨刬sIdleState銆乹ueryBundleEvents銆乹ueryBundleStatsInfos銆乹ueryBundleStatsInfoByInterval銆乹ueryDeviceEventStats銆乹ueryNotificationEventStats銆乹ueryAppGroup(bundleName)銆乻etAppGroup銆乺egisterAppGroupCallBack銆乽nregisterAppGroupCallBack銆乹ueryModuleUsageRecords鍜宷ueryModuleUsageRecords(maxnum)鎺ュ彛涓虹郴缁焌pi锛岃皟鐢ㄥ墠闇瑕佺敵璇穙hos.permission.BUNDLE_ACTIVE_INFO鏉冮檺銆 +- 璁惧浣跨敤淇℃伅缁熻鐨剄ueryCurrentBundleEvents銆乹ueryAppGroup()鎺ュ彛涓轰笁鏂筧pi锛岃皟鐢ㄦ椂涓嶉渶瑕佺敵璇锋潈闄愩 \ No newline at end of file diff --git a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md index 86d25a09c14a0e3759e9fa52fd0befa7a2f4e34a..117ca956e802ceaa635f352d650333095f3cccdc 100644 --- a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md +++ b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md @@ -227,7 +227,7 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics'; } ``` -7. 鍒ゆ柇鎸囧畾Bundle Name鐨勫簲鐢ㄥ綋鍓嶆槸鍚︽槸绌洪棽鐘舵侊紝涓嶉渶瑕侀厤缃潈闄愶紝涓夋柟搴旂敤鍙兘鏌ヨ鑷韩鐨勭┖闂茬姸鎬併 +7. 鍒ゆ柇鎸囧畾Bundle Name鐨勫簲鐢ㄥ綋鍓嶆槸鍚︽槸绌洪棽鐘舵侊紝闇瑕侀厤缃畂hos.permission.BUNDLE_ACTIVE_INFO鏉冮檺銆 ```js import usageStatistics from '@ohos.resourceschedule.usageStatistics' diff --git a/zh-cn/application-dev/dfx/apprecovery-guidelines.md b/zh-cn/application-dev/dfx/apprecovery-guidelines.md index 515bb3e23c3fcf646e6fe3de63f00509460ae3f8..b7e0d4fedbdc0a2c3a43c9b8e5b1bb7dd8f3e58b 100644 --- a/zh-cn/application-dev/dfx/apprecovery-guidelines.md +++ b/zh-cn/application-dev/dfx/apprecovery-guidelines.md @@ -29,7 +29,7 @@ **restartApp:** 璋冪敤鍚庢鏋朵細鏉姝诲綋鍓嶅簲鐢ㄨ繘绋嬶紝骞堕噸鏂版媺璧峰浜庡墠鍙扮殑Ability锛屽叾涓惎鍔ㄥ師鍥犱负APP_RECOVERY銆 -### 妗嗘灦鏁呴殰绠$悊鐞嗘祦绋嬬ず鎰 +### 妗嗘灦鏁呴殰绠$悊娴佺▼绀烘剰 鏁呴殰绠$悊鏄簲鐢ㄦ彁鍗囩敤鎴蜂綋楠岀殑閲嶈鎵嬫銆傚簲鐢ㄧ▼搴忔鏋朵负寮鍙戣呮彁渚涗簡鏁呴殰鐩戝惉銆佹晠闅滄仮澶嶃佷互鍙婃晠闅滄煡璇笁绉嶆柟寮忔潵绠$悊搴旂敤鐨勬晠闅溿 @@ -133,7 +133,7 @@ callback瑙﹀彂appRecovery.saveAppState()璋冪敤鍚庯紝浼氳Е鍙慚ainAbility鐨刼nSav - 鏁版嵁鎭㈠ -callback瑙﹀彂鍚巃ppRecovery.restartApp()璋冪敤鍚庯紝搴旂敤浼氶噸鍚紝閲嶅惎鍚庝細璧板埌MainAbility鐨刼nSaveState(state, wantParams)鍑芥暟锛屼繚瀛樼殑鏁版嵁浼氬湪want鍙傛暟鐨刾arameters閲屻 +callback瑙﹀彂鍚巃ppRecovery.restartApp()璋冪敤鍚庯紝搴旂敤浼氶噸鍚紝閲嶅惎鍚庝細璧板埌MainAbility鐨刼nCreate(want, launchParam)鍑芥暟锛屼繚瀛樼殑鏁版嵁浼氬湪want鍙傛暟鐨刾arameters閲屻 ```ts storage: LocalStorage diff --git a/zh-cn/application-dev/dfx/errormanager-guidelines.md b/zh-cn/application-dev/dfx/errormanager-guidelines.md index c93a73b14c35d9cfdab8b0081d6890f6889705c3..08395a122256cab207296c4271b710e388e11863 100644 --- a/zh-cn/application-dev/dfx/errormanager-guidelines.md +++ b/zh-cn/application-dev/dfx/errormanager-guidelines.md @@ -37,10 +37,10 @@ ## 寮鍙戠ず渚 ```ts import Ability from '@ohos.application.Ability' -import errorManager from '@ohos.application.errorManager' +import errorManager from '@ohos.app.ability.errorManager'; -var registerId = -1; -var callback = { +let registerId = -1; +let callback = { onUnhandledException: function (errMsg) { console.log(errMsg); } @@ -49,13 +49,13 @@ var callback = { export default class MainAbility extends Ability { onCreate(want, launchParam) { console.log("[Demo] MainAbility onCreate") - registerId = errorManager.registerErrorObserver(callback); + registerId = errorManager.on("error", callback); globalThis.abilityWant = want; } onDestroy() { console.log("[Demo] MainAbility onDestroy") - errorManager.unregisterErrorObserver(registerId, (result) => { + errorManager.off("error", registerId, (result) => { console.log("[Demo] result " + result.code + ";" + result.message) }); } diff --git a/zh-cn/application-dev/media/image.md b/zh-cn/application-dev/media/image.md index e4050515a516db43743a58b56a72705a1fb3c44b..82f9e05e82459fdb541853b4b6155c7acd1edf5a 100644 --- a/zh-cn/application-dev/media/image.md +++ b/zh-cn/application-dev/media/image.md @@ -286,5 +286,5 @@ public async init(surfaceId: any) { 閽堝鍥剧墖寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 -- [`Image`锛氬浘鐗囧鐞嗭紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/media/Image) +- [`Image`锛氬浘鐗囧鐞嗭紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/media/Image) - [`GamePuzzle`锛氭嫾鍥撅紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/media/GamePuzzle) \ No newline at end of file diff --git a/zh-cn/application-dev/media/video-playback.md b/zh-cn/application-dev/media/video-playback.md index ea6044a54b0774ebd6954839a29b931874e0558a..7f8586dede5e4700319f05928c4e3666663f1351 100644 --- a/zh-cn/application-dev/media/video-playback.md +++ b/zh-cn/application-dev/media/video-playback.md @@ -452,4 +452,4 @@ export class VideoPlayerDemo { 閽堝瑙嗛鎾斁寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 - [`VideoPlayer:`瑙嗛鎾斁锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/media/VideoPlayer) -- [瑙嗛鎾斁鍣紙ArkTS锛夛紙API 9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Media/VideoPlayerStage) \ No newline at end of file +- [瑙嗛鎾斁鍣紙ArkTS锛夛紙Full SDK锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Media/VideoPlayerStage) \ No newline at end of file diff --git a/zh-cn/application-dev/notification/notification-overview.md b/zh-cn/application-dev/notification/notification-overview.md index 52b4b5881588c37c7d449a235d2446b8d739b955..50525376aabb0a39bae6b303bd3fb29c7a84c3bf 100644 --- a/zh-cn/application-dev/notification/notification-overview.md +++ b/zh-cn/application-dev/notification/notification-overview.md @@ -25,3 +25,11 @@ OpenHarmony閫氳繃ANS锛圓dvanced Notification Service锛岄氱煡绯荤粺鏈嶅姟锛夊 绯荤粺搴旂敤杩樻敮鎸侀氱煡鐩稿叧閰嶇疆锛屽浣胯兘寮鍏炽侀厤缃弬鏁扮敱绯荤粺閰嶇疆鍙戣捣璇锋眰锛屽彂閫佸埌閫氱煡瀛愮郴缁熷瓨鍌ㄥ埌鍐呭瓨鍜屾暟鎹簱銆 ![zh-cn_image_0000001466582017](figures/zh-cn_image_0000001466582017.png) + +## 鐩稿叧瀹炰緥 + +鍩轰簬閫氱煡鐨勫紑鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 + +- [`CustomNotification`锛氳嚜瀹氫箟閫氱煡锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/CustomNotification) + +- [`Notification`锛氳闃呫佸彂閫侀氱煡锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/Notification) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md index daa313f03ac4e5a095acf2cdc86ffc9e95d17b94..c71cc797f35cbb52acd9e232069d308c67ffc44e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md @@ -30,8 +30,8 @@ class MainAbility extends Ability { | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | -| abilityInfo | AbilityInfo | 鏄 | 鍚 | Abilityinfo鐩稿叧淇℃伅 | -| currentHapModuleInfo | HapModuleInfo | 鏄 | 鍚 | 褰撳墠hap鍖呯殑淇℃伅 | +| abilityInfo | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | 鏄 | 鍚 | Abilityinfo鐩稿叧淇℃伅 | +| currentHapModuleInfo | [HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) | 鏄 | 鍚 | 褰撳墠hap鍖呯殑淇℃伅 | | config | [Configuration](js-apis-application-configuration.md) | 鏄 | 鍚 | 琛ㄧず閰嶇疆淇℃伅銆 | ## AbilityContext.startAbility @@ -40,6 +40,11 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; 鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** @@ -89,6 +94,11 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& 鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** @@ -142,6 +152,11 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; 鍚姩Ability锛坧romise褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** @@ -198,7 +213,12 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; -鍚姩Ability骞跺湪璇bility閫鍑虹殑鏃跺欒繑鍥炴墽琛岀粨鏋滐紙callback褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#abilitycontextterminateselfwithresult)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙callback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -248,7 +268,12 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; -鍚姩Ability骞跺湪璇bility閫鍑虹殑鏃跺欒繑鍥炴墽琛岀粨鏋滐紙callback褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#abilitycontextterminateselfwithresult)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙callback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -303,7 +328,12 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; -鍚姩Ability骞跺湪璇bility閫鍑虹殑鏃跺欒繑鍥炴墽琛岀粨鏋滐紙promise褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#abilitycontextterminateselfwithresult)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙promise褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -363,6 +393,11 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC 鍚姩涓涓狝bility骞跺湪璇bility甯愬彿閿姣佹椂杩斿洖鎵ц缁撴灉锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 璺ㄥ簲鐢ㄥ満鏅笅锛岀洰鏍嘇bility鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **闇瑕佹潈闄**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -375,7 +410,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-want.md) | 鏄 | 鍚姩Ability鐨剋ant淇℃伅銆 | | accountId | number | 鏄 | 绯荤粺甯愬彿鐨勫笎鍙稩D锛岃鎯呭弬鑰僛getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess)銆 | -| callback | AsyncCallback\ | 鏄 | 鍚姩Ability鐨勫洖璋冨嚱鏁帮紝杩斿洖Ability缁撴灉銆 | +| callback | AsyncCallback\<[AbilityResult](js-apis-inner-ability-abilityResult.md)\> | 鏄 | 鍚姩Ability鐨勫洖璋冨嚱鏁帮紝杩斿洖Ability缁撴灉銆 | **閿欒鐮侊細** @@ -420,6 +455,11 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp 鍚姩涓涓狝bility骞跺湪璇bility甯愬彿閿姣佹椂杩斿洖鎵ц缁撴灉锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **闇瑕佹潈闄**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -481,6 +521,11 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO 鍚姩涓涓狝bility骞跺湪璇bility甯愬彿閿姣佹椂杩斿洖鎵ц缁撴灉锛坧romise褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **闇瑕佹潈闄**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -499,7 +544,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO | 绫诲瀷 | 璇存槑 | | -------- | -------- | -| Promise<AbilityResult> | 杩斿洖涓涓狿romise锛屽寘鍚獳bility缁撴灉銆 | +| Promise<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | 杩斿洖涓涓狿romise锛屽寘鍚獳bility缁撴灉銆 | **閿欒鐮侊細** @@ -1034,7 +1079,7 @@ terminateSelf(): Promise<void>; terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; -鍋滄Ability锛岄厤鍚坰tartAbilityForResult浣跨敤锛岃繑鍥炵粰鎺ュ彛璋冪敤鏂笰bilityResult淇℃伅锛坈allback褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility銆傚鏋滆Ability鏄氳繃璋冪敤[startAbilityForResult](#abilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵細灏嗙粨鏋滆繑鍥炵粰璋冪敤鑰咃紝濡傛灉璇bility涓嶆槸閫氳繃璋冪敤[startAbilityForResult](#abilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵笉浼氭湁缁撴灉杩斿洖缁欒皟鐢ㄨ咃紙callback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1090,6 +1135,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi terminateSelfWithResult(parameter: AbilityResult): Promise<void>; 鍋滄Ability锛岄厤鍚坰tartAbilityForResult浣跨敤锛岃繑鍥炵粰鎺ュ彛璋冪敤鏂笰bilityResult淇℃伅锛坧romise褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility銆傚鏋滆Ability鏄氳繃璋冪敤[startAbilityForResult](#abilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵細灏嗙粨鏋滆繑鍥炵粰璋冪敤鑰咃紝濡傛灉璇bility涓嶆槸閫氳繃璋冪敤[startAbilityForResult](#abilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵笉浼氭湁缁撴灉杩斿洖缁欒皟鐢ㄨ咃紙promise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1361,6 +1407,11 @@ startAbilityByCall(want: Want): Promise<Caller>; 鍚姩鎸囧畾Ability鑷冲墠鍙版垨鍚庡彴锛屽悓鏃惰幏鍙栧叾Caller閫氫俊鎺ュ彛锛岃皟鐢ㄦ柟鍙娇鐢–aller涓庤鍚姩鐨凙bility杩涜閫氫俊銆 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 @@ -1450,6 +1501,11 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< 鏍规嵁account鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **闇瑕佹潈闄**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1506,6 +1562,11 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca 鏍规嵁account鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **闇瑕佹潈闄**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1566,6 +1627,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): 鏍规嵁account鍚姩Ability锛圥romise褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **闇瑕佹潈闄**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1685,7 +1751,7 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| icon | image.PixelMap | 鏄 | 鍦ㄦ渶杩戠殑浠诲姟涓樉绀虹殑ability鍥炬爣銆 | +| icon | [image.PixelMap](js-apis-image.md#pixelmap7) | 鏄 | 鍦ㄦ渶杩戠殑浠诲姟涓樉绀虹殑ability鍥炬爣銆 | | callback | AsyncCallback\ | 鏄 | 鎸囧畾鐨勫洖璋冨嚱鏁扮殑缁撴灉銆 | **绀轰緥锛** @@ -1727,7 +1793,7 @@ setMissionIcon(icon: image.PixelMap): Promise\; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| icon | image.PixelMap | 鏄 | 鍦ㄦ渶杩戠殑浠诲姟涓樉绀虹殑ability鍥炬爣銆 | +| icon | [image.PixelMap](js-apis-image.md#pixelmap7) | 鏄 | 鍦ㄦ渶杩戠殑浠诲姟涓樉绀虹殑ability鍥炬爣銆 | **杩斿洖鍊硷細** diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-dataUriUtils.md b/zh-cn/application-dev/reference/apis/js-apis-ability-dataUriUtils.md index 2a85d32b2cc1970813fa8685d34227161915e7f7..0d5aaf26a22bdc5cd384f4412131cbbd1e2dec6b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-dataUriUtils.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-dataUriUtils.md @@ -1,6 +1,6 @@ # @ohos.ability.dataUriUtils (DataUriUtils妯″潡) -DataUriUtils妯″潡鎻愪緵鐢ㄤ簬澶勭悊浣跨敤DataAbilityHelper鏂规鐨勫璞$殑瀹炵敤绋嬪簭绫荤殑鑳藉姏锛屽寘鎷幏鍙栵紝娣诲姞锛屾洿鏂扮粰瀹歶ri鐨勮矾寰勭粍浠舵湯灏剧殑ID銆 +DataUriUtils妯″潡鎻愪緵鐢ㄤ簬澶勭悊uri瀵硅薄鐨勮兘鍔涳紝鍖呮嫭鑾峰彇銆佺粦瀹氥佸垹闄ゅ拰鏇存柊鎸囧畾uri瀵硅薄鐨勮矾寰勬湯灏剧殑ID銆傛湰妯″潡灏嗚app.ability.dataUriUtils妯″潡鏇夸唬锛屽缓璁紭鍏堜娇鐢╗@ohos.app.ability.dataUriUtils](js-apis-app-ability-dataUriUtils.md)妯″潡銆 > **璇存槑锛** > @@ -16,7 +16,7 @@ import dataUriUtils from '@ohos.ability.dataUriUtils'; getId(uri: string): number -鑾峰彇闄勫姞鍒扮粰瀹歶ri鐨勮矾寰勭粍浠舵湯灏剧殑ID銆 +鑾峰彇鎸囧畾uri璺緞鏈熬鐨処D銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -24,18 +24,18 @@ getId(uri: string): number | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------ | ---- | --------------------------- | -| uri | string | 鏄 | 鎸囩ず瑕佷粠涓幏鍙朓D鐨剈ri瀵硅薄銆 | +| uri | string | 鏄 | 琛ㄧずuri瀵硅薄銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ------ | ------------------------ | -| number | 闄勫姞鍒拌矾寰勭粍浠舵湯灏剧殑ID銆 | +| number | 杩斿洖uri璺緞鏈熬鐨処D銆 | **绀轰緥锛** ```ts -dataUriUtils.getId("com.example.dataUriUtils/1221") +let id = dataUriUtils.getId("com.example.dataUriUtils/1221"); ``` @@ -44,7 +44,7 @@ dataUriUtils.getId("com.example.dataUriUtils/1221") attachId(uri: string, id: number): string -灏嗙粰瀹欼D闄勫姞鍒扮粰瀹歶ri鐨勮矾寰勭粍浠剁殑鏈熬銆 +灏咺D闄勫姞鍒皍ri鐨勮矾寰勬湯灏俱 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -52,22 +52,22 @@ attachId(uri: string, id: number): string | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------ | ---- | --------------------------- | -| uri | string | 鏄 | 鎸囩ず瑕佷粠涓幏鍙朓D鐨剈ri瀵硅薄銆 | -| id | number | 鏄 | 鎸囩ず瑕侀檮鍔犵殑ID銆 | +| uri | string | 鏄 | 琛ㄧずuri瀵硅薄銆 | +| id | number | 鏄 | 琛ㄧず瑕侀檮鍔犵殑ID銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ------ | --------------------- | -| string | 闄勫姞缁欏畾ID鐨剈ri瀵硅薄銆 | +| string | 杩斿洖闄勫姞ID涔嬪悗鐨剈ri瀵硅薄銆 | **绀轰緥锛** ```ts -var idint = 1122; -dataUriUtils.attachId( +let id = 1122; +let uri = dataUriUtils.attachId( "com.example.dataUriUtils", - idint, + id, ) ``` @@ -77,7 +77,7 @@ dataUriUtils.attachId( deleteId(uri: string): string -浠庣粰瀹歶ri鐨勮矾寰勭粍浠剁殑鏈熬鍒犻櫎ID銆 +鍒犻櫎鎸囧畾uri璺緞鏈熬鐨処D銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -85,18 +85,18 @@ deleteId(uri: string): string | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------ | ---- | --------------------------- | -| uri | string | 鏄 | 鎸囩ず瑕佷粠涓垹闄D鐨剈ri瀵硅薄銆 | +| uri | string | 鏄 | 琛ㄧず瑕佷粠涓垹闄D鐨剈ri瀵硅薄銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ------ | ------------------- | -| string | ID宸插垹闄ょ殑uri瀵硅薄銆 | +| string | 杩斿洖鍒犻櫎ID涔嬪悗鐨剈ri瀵硅薄銆 | **绀轰緥锛** ```ts -dataUriUtils.deleteId("com.example.dataUriUtils/1221") +let uri = dataUriUtils.deleteId("com.example.dataUriUtils/1221") ``` @@ -113,22 +113,22 @@ updateId(uri: string, id: number): string | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------ | ---- | ------------------- | -| uri | string | 鏄 | 鎸囩ず瑕佹洿鏂扮殑uri瀵硅薄 | -| id | number | 鏄 | 鎸囩ず鏂癐D | +| uri | string | 鏄 | 琛ㄧずuri瀵硅薄 | +| id | number | 鏄 | 琛ㄧず瑕佹洿鏂扮殑ID | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ------ | --------------- | -| string | 鏇存柊鐨剈ri瀵硅薄銆 | +| string | 杩斿洖鏇存柊ID涔嬪悗鐨剈ri瀵硅薄銆 | **绀轰緥锛** ```ts -var idint = 1122; -dataUriUtils.updateId( - "com.example.dataUriUtils", - idint +let id = 1122; +let uri = dataUriUtils.updateId( + "com.example.dataUriUtils/1221", + id ) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-errorCode.md b/zh-cn/application-dev/reference/apis/js-apis-ability-errorCode.md index cc7f3cd647ad9875d302343fe152ecad4b3c47bd..b66275351ef87e69938efc7cbc1a743efe44b7b2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-errorCode.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-errorCode.md @@ -1,8 +1,6 @@ # @ohos.ability.errorCode (ErrorCode) -ErrorCode鏄畾涔夊惎鍔ㄥ姛鑳芥椂浣跨敤鐨勯敊璇唬鐮併 - -鏈ā鍧楁彁渚涗娇鐢ㄧ殑閿欒浠g爜鐨勮兘鍔涳紝鍖呮嫭娌℃湁閿欒锛屾棤鏁堢殑鍙傛暟绛夈 +ErrorCode瀹氫箟鍚姩Ability鏃惰繑鍥炵殑閿欒鐮侊紝鍖呮嫭鏃犳晥鐨勫弬鏁般佹潈闄愭嫆缁濈瓑銆 > **璇存槑锛** > @@ -16,13 +14,13 @@ import errorCode from '@ohos.ability.errorCode' ## ErrorCode -瀹氫箟鍚姩鍔熻兘鏃朵娇鐢ㄧ殑閿欒浠g爜銆 +瀹氫箟鍚姩Ability鏃惰繑鍥炵殑閿欒鐮併 **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core | 鍚嶇О | 鍊 | 璇存槑 | | ------------------------------ | ---- | ---------------------------------------- | -| NO_ERROR | 0 | 娌℃湁閿欒銆 | +| NO_ERROR | 0 | 娌℃湁寮傚父銆 | | INVALID_PARAMETER | -1 | 鏃犳晥鐨勫弬鏁般 | | ABILITY_NOT_FOUND | -2 | 鎵句笉鍒癆BILITY銆 | -| PERMISSION_DENY | -3 | 鎷掔粷璁稿彲銆 | \ No newline at end of file +| PERMISSION_DENY | -3 | 鏉冮檺鎷掔粷銆 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md b/zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md index 580f5f20ab040d0b779bf8843f59e8f070007ece..5f4b00d60a2e22c3ff7ffceefa2719e58399f683 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md @@ -1,6 +1,6 @@ # @ohos.ability.featureAbility (FeatureAbility妯″潡) -FeatureAbility妯″潡鎻愪緵甯︽湁UI璁捐涓庣敤鎴蜂氦浜掔殑鑳藉姏锛屽寘鎷惎鍔ㄦ柊鐨刟bility銆佽幏鍙杁ataAbilityHelper銆佽缃Page Ability銆佽幏鍙栧綋鍓岮bility瀵瑰簲鐨勭獥鍙o紝杩炴帴鏈嶅姟绛夈 +FeatureAbility妯″潡鎻愪緵涓庣敤鎴疯繘琛屼氦浜掔殑Ability鐨勮兘鍔涳紝鍖呮嫭鍚姩鏂扮殑Ability銆佸仠姝bility銆佽幏鍙杁ataAbilityHelper瀵硅薄銆佽幏鍙栧綋鍓岮bility瀵瑰簲鐨勭獥鍙o紝杩炴帴鏂繛Service绛夈 > **璇存槑锛** > @@ -9,7 +9,7 @@ FeatureAbility妯″潡鎻愪緵甯︽湁UI璁捐涓庣敤鎴蜂氦浜掔殑鑳藉姏锛屽寘鎷惎鍔 ## 浣跨敤闄愬埗 -FeatureAbility妯″潡鐨勬帴鍙e彧鑳藉湪Page绫诲瀷鐨凙bility璋冪敤 +FeatureAbility妯″潡鐨勬帴鍙e彧鑳藉湪Page绫诲瀷鐨凙bility涓皟鐢 ## 瀵煎叆妯″潡 @@ -21,7 +21,12 @@ import featureAbility from '@ohos.ability.featureAbility'; startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\): void -鍚姩鏂扮殑ability锛坈allback褰㈠紡锛夈 +鍚姩鏂扮殑Ability锛坈allback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛團A妯″瀷锛塢(../../application-models/component-startup-rules-fa.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -30,13 +35,13 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\) | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ---------------------------------------- | ---- | -------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 琛ㄧず琚惎鍔ㄧ殑Ability銆 | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炲惎鍔ˋbility鐨勭粨鏋溿 | **绀轰緥锛** ```ts import featureAbility from '@ohos.ability.featureAbility'; -import wantConstant from '@ohos.ability.wantConstant'; +import wantConstant from '@ohos.app.ability.wantConstant'; featureAbility.startAbility( { want: @@ -48,7 +53,7 @@ featureAbility.startAbility( deviceId: "", bundleName: "com.example.myapplication", /* FA妯″瀷涓璦bilityName鐢眕ackage + Ability name缁勬垚 */ - abilityName: "com.example.entry.secondAbility", + abilityName: "com.example.myapplication.secondAbility", uri: "" }, }, @@ -64,7 +69,12 @@ featureAbility.startAbility( startAbility(parameter: StartAbilityParameter): Promise\ -鍚姩鏂扮殑ability锛圥romise褰㈠紡锛夈 +鍚姩鏂扮殑Ability锛圥romise褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛團A妯″瀷锛塢(../../application-models/component-startup-rules-fa.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -74,11 +84,17 @@ startAbility(parameter: StartAbilityParameter): Promise\ | --------- | ---------------------------------------- | ---- | -------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 琛ㄧず琚惎鍔ㄧ殑Ability銆 | +**杩斿洖鍊硷細** + +| 绫诲瀷 | 璇存槑 | +| ---------------------------------------- | ------- | +| Promise\ | Promise褰㈠紡杩斿洖鍚姩Ability缁撴灉銆 | + **绀轰緥锛** ```ts import featureAbility from '@ohos.ability.featureAbility'; -import wantConstant from '@ohos.ability.wantConstant'; +import wantConstant from '@ohos.app.ability.wantConstant'; featureAbility.startAbility( { want: @@ -90,7 +106,7 @@ featureAbility.startAbility( deviceId: "", bundleName: "com.example.myapplication", /* FA妯″瀷涓璦bilityName鐢眕ackage + Ability name缁勬垚 */ - abilityName: "com.example.entry.secondAbility", + abilityName: "com.example.myapplication.secondAbility", uri: "" }, } @@ -103,7 +119,7 @@ featureAbility.startAbility( acquireDataAbilityHelper(uri: string): DataAbilityHelper -鑾峰彇dataAbilityHelper銆 +鑾峰彇dataAbilityHelper瀵硅薄銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -111,13 +127,13 @@ acquireDataAbilityHelper(uri: string): DataAbilityHelper | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------ | ---- | ------------ | -| uri | string | 鏄 | 鎸囩ず瑕佹墦寮鐨勬枃浠剁殑璺緞銆 | +| uri | string | 鏄 | 琛ㄧず瑕佹墦寮鐨勬枃浠剁殑璺緞銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ----------------- | ------------------------------- | -| DataAbilityHelper | 鐢ㄦ潵鍗忓姪鍏朵粬Ability璁块棶DataAbility鐨勫伐鍏风被銆 | +| [DataAbilityHelper](js-apis-inner-ability-dataAbilityHelper.md) | 鐢ㄦ潵鍗忓姪鍏朵粬Ability璁块棶DataAbility鐨勫伐鍏风被銆 | **绀轰緥锛** @@ -132,7 +148,12 @@ var dataAbilityHelper = featureAbility.acquireDataAbilityHelper( startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback\): void -鍚姩涓涓猘bility锛屽苟鍦ㄨability琚攢姣佹椂杩斿洖鎵ц缁撴灉锛坈allback褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#featureabilityterminateselfwithresult7)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙callback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛團A妯″瀷锛塢(../../application-models/component-startup-rules-fa.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -141,13 +162,13 @@ startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback\ | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ---------------------------------------- | ---- | -------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 琛ㄧず琚惎鍔ㄧ殑Ability銆 | -| callback | AsyncCallback\<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | +| callback | AsyncCallback\<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | 鏄 | 浠allback鐨勫舰寮忚繑鍥炲惎鍔ˋbility缁撴灉銆 | **绀轰緥锛** ```ts import featureAbility from '@ohos.ability.featureAbility'; -import wantConstant from '@ohos.ability.wantConstant'; +import wantConstant from '@ohos.app.ability.wantConstant'; featureAbility.startAbilityForResult( { want: @@ -159,7 +180,7 @@ featureAbility.startAbilityForResult( deviceId: "", bundleName: "com.example.myapplication", /* FA妯″瀷涓璦bilityName鐢眕ackage + Ability name缁勬垚 */ - abilityName: "com.example.entry.secondAbility", + abilityName: "com.example.myapplication.secondAbility", uri:"" }, }, @@ -173,7 +194,12 @@ featureAbility.startAbilityForResult( startAbilityForResult(parameter: StartAbilityParameter): Promise\ -鍚姩涓涓猘bility锛屽苟鍦ㄨability琚攢姣佹椂杩斿洖鎵ц缁撴灉锛圥romise褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#featureabilityterminateselfwithresult7)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙Promise褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛團A妯″瀷锛塢(../../application-models/component-startup-rules-fa.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -187,13 +213,13 @@ startAbilityForResult(parameter: StartAbilityParameter): Promise\ | 绫诲瀷 | 璇存槑 | | ---------------------------------------- | ------- | -| Promise\<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | 杩斿洖鎵ц缁撴灉銆 | +| Promise\<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Promise褰㈠紡杩斿洖鍚姩Ability缁撴灉銆 | **绀轰緥锛** ```ts import featureAbility from '@ohos.ability.featureAbility'; -import wantConstant from '@ohos.ability.wantConstant'; +import wantConstant from '@ohos.app.ability.wantConstant'; featureAbility.startAbilityForResult( { want: @@ -205,7 +231,7 @@ featureAbility.startAbilityForResult( deviceId: "", bundleName: "com.example.myapplication", /* FA妯″瀷涓璦bilityName鐢眕ackage + Ability name缁勬垚 */ - abilityName: "com.example.entry.secondAbility", + abilityName: "com.example.myapplication.secondAbility", uri:"", parameters: { @@ -229,7 +255,7 @@ featureAbility.startAbilityForResult( terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\): void -璁剧疆姝age Ability灏嗚繑鍥炵粰璋冪敤鑰呯殑缁撴灉浠g爜鍜屾暟鎹苟鐮村潖姝age Ability锛坈allback褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility銆傚鏋滆Ability鏄氳繃璋冪敤[startAbilityForResult](#featureabilitystartabilityforresult7)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵細灏嗙粨鏋滆繑鍥炵粰璋冪敤鑰咃紝濡傛灉璇bility涓嶆槸閫氳繃璋冪敤[startAbilityForResult](#featureabilitystartabilityforresult7)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵笉浼氭湁缁撴灉杩斿洖缁欒皟鐢ㄨ咃紙callback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -237,14 +263,14 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\ | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ------------------------------- | ---- | -------------- | -| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 鏄 | 琛ㄧず琚惎鍔ㄧ殑Ability銆 | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | +| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 鏄 | 琛ㄧず鍋滄Ability涔嬪悗杩斿洖鐨勭粨鏋溿 | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炲仠姝bility缁撴灉銆 | **绀轰緥锛** ```ts import featureAbility from '@ohos.ability.featureAbility'; -import wantConstant from '@ohos.ability.wantConstant'; +import wantConstant from '@ohos.app.ability.wantConstant'; featureAbility.terminateSelfWithResult( { resultCode: 1, @@ -257,7 +283,7 @@ featureAbility.terminateSelfWithResult( deviceId: "", bundleName: "com.example.myapplication", /* FA妯″瀷涓璦bilityName鐢眕ackage + Ability name缁勬垚 */ - abilityName: "com.example.entry.secondAbility", + abilityName: "com.example.myapplication.secondAbility", uri:"", parameters: { mykey0: 2222, @@ -281,7 +307,7 @@ featureAbility.terminateSelfWithResult( terminateSelfWithResult(parameter: AbilityResult): Promise\ -璁剧疆姝age Ability灏嗚繑鍥炵粰璋冪敤鑰呯殑缁撴灉浠g爜鍜屾暟鎹苟鐮村潖姝age Ability锛圥romise褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility銆傚鏋滆Ability鏄氳繃璋冪敤[startAbilityForResult](#featureabilitystartabilityforresult7)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵細灏嗙粨鏋滆繑鍥炵粰璋冪敤鑰咃紝濡傛灉璇bility涓嶆槸閫氳繃璋冪敤[startAbilityForResult](#featureabilitystartabilityforresult7)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵笉浼氭湁缁撴灉杩斿洖缁欒皟鐢ㄨ咃紙Promise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -289,19 +315,19 @@ terminateSelfWithResult(parameter: AbilityResult): Promise\ | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ------------------------------- | ---- | ------------- | -| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 鏄 | 琛ㄧず琚惎鍔ㄧ殑Ability | +| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 鏄 | 琛ㄧず鍋滄Ability涔嬪悗杩斿洖鐨勭粨鏋 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | -------------- | --------------- | -| Promise\ | 浠romise褰㈠紡杩斿洖缁撴灉銆 | +| Promise\ | 浠romise褰㈠紡杩斿洖鍋滄褰撳墠Ability缁撴灉銆 | **绀轰緥锛** ```ts import featureAbility from '@ohos.ability.featureAbility'; -import wantConstant from '@ohos.ability.wantConstant'; +import wantConstant from '@ohos.app.ability.wantConstant'; featureAbility.terminateSelfWithResult( { resultCode: 1, @@ -314,7 +340,7 @@ featureAbility.terminateSelfWithResult( deviceId: "", bundleName: "com.example.myapplication", /* FA妯″瀷涓璦bilityName鐢眕ackage + Ability name缁勬垚 */ - abilityName: "com.example.entry.secondAbility", + abilityName: "com.example.myapplication.secondAbility", uri:"", parameters: { mykey0: 2222, @@ -345,7 +371,7 @@ hasWindowFocus(callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | ----------------------- | ---- | ---------------------------------------- | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆
濡傛灉姝bility褰撳墠鍏锋湁瑙嗙獥鐒︾偣锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆 | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炵粨鏋溿
濡傛灉姝bility褰撳墠鍏锋湁瑙嗙獥鐒︾偣锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆 | **绀轰緥锛** @@ -368,7 +394,7 @@ hasWindowFocus(): Promise\ | 绫诲瀷 | 璇存槑 | | ----------------- | ------------------------------------- | -| Promise\ | 濡傛灉姝bility褰撳墠鍏锋湁瑙嗙獥鐒︾偣锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆 | +| Promise\ | Promise褰㈠紡杩斿洖缁撴灉锛屽鏋滄Ability褰撳墠鍏锋湁瑙嗙獥鐒︾偣锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆 | **绀轰緥锛** @@ -383,7 +409,7 @@ featureAbility.hasWindowFocus().then((data) => { getWant(callback: AsyncCallback\): void -鑾峰彇浠嶢bility鍙戦佺殑Want锛坈allback褰㈠紡锛夈 +鑾峰彇瑕佹媺璧风殑Ability瀵瑰簲鐨刉ant锛坈allback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -391,7 +417,7 @@ getWant(callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | ----------------------------- | ---- | --------- | -| callback | AsyncCallback\<[Want](js-apis-application-want.md)> | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | +| callback | AsyncCallback\<[Want](js-apis-application-want.md)> | 鏄 | 浠allback鐨勫舰寮忚繑鍥瀢ant銆 | **绀轰緥锛** @@ -406,7 +432,7 @@ featureAbility.getWant((err, data) => { getWant(): Promise\ -鑾峰彇浠嶢bility鍙戦佺殑Want锛圥romise褰㈠紡锛夈 +鑾峰彇瑕佹媺璧风殑Ability瀵瑰簲鐨刉ant锛圥romise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -414,7 +440,7 @@ getWant(): Promise\ | 绫诲瀷 | 璇存槑 | | ----------------------- | ---------------- | -| Promise\<[Want](js-apis-application-want.md)> | 浠romise鐨勫舰寮忚繑鍥炵粨鏋溿 | +| Promise\<[Want](js-apis-application-want.md)> | 浠romise鐨勫舰寮忚繑鍥瀢ant銆 | **绀轰緥锛** @@ -453,7 +479,7 @@ context.getBundleName((err, data) => { terminateSelf(callback: AsyncCallback\): void -璁剧疆Page Ability杩斿洖缁欒璋冪敤鏂圭殑缁撴灉浠g爜鍜屾暟鎹紝骞堕攢姣佹Page Ability锛坈allback褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility锛坈allback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -461,7 +487,7 @@ terminateSelf(callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------------------- | ---- | -------- | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶 | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炲仠姝㈠綋鍓岮bility缁撴灉 | **绀轰緥锛** @@ -478,7 +504,7 @@ featureAbility.terminateSelf( terminateSelf(): Promise\ -璁剧疆Page Ability杩斿洖缁欒璋冪敤鏂圭殑缁撴灉浠g爜鍜屾暟鎹紝骞堕攢姣佹Page Ability锛圥romise褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility锛圥romise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -486,7 +512,7 @@ terminateSelf(): Promise\ | 绫诲瀷 | 璇存槑 | | -------------- | ---------------- | -| Promise\ | 浠romise鐨勫舰寮忚繑鍥炵粨鏋溿 | +| Promise\ | 浠romise鐨勫舰寮忚繑鍥炲仠姝㈠綋鍓岮bility缁撴灉銆 | **绀轰緥锛** @@ -501,7 +527,7 @@ featureAbility.terminateSelf().then((data) => { connectAbility(request: Want, options:ConnectOptions): number -灏嗗綋鍓峚bility杩炴帴鍒版寚瀹歋erviceAbility锛坈allback褰㈠紡锛夈 +灏嗗綋鍓岮bility涓庢寚瀹氱殑ServiceAbility杩涜杩炴帴銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -510,13 +536,13 @@ connectAbility(request: Want, options:ConnectOptions): number | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------- | -------------- | ---- | --------------------- | | request | [Want](js-apis-application-want.md) | 鏄 | 琛ㄧず琚繛鎺ョ殑ServiceAbility銆 | -| options | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | +| options | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | 鏄 | 琛ㄧず杩炴帴鍥炶皟鍑芥暟銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ------ | -------------------- | -| number | 杩炴帴鐨凷erviceAbilityID銆 | +| number | 杩炴帴鐨凷erviceAbility鐨処D(ID浠0寮濮嬭嚜澧烇紝姣忚繛鎺ユ垚鍔熶竴娆D鍔1)銆 | **绀轰緥锛** @@ -536,7 +562,7 @@ var connectId = featureAbility.connectAbility( { deviceId: "", bundleName: "com.ix.ServiceAbility", - abilityName: "ServiceAbilityA", + abilityName: "com.ix.ServiceAbility.ServiceAbilityA", }, { onConnect: onConnectCallback, @@ -558,8 +584,8 @@ disconnectAbility(connection: number, callback:AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---------- | -------------------- | ---- | ----------------------- | -| connection | number | 鏄 | 鎸囧畾鏂紑杩炴帴鐨凷erviceAbilityID | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶 | +| connection | number | 鏄 | 琛ㄧず鏂紑杩炴帴鐨凷erviceAbility鐨処D | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炴柇寮杩炴帴缁撴灉 | **绀轰緥锛** @@ -578,7 +604,7 @@ function onFailedCallback(code){ var connectId = featureAbility.connectAbility( { bundleName: "com.ix.ServiceAbility", - abilityName: "ServiceAbilityA", + abilityName: "com.ix.ServiceAbility.ServiceAbilityA", }, { onConnect: onConnectCallback, @@ -605,13 +631,13 @@ disconnectAbility(connection: number): Promise\ | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---------- | ------ | ---- | ----------------------- | -| connection | number | 鏄 | 鎸囧畾鏂紑杩炴帴鐨凷erviceAbilityID | +| connection | number | 鏄 | 琛ㄧず鏂紑杩炴帴鐨凷erviceAbility鐨処D | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | -------------- | --------------- | -| Promise\ | 浠romise褰㈠紡杩斿洖缁撴灉銆 | +| Promise\ | 浠romise褰㈠紡杩斿洖鏂紑杩炴帴缁撴灉銆 | **绀轰緥锛** @@ -630,7 +656,7 @@ function onFailedCallback(code){ var connectId = featureAbility.connectAbility( { bundleName: "com.ix.ServiceAbility", - abilityName: "ServiceAbilityA", + abilityName: "com.ix.ServiceAbility.ServiceAbilityA", }, { onConnect: onConnectCallback, @@ -659,7 +685,7 @@ getWindow(callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | ----------------------------- | ---- | ----------------------------- | -| callback | AsyncCallback\ | 鏄 | 杩斿洖涓庡綋鍓岮bility瀵瑰簲鐨勭獥鍙c | +| callback | AsyncCallback\<[window.Window](js-apis-window.md#window)> | 鏄 | callback褰㈠紡杩斿洖褰撳墠Ability瀵瑰簲鐨勭獥鍙c | **绀轰緥锛** @@ -681,7 +707,7 @@ getWindow(): Promise\; | 绫诲瀷 | 璇存槑 | | ----------------------- | ----------------------------- | -| Promise\ | 杩斿洖涓庡綋鍓岮bility瀵瑰簲鐨勭獥鍙c | +| Promise\<[window.Window](js-apis-window.md#window)> | Promise褰㈠紡杩斿洖褰撳墠Ability瀵瑰簲鐨勭獥鍙c | **绀轰緥锛** @@ -693,7 +719,7 @@ featureAbility.getWindow().then((data) => { ## AbilityWindowConfiguration -浣跨敤鏃堕氳繃featureAbility.AbilityWindowConfiguration鑾峰彇銆 +琛ㄧず褰撳墠Ability瀵瑰簲鐨勭獥鍙i厤缃」锛屼娇鐢ㄦ椂閫氳繃featureAbility.AbilityWindowConfiguration鑾峰彇銆 **绀轰緥锛** @@ -707,14 +733,14 @@ featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED | ---------------------------------------- | ---- | ---------------------------------------- | | WINDOW_MODE_UNDEFINED7+ | 0 | 鏈畾涔夈 | | WINDOW_MODE_FULLSCREEN7+ | 1 | 鍏ㄥ睆銆 | -| WINDOW_MODE_SPLIT_PRIMARY7+ | 100 | 鍒嗗睆涓诲睆銆 | -| WINDOW_MODE_SPLIT_SECONDARY7+ | 101 | 鍒嗗睆娆″睆銆 | +| WINDOW_MODE_SPLIT_PRIMARY7+ | 100 | 灞忓箷濡傛灉鏄按骞虫柟鍚戣〃绀哄乏鍒嗗睆锛屽睆骞曞鏋滄槸绔栫洿鏂瑰悜琛ㄧず涓婂垎灞忋 | +| WINDOW_MODE_SPLIT_SECONDARY7+ | 101 | 灞忓箷濡傛灉鏄按骞虫柟鍚戣〃绀哄彸鍒嗗睆锛屽睆骞曞鏋滄槸绔栫洿鏂瑰悜琛ㄧず涓嬪垎灞忋 | | WINDOW_MODE_FLOATING7+ | 102 | 鎮诞绐椼 | ## AbilityStartSetting -abilityStartSetting灞炴ф槸涓涓畾涔変负[key: string]: any鐨勫璞★紝key瀵瑰簲璁惧畾绫诲瀷涓猴細AbilityStartSetting鏋氫妇绫诲瀷锛寁alue瀵瑰簲璁惧畾绫诲瀷涓猴細AbilityWindowConfiguration鏋氫妇绫诲瀷銆 +琛ㄧず褰撳墠Ability瀵瑰簲鐨勭獥鍙e睘鎬э紝abilityStartSetting灞炴ф槸涓涓畾涔変负[key: string]: any鐨勫璞★紝key瀵瑰簲璁惧畾绫诲瀷涓猴細AbilityStartSetting鏋氫妇绫诲瀷锛寁alue瀵瑰簲璁惧畾绫诲瀷涓猴細AbilityWindowConfiguration鏋氫妇绫诲瀷銆 浣跨敤鏃堕氳繃featureAbility.AbilityStartSetting鑾峰彇銆 @@ -734,7 +760,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY ## ErrorCode -鑾峰彇閿欒浠g爜銆 +琛ㄧず閿欒鐮併 **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.FAModel @@ -742,13 +768,13 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY | ------------------------------ | ---- | ---------------------------------------- | | NO_ERROR7+ | 0 | 娌℃湁閿欒銆 | | INVALID_PARAMETER7+ | -1 | 鏃犳晥鐨勫弬鏁般 | -| ABILITY_NOT_FOUND7+ | -2 | 鎵句笉鍒拌兘鍔涖 | -| PERMISSION_DENY7+ | -3 | 鎷掔粷璁稿彲銆 | +| ABILITY_NOT_FOUND7+ | -2 | 鎵句笉鍒癆BILITY銆 | +| PERMISSION_DENY7+ | -3 | 鏉冮檺鎷掔粷銆 | ## DataAbilityOperationType -鎸囩ず鏁版嵁鐨勬搷浣滅被鍨嬨 +琛ㄧず鏁版嵁鐨勬搷浣滅被鍨嬨侱ataAbility鎵归噺鎿嶄綔鏁版嵁鏃跺彲浠ラ氳繃璇ユ灇涓惧兼寚瀹氭搷浣滅被鍨 **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.FAModel @@ -761,24 +787,26 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY ## flags璇存槑 +琛ㄧず澶勭悊Want鐨勬柟寮忋 + **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase | 鍚嶇О | 鍊 | 璇存槑 | | ------------------------------------ | ---------- | ---------------------------------------- | -| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | 鎸囩ず瀵筓RI鎵ц璇诲彇鎿嶄綔鐨勬巿鏉冦 | -| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | 鎸囩ず瀵筓RI鎵ц鍐欏叆鎿嶄綔鐨勬巿鏉冦 | -| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 灏嗙粨鏋滆繑鍥炵粰鍏冭兘鍔涖 | -| FLAG_ABILITY_CONTINUATION | 0x00000008 | 纭畾鏄惁鍙互灏嗘湰鍦拌澶囦笂鐨勫姛鑳借縼绉诲埌杩滅▼璁惧銆 | -| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | 鎸囧畾缁勪欢鏄惁灞炰簬OHOS銆 | -| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | 鎸囧畾鏄惁鍚姩鏌愪釜鑳藉姏銆 | -| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | 鎸囩ずURI涓婂彲鑳芥寔涔呭寲鐨勬巿鏉冦
**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 | -| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | 鎸夌収鍓嶇紑鍖归厤鐨勬柟寮忛獙璇乁RI鏉冮檺銆
**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 | -| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | 鏀寔鍒嗗竷寮忚皟搴︾郴缁熶腑鐨勫璁惧鍚姩銆 | -| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | 鎸囩ず鏃犺涓绘満搴旂敤绋嬪簭鏄惁宸插惎鍔紝閮藉皢鍚姩浣跨敤鏈嶅姟妯℃澘鐨勫姛鑳姐
**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 | -| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 琛ㄧず杩佺Щ鏄彲鎷夊洖鐨勩 | -| FLAG_INSTALL_ON_DEMAND | 0x00000800 | 濡傛灉鏈畨瑁呮寚瀹氱殑鍔熻兘锛岃瀹夎璇ュ姛鑳姐 | -| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | 濡傛灉鏈畨瑁咃紝浣跨敤鍚庡彴妯″紡瀹夎璇ュ姛鑳姐 | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 鎸囩ず娓呴櫎鍏朵粬浠诲姟鐨勬搷浣溿傚彲浠ヤ负浼犻掔粰 **[ohos.app.Context](js-apis-ability-context.md)** 涓**startAbility**鏂规硶鐨**Want**璁剧疆姝ゆ爣蹇楋紝骞朵笖蹇呴』涓**flag_ABILITY_NEW_MISSION**涓璧蜂娇鐢ㄣ | -| FLAG_ABILITY_NEW_MISSION | 0x10000000 | 鎸囩ず鍦ㄥ巻鍙蹭换鍔″爢鏍堜笂鍒涘缓浠诲姟鐨勬搷浣溿 | -| FLAG_ABILITY_MISSION_TOP | 0x20000000 | 鎸囩ず濡傛灉鍚姩鑳藉姏鐨勭幇鏈夊疄渚嬪凡浣嶄簬浠诲姟鍫嗘爤鐨勯《閮紝鍒欏皢閲嶇敤璇ュ疄渚嬨傚惁鍒欙紝灏嗗垱寤轰竴涓柊鐨勮兘鍔涘疄渚嬨 | +| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | 琛ㄧず瀵筓RI鎵ц璇诲彇鎿嶄綔鐨勬巿鏉冦 | +| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | 琛ㄧず瀵筓RI鎵ц鍐欏叆鎿嶄綔鐨勬巿鏉冦 | +| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | 琛ㄧず灏嗙粨鏋滆繑鍥炵粰婧怉bility銆 | +| FLAG_ABILITY_CONTINUATION | 0x00000008 | 琛ㄧず鏄惁鍙互灏嗘湰鍦拌澶囦笂鐨凙bility杩佺Щ鍒拌繙绔澶囥 | +| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | 琛ㄧず缁勪欢鏄惁涓嶅睘浜嶰HOS銆 | +| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | 琛ㄧず鏌愪釜Ability鏄惁宸茬粡鍚姩銆 | +| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | 琛ㄧずURI涓婂彲鑳芥寔涔呭寲鐨勬巿鏉冦
**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 | +| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | 琛ㄧず鎸夌収鍓嶇紑鍖归厤鐨勬柟寮忛獙璇乁RI鏉冮檺銆
**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 | +| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | 琛ㄧず鏀寔鍒嗗竷寮忚皟搴︾郴缁熶腑鐨勫璁惧鍚姩銆 | +| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | 琛ㄧず鏃犺瀹夸富搴旂敤鏄惁宸插惎鍔紝閮藉皢浣跨敤鍓嶅彴妯″紡鍚姩Ability銆
**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 | +| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 琛ㄧず杩佺Щ鏄惁鏄彲鍙嶅悜鐨勩 | +| FLAG_INSTALL_ON_DEMAND | 0x00000800 | 琛ㄧず濡傛灉鏈畨瑁呮寚瀹氱殑Ability锛屽皢瀹夎璇bility銆 | +| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | 琛ㄧず濡傛灉鏈畨瑁呮寚瀹氱殑Ability锛屽皢鍦ㄥ悗鍙板畨瑁呰Ability銆 | +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 琛ㄧず娓呴櫎鍏朵粬浠诲姟鐨勬搷浣溿傚彲浠ヤ负浼犻掔粰 **[ohos.app.Context](js-apis-ability-context.md)** 涓**startAbility**鏂规硶鐨**Want**璁剧疆姝ゆ爣蹇楋紝骞朵笖蹇呴』涓**flag_ABILITY_NEW_MISSION**涓璧蜂娇鐢ㄣ | +| FLAG_ABILITY_NEW_MISSION | 0x10000000 | 琛ㄧず鍦ㄥ凡鏈夌殑浠诲姟鏍堜笂鍒涘缓浠诲姟鐨勬搷浣溿 | +| FLAG_ABILITY_MISSION_TOP | 0x20000000 | 琛ㄧず濡傛灉鍚姩鐨凙bility鐨勭幇鏈夊疄渚嬪凡浣嶄簬浠诲姟鏍堥《锛屽垯灏嗛噸鐢ㄨ瀹炰緥銆傚惁鍒欙紝灏嗗垱寤轰竴涓柊鐨凙bility瀹炰緥銆 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-particleAbility.md b/zh-cn/application-dev/reference/apis/js-apis-ability-particleAbility.md index e081616b4318327aa1a17930fa6b21a30e4cb48e..c6dab933e02f7dcb50eb65198611b3a64b6368c1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-particleAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-particleAbility.md @@ -1,6 +1,6 @@ # @ohos.ability.particleAbility (ParticleAbility妯″潡) -particleAbility妯″潡鎻愪緵浜哠ervice绫诲瀷Ability鐨勮兘鍔涳紝鍖呮嫭鍚姩銆佸仠姝㈡寚瀹氱殑particleAbility锛岃幏鍙杁ataAbilityHelper锛岃繛鎺ャ佹柇寮褰撳墠Ability涓庢寚瀹歋erviceAbility绛夈 +particleAbility妯″潡鎻愪緵浜嗘搷浣淪ervice绫诲瀷鐨凙bility鐨勮兘鍔涳紝鍖呮嫭鍚姩銆佸仠姝㈡寚瀹氱殑particleAbility锛岃幏鍙杁ataAbilityHelper锛岃繛鎺ャ佹柇杩炴寚瀹氱殑ServiceAbility绛夈 > **璇存槑锛** > @@ -21,7 +21,12 @@ import particleAbility from '@ohos.ability.particleAbility' startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\): void -浣跨敤姝ゆ柟娉曞惎鍔ㄦ寚瀹氱殑particleAbility锛坈allback褰㈠紡锛夈 +鍚姩鎸囧畾鐨刾articleAbility锛坈allback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛團A妯″瀷锛塢(../../application-models/component-startup-rules-fa.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -29,8 +34,8 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\): | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ----------------------------------------------- | ---- | ----------------- | -| parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 鎸囩ず鍚姩鐨刟bility | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶 | +| parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 琛ㄧず鍚姩鐨刟bility | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炲惎鍔ˋbility鐨勭粨鏋 | **绀轰緥锛** @@ -62,7 +67,12 @@ particleAbility.startAbility( startAbility(parameter: StartAbilityParameter): Promise\; -浣跨敤姝ゆ柟娉曞惎鍔ㄦ寚瀹氱殑particleAbility锛圥romise褰㈠紡锛夈 +鍚姩鎸囧畾鐨刾articleAbility锛圥romise褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛團A妯″瀷锛塢(../../application-models/component-startup-rules-fa.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -70,13 +80,13 @@ startAbility(parameter: StartAbilityParameter): Promise\; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ----------------------------------------------- | ---- | ----------------- | -| parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 鎸囩ず鍚姩鐨刟bility | +| parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 鏄 | 琛ㄧず鍚姩鐨刟bility | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | -------------- | ------------------------- | -| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖缁撴灉銆 | +| Promise\ | Promise褰㈠紡杩斿洖鍚姩Ability鐨勭粨鏋溿 | **绀轰緥锛** @@ -107,7 +117,7 @@ particleAbility.startAbility( terminateSelf(callback: AsyncCallback\): void -缁堟particleAbility锛坈allback褰㈠紡锛夈 +閿姣佸綋鍓峱articleAbility锛坈allback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -115,7 +125,7 @@ terminateSelf(callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 鏄 | 琛ㄧず琚寚瀹氱殑鍥炶皟鏂规硶 | +| callback | AsyncCallback\ | 鏄 | 浠allback鐨勫舰寮忚繑鍥炲仠姝㈠綋鍓岮bility缁撴灉 | **绀轰緥锛** @@ -133,7 +143,7 @@ particleAbility.terminateSelf( terminateSelf(): Promise\ -缁堟particleAbility锛圥romise褰㈠紡锛夈 +閿姣佸綋鍓峱articleAbility锛圥romise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -141,7 +151,7 @@ terminateSelf(): Promise\ | 绫诲瀷 | 璇存槑 | | -------------- | ------------------------- | -| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖缁撴灉銆 | +| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖鍋滄褰撳墠Ability缁撴灉銆 | **绀轰緥锛** @@ -159,7 +169,7 @@ particleAbility.terminateSelf().then((data) => { acquireDataAbilityHelper(uri: string): DataAbilityHelper -鑾峰彇dataAbilityHelper銆 +鑾峰彇dataAbilityHelper瀵硅薄銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -167,13 +177,13 @@ acquireDataAbilityHelper(uri: string): DataAbilityHelper | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | :--- | ------ | ---- | ------------------------ | -| uri | string | 鏄 | 鎸囩ず瑕佹墦寮鐨勬枃浠剁殑璺緞銆 | +| uri | string | 鏄 | 琛ㄧず瑕佹墦寮鐨勬枃浠剁殑璺緞銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | ----------------- | -------------------------------------------- | -| DataAbilityHelper | 鐢ㄦ潵鍗忓姪鍏朵粬Ability璁块棶DataAbility鐨勫伐鍏风被銆 | +| [DataAbilityHelper](js-apis-inner-ability-dataAbilityHelper.md) | 鐢ㄦ潵鍗忓姪鍏朵粬Ability璁块棶DataAbility鐨勫伐鍏风被銆 | **绀轰緥锛** @@ -270,7 +280,7 @@ startBackgroundRunning(id: number, request: NotificationRequest): Promise<voi | 绫诲瀷 | 璇存槑 | | -------------- | ------------------------- | -| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖缁撴灉銆 | +| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖鍚姩闀挎椂浠诲姟鐨勭粨鏋溿 | **绀轰緥**锛 @@ -326,7 +336,7 @@ cancelBackgroundRunning(callback: AsyncCallback<void>): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | 鏄 | callback褰㈠紡杩斿洖鍚姩闀挎椂浠诲姟鐨勭粨鏋 | + | callback | AsyncCallback<void> | 鏄 | callback褰㈠紡杩斿洖鍙栨秷闀挎椂浠诲姟鐨勭粨鏋 | **绀轰緥**锛 @@ -357,7 +367,7 @@ cancelBackgroundRunning(): Promise<void>; | 绫诲瀷 | 璇存槑 | | -------------- | ------------------------- | -| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖缁撴灉銆 | +| Promise\ | 浣跨敤Promise褰㈠紡杩斿洖鍙栨秷闀挎椂浠诲姟鐨勭粨鏋溿 | **绀轰緥**锛 @@ -376,7 +386,7 @@ particleAbility.cancelBackgroundRunning().then(() => { connectAbility(request: Want, options:ConnectOptions): number -灏嗗綋鍓峚bility杩炴帴鍒版寚瀹歋erviceAbility锛坈allback褰㈠紡锛夈 +灏嗗綋鍓峚bility涓庢寚瀹氱殑ServiceAbility杩涜杩炴帴锛坈allback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -385,22 +395,13 @@ connectAbility(request: Want, options:ConnectOptions): number | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------- | -------------- | ---- | ---------------------------- | | request | [Want](js-apis-application-want.md) | 鏄 | 琛ㄧず琚繛鎺ョ殑ServiceAbility銆 | -| options | ConnectOptions | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | - +| options | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | 鏄 | 杩炴帴鍥炶皟鏂规硶銆 | -**ConnectOptions绫诲瀷璇存槑锛** - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core - -| 鍚嶇О | 绫诲瀷 | 蹇呭~ | 璇存槑 | -| ------------ | -------- | ---- | ------------------------- | -| onConnect | function | 鏄 | 杩炴帴鎴愬姛鏃剁殑鍥炶皟鍑芥暟銆 | -| onDisconnect | function | 鏄 | 杩炴帴澶辫触鏃剁殑鍥炶皟鍑芥暟銆 | -| onFailed | function | 鏄 | ConnectAbility璋冪敤澶辫触鏃剁殑鍥炶皟鍑芥暟銆 | **绀轰緥**锛 ```ts +import particleAbility from '@ohos.ability.particleAbility' import rpc from '@ohos.rpc' function onConnectCallback(element, remote) { @@ -438,7 +439,7 @@ particleAbility.disconnectAbility(connId).then((data) => { disconnectAbility(connection: number, callback:AsyncCallback\): void; -灏嗗姛鑳戒笌鏈嶅姟鍔熻兘鏂紑杩炴帴銆 +鏂紑褰撳墠ability涓庢寚瀹歋erviceAbility鐨勮繛鎺ワ紙callback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -451,7 +452,8 @@ disconnectAbility(connection: number, callback:AsyncCallback\): void; **绀轰緥**锛 ```ts -import rpc from '@ohos.rpc' +import particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc'; function onConnectCallback(element, remote) { console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); @@ -488,7 +490,7 @@ particleAbility.disconnectAbility(connId, (err) => { disconnectAbility(connection: number): Promise\; -灏嗗姛鑳戒笌鏈嶅姟鍔熻兘鏂紑杩炴帴銆 +鏂紑褰撳墠ability涓庢寚瀹歋erviceAbility鐨勮繛鎺ワ紙Promise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel @@ -501,7 +503,8 @@ disconnectAbility(connection: number): Promise\; **绀轰緥**锛 ```ts -import rpc from '@ohos.rpc' +import particleAbility from '@ohos.ability.particleAbility'; +import rpc from '@ohos.rpc'; function onConnectCallback(element, remote) { console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); @@ -537,7 +540,7 @@ particleAbility.disconnectAbility(connId).then((data) => { ## ErrorCode -鑾峰彇閿欒浠g爜銆 +琛ㄧず閿欒鐮併 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.FAModel diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md index 67516cb97fe6ec447d133a1d0a6e311504498fef..9f4ac87aacb143e0f0eb9eac09dad2c78478c281 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md @@ -23,8 +23,8 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'; | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | -| launchReason | [LaunchReason](#abilityconstantlaunchreason)| 鏄 | 鏄 | 鏋氫妇绫诲瀷锛岃〃绀哄惎鍔ㄥ師鍥犮 | -| lastExitReason | [LastExitReason](#abilityconstantlastexitreason) | 鏄 | 鏄 | 鏋氫妇绫诲瀷锛岃〃绀烘渶鍚庨鍑哄師鍥犮 | +| launchReason | [LaunchReason](#abilityconstantlaunchreason)| 鏄 | 鏄 | 鎸囩ず鍚姩鍘熷洜銆 | +| lastExitReason | [LastExitReason](#abilityconstantlastexitreason) | 鏄 | 鏄 | 琛ㄧず鏈鍚庨鍑哄師鍥犮 | ## AbilityConstant.LaunchReason @@ -116,8 +116,8 @@ class MyAbility extends UIAbility { | --- | --- | --- | | WINDOW_MODE_UNDEFINED | 0 | 鏈畾涔夌獥鍙fā寮忋 | | WINDOW_MODE_FULLSCREEN | 1 | 鍏ㄥ睆妯″紡銆 | -| WINDOW_MODE_SPLIT_PRIMARY | 100 | 鍒嗗睆澶氱獥鍙d富瑕佹ā寮忋 | -| WINDOW_MODE_SPLIT_SECONDARY | 101 | 鍒嗗睆澶氱獥鍙f瑕佹ā寮忋 | +| WINDOW_MODE_SPLIT_PRIMARY | 100 | 灞忓箷濡傛灉鏄按骞虫柟鍚戣〃绀哄乏鍒嗗睆锛屽睆骞曞鏋滄槸绔栫洿鏂瑰悜琛ㄧず涓婂垎灞忋 | +| WINDOW_MODE_SPLIT_SECONDARY | 101 | 灞忓箷濡傛灉鏄按骞虫柟鍚戣〃绀哄彸鍒嗗睆锛屽睆骞曞鏋滄槸绔栫洿鏂瑰悜琛ㄧず涓嬪垎灞忋 | | WINDOW_MODE_FLOATING | 102 | 鑷敱鎮诞褰㈠紡绐楀彛妯″紡銆 | **绀轰緥锛** diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md index 509ea3d8c01592ad1606d319db7e9c67046251b2..f0a420977e427e87ebab5a8a42bc7d62ca143b5b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -584,7 +584,7 @@ try { getForegroundApplications(callback: AsyncCallback\>): void; -鑾峰彇褰撳墠鎵鏈夊墠鍙板簲鐢ㄧ殑淇℃伅銆傝搴旂敤淇℃伅鐢盵AppStateData](js-apis-inner-application-appStateData.md)瀹氫箟銆 +鑾峰彇鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆傝搴旂敤淇℃伅鐢盵AppStateData](js-apis-inner-application-appStateData.md)瀹氫箟銆 **闇瑕佹潈闄**锛歰hos.permission.GET_RUNNING_INFO @@ -604,7 +604,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\> | 鏄 | 浠romise鏂瑰紡杩斿洖鎺ュ彛杩愯缁撴灉鍙婂簲鐢ㄧ姸鎬佹暟鎹暟缁勶紝鍙繘琛岄敊璇鐞嗘垨鍏朵粬鑷畾涔夊鐞嗐 | +| callback | AsyncCallback\> | 鏄 | 浠allback鏂瑰紡杩斿洖鎺ュ彛杩愯缁撴灉鍙婂簲鐢ㄧ姸鎬佹暟鎹暟缁勶紝鍙繘琛岄敊璇鐞嗘垨鍏朵粬鑷畾涔夊鐞嗐 | **绀轰緥锛** @@ -629,7 +629,7 @@ try { getForegroundApplications(): Promise\>; -鑾峰彇褰撳墠鎵鏈夊墠鍙板簲鐢ㄧ殑淇℃伅銆傝搴旂敤淇℃伅鐢盵AppStateData](js-apis-inner-application-appStateData.md)瀹氫箟銆 +鑾峰彇鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆傝搴旂敤淇℃伅鐢盵AppStateData](js-apis-inner-application-appStateData.md)瀹氫箟銆 **闇瑕佹潈闄**锛歰hos.permission.GET_RUNNING_INFO @@ -641,7 +641,7 @@ getForegroundApplications(): Promise\>; | 绫诲瀷 | 璇存槑 | | -------- | -------- | -| Promise\> | 杩斿洖鍓嶅彴杩涚▼搴旂敤绋嬪簭鐨勬暟缁勩 | +| Promise\> | 浠romise褰㈠紡杩斿洖鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆 | **閿欒鐮**锛 diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 72c8116699a3130bdb0fe7bd1045e2f14ef50955..05fe717a32ded54bca8bf95c74a405c0109ded48 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -18,13 +18,12 @@ import appRecovery from '@ohos.app.ability.appRecovery'; **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core -| 鍚嶇О | 鍊 | 璇存槑 | -| ----------------------------- | ---- | ------------------------------------------------------------ | -| ALWAYS_RESTART | 0 | 鎬绘槸閲嶅惎搴旂敤銆 | -| CPP_CRASH_NO_RESTART | 0x0001 | 鍙戠敓CPP_CRASH鏃朵笉閲嶅惎搴旂敤銆 | -| JS_CRASH_NO_RESTART | 0x0002 | 鍙戠敓JS_CRASH鏃朵笉閲嶅惎搴旂敤銆 | -| APP_FREEZE_NO_RESTART | 0x0004 | 鍙戠敓APP_FREEZE鏃朵笉閲嶅惎搴旂敤銆 | -| NO_RESTART | 0xFFFF | 鎬绘槸涓嶉噸鍚簲鐢ㄣ | +| 鍚嶇О | 鍊 | 璇存槑 | +| ---------- | ---- | ---------- | +| ALWAYS_RESTART | 0 | 鎬绘槸閲嶅惎搴旂敤銆 | +| RESTART_WHEN_JS_CRASH | 0x0001 | 鍙戠敓JS_CRASH鏃堕噸鍚簲鐢ㄣ | +| RESTART_WHEN_APP_FREEZE | 0x0002 | 鍙戠敓APP_FREEZE鏃堕噸鍚簲鐢ㄣ | +| NO_RESTART | 0xFFFF | 鎬绘槸涓嶉噸鍚簲鐢ㄣ | ## appRecovery.SaveOccasionFlag @@ -69,9 +68,8 @@ enableAppRecovery(restart?: [RestartFlag](#apprecoveryrestartflag), saveOccasion ```ts import appRecovery from '@ohos.app.ability.appRecovery'; import AbilityStage from '@ohos.app.ability.AbilityStage'; -import UIAbility from '@ohos.app.ability.UIAbility'; -export default class MyAbility extends UIAbility { +export default class MyAbilityStage extends AbilityStage { onCreate() { appRecovery.enableAppRecovery( appRecovery.RestartFlag::ALWAYS_RESTART, diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md index 449367a1b7cffda3e77125db26e6fc3cac69ee3e..240d075b5cc339c0ef242b3a8401fadcf167f797 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md @@ -1,25 +1,19 @@ # @ohos.app.ability.Configuration (Configuration) -瀹氫箟鐜鍙樺寲淇℃伅銆 +瀹氫箟鐜鍙樺寲淇℃伅銆侰onfiguration鏄帴鍙e畾涔夛紝浠呭仛瀛楁澹版槑銆 > **璇存槑锛** > > 鏈ā鍧楅鎵规帴鍙d粠API version 9寮濮嬫敮鎸併傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 -## 瀵煎叆妯″潡 - -```ts -import Configuration from '@ohos.app.ability.Configuration' -``` - **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | | language | string | 鏄 | 鏄 | 琛ㄧず搴旂敤绋嬪簭鐨勫綋鍓嶈瑷銆備緥濡傦細zh銆 | -| colorMode | [ColorMode](js-apis-app-ability-configurationConstant.md#configurationconstantcolormode) | 鏄 | 鏄 | 琛ㄧず娣辨祬鑹叉ā寮忥紝鍙栧艰寖鍥达細娴呰壊妯″紡锛圕OLOR_MODE_LIGHT锛夛紝娣辫壊妯″紡锛圕OLOR_MODE_DARK锛夈傞粯璁や负娴呰壊銆 | -| direction | [Direction](js-apis-app-ability-configurationConstant.md#configurationconstantdirection) | 鏄 | 鍚 | 琛ㄧず灞忓箷鏂瑰悜锛屽彇鍊艰寖鍥达細姘村钩鏂瑰悜锛圖IRECTION_HORIZONTAL锛夛紝鍨傜洿鏂瑰悜锛圖IRECTION_VERTICAL锛夈 | -| screenDensity | [ScreenDensity](js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity) | 鏄 | 鍚 | 琛ㄧず灞忓箷鍒嗚鲸鐜囷紝鍙栧艰寖鍥达細SCREEN_DENSITY_SDPI锛120锛夈丼CREEN_DENSITY_MDPI锛160锛夈丼CREEN_DENSITY_LDPI锛240锛夈丼CREEN_DENSITY_XLDPI锛320锛夈丼CREEN_DENSITY_XXLDPI锛480锛夈丼CREEN_DENSITY_XXXLDPI锛640锛夈 | +| colorMode | [ColorMode](js-apis-app-ability-configurationConstant.md#configurationconstantcolormode) | 鏄 | 鏄 | 琛ㄧず娣辨祬鑹叉ā寮忥紝鍙栧艰寖鍥达細鏈缃(COLOR_MODE_NOT_SET)锛屾祬鑹叉ā寮忥紙COLOR_MODE_LIGHT锛夛紝娣辫壊妯″紡锛圕OLOR_MODE_DARK锛夈傞粯璁や负娴呰壊銆 | +| direction | [Direction](js-apis-app-ability-configurationConstant.md#configurationconstantdirection) | 鏄 | 鍚 | 琛ㄧず灞忓箷鏂瑰悜锛屽彇鍊艰寖鍥达細鏈缃(DIRECTION_NOT_SET)锛屾按骞虫柟鍚戯紙DIRECTION_HORIZONTAL锛夛紝鍨傜洿鏂瑰悜锛圖IRECTION_VERTICAL锛夈 | +| screenDensity | [ScreenDensity](js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity) | 鏄 | 鍚 | 琛ㄧず灞忓箷鍒嗚鲸鐜囷紝鍙栧艰寖鍥达細鏈缃(SCREEN_DENSITY_NOT_SET)锛孲CREEN_DENSITY_SDPI锛120锛夈丼CREEN_DENSITY_MDPI锛160锛夈丼CREEN_DENSITY_LDPI锛240锛夈丼CREEN_DENSITY_XLDPI锛320锛夈丼CREEN_DENSITY_XXLDPI锛480锛夈丼CREEN_DENSITY_XXXLDPI锛640锛夈 | | displayId | number | 鏄 | 鍚 | 琛ㄧず搴旂敤鎵鍦ㄧ殑鐗╃悊灞忓箷Id銆 | | hasPointerDevice | boolean | 鏄 | 鍚 | 鎸囩ず鎸囬拡绫诲瀷璁惧鏄惁宸茶繛鎺ワ紝濡傞敭榧犮佽Е鎺ф澘绛夈 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 80adf4b8d887a5e2694d7d6986321e94bf4b17c5..5ffbebe7a63d4b4ac1b51dd1bcb81cbe66931696 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -32,7 +32,7 @@ on(type:"mission", listener: MissionListener): number; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | listener | MissionListener | 鏄 | 绯荤粺浠诲姟鐩戝惉鏂规硶銆 | + | listener | [MissionListener](js-apis-inner-application-missionListener.md) | 鏄 | 绯荤粺浠诲姟鐩戝惉鏂规硶銆 | **杩斿洖鍊硷細** diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index a4b2d9d4f71ac20736d3435061a1bef2e6953e9c..2f5ef57a128cf21539b5d4c18a3e78fc85ea155f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -80,7 +80,7 @@ Extension鐢熷懡鍛ㄦ湡鍥炶皟锛屽湪閿姣佹椂鍥炶皟锛屾墽琛岃祫婧愭竻鐞嗙瓑鎿嶄綔 onRequest(want: Want, startId: number): void; -Extension鐢熷懡鍛ㄦ湡鍥炶皟锛屽鏋滄槸startAbility鎷夎捣鐨勬湇鍔★紝浼氬湪onCreate涔嬪悗鍥炶皟銆傛瘡娆℃媺璧锋湇鍔¢兘浼氬洖璋冿紝startId浼氶掑銆 +Extension鐢熷懡鍛ㄦ湡鍥炶皟锛屽鏋滄槸startAbility鎴栬卻tartServiceExtensionAbility鎷夎捣鐨勬湇鍔★紝浼氬湪onCreate涔嬪悗鍥炶皟銆傛瘡娆℃媺璧锋湇鍔¢兘浼氬洖璋冿紝startId浼氶掑銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md index 463ab081bfc09b77d8cf080b0736644c5b98b359..5e89bee7d69b6112282e5a339640427d848a0f3b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -24,3 +24,32 @@ import StartOptions from '@ohos.app.ability.StartOptions'; | -------- | -------- | -------- | -------- | | [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | 鍚 | 绐楀彛妯″紡銆 | | displayId | number | 鍚 | 鏄剧ずID銆 | + +**绀轰緥锛** + + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + try { + missionManager.getMissionInfos("", 10, (error, missions) => { + if (error.code) { + console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + + "error.message:" + JSON.stringify(error.message)); + return; + } + console.log("size = " + missions.length); + console.log("missions = " + JSON.stringify(missions)); + let id = missions[0].missionId; + + let startOptions = { + windowMode : 101, + displayId: 0 + }; + missionManager.moveMissionToFront(id, startOptions).then(() => { + console.log("moveMissionToFront is called "); + }); + }); + } catch (paramError) { + console.log("error: " + paramError.code + ", " + paramError.message); + } + ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index 6d9f7d70b72da1fa92413438a544bbd983602f95..866c3e20e18fb070c827f77598c222896294581e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -42,7 +42,7 @@ Ability鍒涘缓鏃跺洖璋冿紝鎵ц鍒濆鍖栦笟鍔¢昏緫鎿嶄綔銆 | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | | want | [Want](js-apis-app-ability-want.md) | 鏄 | 褰撳墠Ability鐨刉ant绫诲瀷淇℃伅锛屽寘鎷琣bility鍚嶇О銆乥undle鍚嶇О绛夈 | - | param | AbilityConstant.LaunchParam | 鏄 | 鍒涘缓 ability銆佷笂娆″紓甯搁鍑虹殑鍘熷洜淇℃伅銆 | + | param | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | 鏄 | 鍒涘缓 ability銆佷笂娆″紓甯搁鍑虹殑鍘熷洜淇℃伅銆 | **绀轰緥锛** @@ -67,7 +67,7 @@ onWindowStageCreate(windowStage: window.WindowStage): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | windowStage | window.WindowStage | 鏄 | WindowStage鐩稿叧淇℃伅銆 | + | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 鏄 | WindowStage鐩稿叧淇℃伅銆 | **绀轰緥锛** @@ -111,7 +111,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | windowStage | window.WindowStage | 鏄 | WindowStage鐩稿叧淇℃伅銆 | + | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 鏄 | WindowStage鐩稿叧淇℃伅銆 | **绀轰緥锛** @@ -199,13 +199,13 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; | 绫诲瀷 | 璇存槑 | | -------- | -------- | - | AbilityConstant.OnContinueResult | 缁х画鐨勭粨鏋溿 | + | [AbilityConstant.OnContinueResult](js-apis-app-ability-abilityConstant.md#abilityconstantoncontinueresult) | 缁х画鐨勭粨鏋溿 | **绀轰緥锛** ```ts - import AbilityConstant from "@ohos.application.AbilityConstant" - class myAbility extends Ability { + import AbilityConstant from "@ohos.app.ability.AbilityConstant" + class MyUIAbility extends UIAbility { onContinue(wantParams) { console.log('onContinue'); wantParams["myData"] = "my1234567"; @@ -219,7 +219,7 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; -褰揳bility鐨勫惎鍔ㄦā寮忚缃负鍗曚緥鏃跺洖璋冧細琚皟鐢ㄣ +褰撲紶鍏ユ柊鐨刉ant锛宎bility鍐嶆琚媺璧锋椂浼氬洖璋冩墽琛岃鏂规硶銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.AbilityCore @@ -227,17 +227,18 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-application-want.md) | 鏄 | Want绫诲瀷鍙傛暟锛屽ability鍚嶇О锛屽寘鍚嶇瓑銆 | - | launchParams | AbilityConstant.LaunchParam | 鏄 | Ability鍚姩鐨勫師鍥犮佷笂娆″紓甯搁鍑虹殑鍘熷洜淇℃伅銆 | + | want | [Want](js-apis-app-ability-want.md) | 鏄 | Want绫诲瀷鍙傛暟锛屽ability鍚嶇О锛屽寘鍚嶇瓑銆 | + | launchParams | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | 鏄 | UIAbility鍚姩鐨勫師鍥犮佷笂娆″紓甯搁鍑虹殑鍘熷洜淇℃伅銆 | **绀轰緥锛** ```ts - class myAbility extends Ability { - onNewWant(want) { + class MyUIAbility extends UIAbility { + onNewWant(want, launchParams) { console.log('onNewWant, want:' + want.abilityName); - } - } + console.log('onNewWant, launchParams:' + JSON.stringify(launchParams)); + } + } ``` ## Ability.onDump @@ -290,9 +291,9 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}) **绀轰緥锛** ```ts -import AbilityConstant from '@ohos.application.AbilityConstant' +import AbilityConstant from '@ohos.app.ability.AbilityConstant' -class myAbility extends Ability { +class MyUIAbility extends UIAbility { onSaveState(reason, wantParam) { console.log('onSaveState'); wantParam["myData"] = "my1234567"; @@ -320,7 +321,7 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | | method | string | 鏄 | 绾﹀畾鐨勬湇鍔$娉ㄥ唽浜嬩欢瀛楃涓层 | - | data | rpc.Sequenceable | 鏄 | 鐢卞紑鍙戣呭疄鐜扮殑Sequenceable鍙簭鍒楀寲鏁版嵁銆 | + | data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | 鏄 | 鐢卞紑鍙戣呭疄鐜扮殑Sequenceable鍙簭鍒楀寲鏁版嵁銆 | **杩斿洖鍊硷細** @@ -401,13 +402,13 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | | method | string | 鏄 | 绾﹀畾鐨勬湇鍔$娉ㄥ唽浜嬩欢瀛楃涓层 | - | data | rpc.Sequenceable | 鏄 | 鐢卞紑鍙戣呭疄鐜扮殑Sequenceable鍙簭鍒楀寲鏁版嵁銆 | + | data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | 鏄 | 鐢卞紑鍙戣呭疄鐜扮殑Sequenceable鍙簭鍒楀寲鏁版嵁銆 | **杩斿洖鍊硷細** | 绫诲瀷 | 璇存槑 | | -------- | -------- | - | Promise<rpc.MessageParcel> | Promise褰㈠紡杩斿洖閫氱敤缁勪欢鏈嶅姟绔簲绛旀暟鎹 | + | Promise<[rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)> | Promise褰㈠紡杩斿洖閫氱敤缁勪欢鏈嶅姟绔簲绛旀暟鎹 | **閿欒鐮侊細** @@ -527,7 +528,7 @@ release(): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | callback | OnReleaseCallBack | 鏄 | 杩斿洖onRelease鍥炶皟缁撴灉銆 | + | callback | [OnReleaseCallBack](#onreleasecallback) | 鏄 | 杩斿洖onRelease鍥炶皟缁撴灉銆 | **绀轰緥锛** @@ -547,7 +548,7 @@ release(): void; console.log(' Caller OnRelease CallBack is called ' + str); }); } catch (error) { - console.log('Caller.on catch error, error.code: ' + JSON.stringify(error.code) + + console.log('Caller.onRelease catch error, error.code: ' + JSON.stringify(error.code) + ' error.message: ' + JSON.stringify(error.message)); } }).catch((err) => { @@ -571,7 +572,7 @@ release(): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | | type | string | 鏄 | 鐩戝惉releaseCall浜嬩欢锛屽浐瀹氫负'release'銆 | - | callback | OnReleaseCallback | 鏄 | 杩斿洖onRelease鍥炶皟缁撴灉銆 | + | callback | [OnReleaseCallBack](#onreleasecallback) | 鏄 | 杩斿洖onRelease鍥炶皟缁撴灉銆 | **閿欒鐮侊細** @@ -609,6 +610,108 @@ release(): void; } ``` +## Caller.off + +off(type: "release", callback: OnReleaseCallback): void; + +鍙栨秷娉ㄥ唽閫氱敤缁勪欢鏈嶅姟绔疭tub锛堟々锛夋柇寮鐩戝惉閫氱煡銆傞鐣欒兘鍔涳紝褰撳墠鏆傛湭鏀寔銆 + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.AbilityCore + +**鍙傛暟锛** + +| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | +| -------- | -------- | -------- | -------- | +| type | string | 鏄 | 鐩戝惉releaseCall浜嬩欢锛屽浐瀹氫负'release'銆 | +| callback | [OnReleaseCallBack](#onreleasecallback) | 鏄 | 杩斿洖off鍥炶皟缁撴灉銆 | + +**閿欒鐮侊細** + +| 閿欒鐮両D | 閿欒淇℃伅 | +| ------- | -------------------------------- | +| 401 | If the input parameter is not valid parameter. | +鍏朵粬ID瑙乕鍏冭兘鍔涘瓙绯荤粺閿欒鐮乚(../errorcodes/errorcode-ability.md) + +**绀轰緥锛** + + ```ts + var caller; + export default class MainUIAbility extends UIAbility { + onWindowStageCreate(windowStage) { + this.context.startAbilityByCall({ + bundleName: "com.example.myservice", + abilityName: "MainUIAbility", + deviceId: "" + }).then((obj) => { + caller = obj; + try { + let onReleaseCallBack = (str) => { + console.log(' Caller OnRelease CallBack is called ' + str); + }; + caller.on("release", onReleaseCallBack); + caller.off("release", onReleaseCallBack); + } catch (error) { + console.log('Caller.on or Caller.off catch error, error.code: ' + JSON.stringify(error.code) + + ' error.message: ' + JSON.stringify(error.message)); + } + }).catch((err) => { + console.log('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + + ' error.message: ' + JSON.stringify(err.message)); + }); + } + } + ``` + +## Caller.off + +off(type: "release"): void; + +鍙栨秷娉ㄥ唽閫氱敤缁勪欢鏈嶅姟绔疭tub锛堟々锛夋柇寮鐩戝惉閫氱煡銆傞鐣欒兘鍔涳紝褰撳墠鏆傛湭鏀寔銆 + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.AbilityCore + +**鍙傛暟锛** + +| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | +| -------- | -------- | -------- | -------- | +| type | string | 鏄 | 鐩戝惉releaseCall浜嬩欢锛屽浐瀹氫负'release'銆 | + +**閿欒鐮侊細** + +| 閿欒鐮両D | 閿欒淇℃伅 | +| ------- | -------------------------------- | +| 401 | If the input parameter is not valid parameter. | +鍏朵粬ID瑙乕鍏冭兘鍔涘瓙绯荤粺閿欒鐮乚(../errorcodes/errorcode-ability.md) + +**绀轰緥锛** + + ```ts + var caller; + export default class MainUIAbility extends UIAbility { + onWindowStageCreate(windowStage) { + this.context.startAbilityByCall({ + bundleName: "com.example.myservice", + abilityName: "MainUIAbility", + deviceId: "" + }).then((obj) => { + caller = obj; + try { + let onReleaseCallBack = (str) => { + console.log(' Caller OnRelease CallBack is called ' + str); + }; + caller.on("release", onReleaseCallBack); + caller.off("release"); + } catch (error) { + console.error('Caller.on or Caller.off catch error, error.code: ' + JSON.stringify(error.code) + + ' error.message: ' + JSON.stringify(error.message)); + } + }).catch((err) => { + console.error('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + + ' error.message: ' + JSON.stringify(err.message)); + }); + } + } + ``` ## Callee @@ -627,7 +730,7 @@ on(method: string, callback: CalleeCallback): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | | method | string | 鏄 | 涓庡鎴风绾﹀畾鐨勯氱煡娑堟伅瀛楃涓层 | - | callback | CalleeCallback | 鏄 | 涓涓猺pc.MessageParcel绫诲瀷鍏ュ弬鐨刯s閫氱煡鍚屾鍥炶皟鍑芥暟, 鍥炶皟鍑芥暟鑷冲皯瑕佽繑鍥炰竴涓┖鐨剅pc.Sequenceable鏁版嵁瀵硅薄, 鍏朵粬瑙嗕负鍑芥暟鎵ц閿欒銆 | + | callback | [CalleeCallback](#calleecallback) | 鏄 | 涓涓猍rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)绫诲瀷鍏ュ弬鐨刯s閫氱煡鍚屾鍥炶皟鍑芥暟, 鍥炶皟鍑芥暟鑷冲皯瑕佽繑鍥炰竴涓┖鐨刐rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated)鏁版嵁瀵硅薄, 鍏朵粬瑙嗕负鍑芥暟鎵ц閿欒銆 | **閿欒鐮侊細** @@ -739,4 +842,4 @@ off(method: string): void; | 鍚嶇О | 鍙 | 鍙啓 | 绫诲瀷 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | -| (indata: rpc.MessageParcel) | 鏄 | 鍚 | rpc.Sequenceable | 琚皟鐢ㄦ柟娉ㄥ唽鐨勬秷鎭睛鍚櫒鍑芥暟鎺ュ彛鐨勫師鍨嬨 | +| (indata: [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)) | 鏄 | 鍚 | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | 琚皟鐢ㄦ柟娉ㄥ唽鐨勬秷鎭睛鍚櫒鍑芥暟鎺ュ彛鐨勫師鍨嬨 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md index 46990a60deb4414d7b9d06369cb0ef88ecd119a7..79cb1a5f4a26454cdb17b87860355a953dfb6646 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md @@ -25,7 +25,7 @@ import Want from '@ohos.app.ability.Want'; | type | string | 鍚 | 琛ㄧずMIME type绫诲瀷鎻忚堪锛屾墦寮鏂囦欢鐨勭被鍨嬶紝涓昏鐢ㄤ簬鏂囩鎵撳紑鏂囦欢銆傛瘮濡傦細"text/xml" 銆 "image/*"绛夛紝MIME瀹氫箟鍙傝冿細https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com銆 | | flags | number | 鍚 | 琛ㄧず澶勭悊Want鐨勬柟寮忋傞粯璁や紶鏁板瓧锛屽叿浣撳弬鑰冿細[flags璇存槑](js-apis-ability-wantConstant.md#wantConstant.Flags)銆 | | action | string | 鍚 | 琛ㄧず瑕佹墽琛岀殑閫氱敤鎿嶄綔锛堝锛氭煡鐪嬨佸垎浜佸簲鐢ㄨ鎯咃級銆傚湪闅愬紡Want涓紝鎮ㄥ彲浠ュ畾涔夎瀛楁锛岄厤鍚坲ri鎴杙arameters鏉ヨ〃绀哄鏁版嵁瑕佹墽琛岀殑鎿嶄綔銆 | -| parameters | {[key: string]: any} | 鍚 | 琛ㄧずWantParams鎻忚堪锛岀敱寮鍙戣呰嚜琛屽喅瀹氫紶鍏ョ殑閿煎銆傞粯璁や細鎼哄甫浠ヤ笅key鍊硷細
ohos.aafwk.callerPid 琛ㄧず鎷夎捣鏂圭殑pid銆
ohos.aafwk.param.callerToken 琛ㄧず鎷夎捣鏂圭殑token銆
ohos.aafwk.param.callerUid 琛ㄧず[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)涓殑uid锛屽簲鐢ㄥ寘閲屽簲鐢ㄧ▼搴忕殑uid銆 | +| parameters | {[key: string]: any} | 鍚 | 琛ㄧずWantParams鎻忚堪锛岀敱寮鍙戣呰嚜琛屽喅瀹氫紶鍏ョ殑閿煎銆傞粯璁や細鎼哄甫浠ヤ笅key鍊硷細
- ohos.aafwk.callerPid锛氳〃绀烘媺璧锋柟鐨刾id銆
- ohos.aafwk.param.callerToken锛氳〃绀烘媺璧锋柟鐨則oken銆
- ohos.aafwk.param.callerUid锛氳〃绀篬BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1)涓殑uid锛屽簲鐢ㄥ寘閲屽簲鐢ㄧ▼搴忕殑uid銆
- component.startup.newRules锛氳〃绀烘槸鍚﹀惎鐢ㄦ柊鐨勭鎺ц鍒欍
- moduleName锛氳〃绀烘媺璧锋柟鐨勬ā鍧楀悕锛岃瀛楁鐨勫煎嵆浣垮畾涔夋垚鍏朵粬瀛楃涓诧紝鍦ㄤ紶閫掑埌鍙︿竴绔椂浼氳淇敼涓烘纭殑鍊笺
- ohos.dlp.params.sandbox锛氳〃绀篸lp鏂囦欢鎵嶄細鏈夈 | | | entities | Array\ | 鍚 | 琛ㄧず鐩爣Ability棰濆鐨勭被鍒俊鎭紙濡傦細娴忚鍣ㄣ佽棰戞挱鏀惧櫒锛夛紝鍦ㄩ殣寮廤ant涓槸瀵筧ction瀛楁鐨勮ˉ鍏呫傚湪闅愬紡Want涓紝鎮ㄥ彲浠ュ畾涔夎瀛楁锛屾潵杩囨护鍖归厤Ability绫诲瀷銆 | | moduleName | string | 鍚 | 琛ㄧず寰呭惎鍔ㄧ殑Ability鎵灞炵殑妯″潡锛坢odule锛夈 | @@ -122,7 +122,7 @@ import Want from '@ohos.app.ability.Want'; "abilityName": "MainAbility", "moduleName": "entry", // moduleName闈炲繀閫 "parameters": { - "keyFd":{"type":"FD", "value":fd} + "keyFd":{"type":"FD", "value":fd} // {"type":"FD", "value":fd}鏄浐瀹氱敤娉曪紝鐢ㄤ簬琛ㄧず璇ユ暟鎹槸FD } }; this.context.startAbility(want, (error) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index 20aa63ed78f52a50a1254e1dafc7dc3f0f9c59bd..5aadd796d7e3f4dbc33f9805fa100642d07e0d1b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -85,7 +85,7 @@ getWantAgent(info: WantAgentInfo): Promise\ | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------------- | ---- | ------------- | -| info | WantAgentInfo | 鏄 | WantAgent淇℃伅銆 | +| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | 鏄 | WantAgent淇℃伅銆 | **杩斿洖鍊硷細** @@ -451,7 +451,7 @@ getWant(agent: WantAgent, callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | --------------------- | ---- | ------------------------------- | | agent | WantAgent | 鏄 | WantAgent瀵硅薄銆 | -| callback | AsyncCallback\ | 鏄 | 鑾峰彇WantAgent瀵硅薄want鐨勫洖璋冩柟娉曘 | +| callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | 鏄 | 鑾峰彇WantAgent瀵硅薄want鐨勫洖璋冩柟娉曘 | **绀轰緥锛** @@ -752,7 +752,7 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\ | 鍚 | 涓诲姩婵鍙慦antAgent瀹炰緥鐨勫洖璋冩柟娉曘 | +| callback | AsyncCallback\<[CompleteData](#completedata)\> | 鍚 | 涓诲姩婵鍙慦antAgent瀹炰緥鐨勫洖璋冩柟娉曘 | **绀轰緥锛** @@ -1152,6 +1152,6 @@ try { | info | WantAgent | 鏄 | 瑙﹀彂鐨剋antAgent銆 | | want | Want | 鏄 | 瀛樺湪鐨勮瑙﹀彂鐨剋ant銆 | | finalCode | number | 鏄 | 瑙﹀彂wantAgent鐨勮姹備唬鐮併倈 -| finalData | string | 鍚 | 鍏叡浜嬩欢鏀堕泦鐨勬渶缁堟暟鎹 | +| finalData | string | 鏄 | 鍏叡浜嬩欢鏀堕泦鐨勬渶缁堟暟鎹 | | extraInfo | {[key: string]: any} | 鍚 | 棰濆鏁版嵁銆 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-ability.md b/zh-cn/application-dev/reference/apis/js-apis-application-ability.md index 892e1d64dc7e9db9ac953f7178e8d3c0d8e41ab8..df08aed5ecb0c7e8092cf43f265c49f391d2250b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-ability.md @@ -67,7 +67,7 @@ onWindowStageCreate(windowStage: window.WindowStage): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | windowStage | window.WindowStage | 鏄 | WindowStage鐩稿叧淇℃伅銆 | + | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 鏄 | WindowStage鐩稿叧淇℃伅銆 | **绀轰緥锛** @@ -111,7 +111,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | windowStage | window.WindowStage | 鏄 | WindowStage鐩稿叧淇℃伅銆 | + | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 鏄 | WindowStage鐩稿叧淇℃伅銆 | **绀轰緥锛** @@ -219,7 +219,7 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; -褰揳bility鐨勫惎鍔ㄦā寮忚缃负鍗曚緥鏃跺洖璋冧細琚皟鐢ㄣ +褰撲紶鍏ユ柊鐨刉ant锛宎bility鍐嶆琚媺璧锋椂浼氬洖璋冩墽琛岃鏂规硶銆 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.AbilityCore @@ -234,8 +234,9 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; ```ts class myAbility extends Ability { - onNewWant(want) { + onNewWant(want, launchParams) { console.log('onNewWant, want:' + want.abilityName); + console.log('onNewWant, launchParams:' + JSON.stringify(launchParams)); } } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md index afd313ca4a34807a43e8b473ec67082cd02ac454..5d203e65258053d5df1822f037899289d4aab808 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityConstant.md @@ -21,8 +21,8 @@ import AbilityConstant from '@ohos.application.AbilityConstant'; | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | -| launchReason | LaunchReason| 鏄 | 鏄 | 鎸囩ず鍚姩鍘熷洜銆 | -| lastExitReason | LastExitReason | 鏄 | 鏄 | 琛ㄧず鏈鍚庨鍑哄師鍥犮 | +| launchReason | [LaunchReason](#abilityconstantlaunchreason)| 鏄 | 鏄 | 鎸囩ず鍚姩鍘熷洜銆 | +| lastExitReason | [LastExitReason](#abilityconstantlastexitreason) | 鏄 | 鏄 | 琛ㄧず鏈鍚庨鍑哄師鍥犮 | ## AbilityConstant.LaunchReason diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md index 7316469ebf390dacd4684f08a3b454cff18d6491..d61c81f1e9a5f3bb9c401506830ebd55f1a706d3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md @@ -1,6 +1,6 @@ # @ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry) -AbilityDelegatorRegistry妯″潡鎻愪緵鐢ㄤ簬瀛樺偍宸叉敞鍐岀殑AbilityDelegator鍜孉bilityDelegatorArgs瀵硅薄鐨勫叏灞瀵勫瓨鍣ㄧ殑鑳藉姏锛屽寘鎷幏鍙栧簲鐢ㄧ▼搴忕殑AbilityDelegator瀵硅薄銆佽幏鍙栧崟鍏冩祴璇曞弬鏁癆bilityDelegatorArgs瀵硅薄銆 +AbilityDelegatorRegistry妯″潡鎻愪緵鐢ㄤ簬瀛樺偍宸叉敞鍐岀殑AbilityDelegator鍜孉bilityDelegatorArgs瀵硅薄鐨勫叏灞瀵勫瓨鍣ㄧ殑鑳藉姏锛屽寘鎷幏鍙栧簲鐢ㄧ▼搴忕殑AbilityDelegator瀵硅薄銆佽幏鍙栧崟鍏冩祴璇曞弬鏁癆bilityDelegatorArgs瀵硅薄銆傝妯″潡涓殑鎺ュ彛鍙兘鐢ㄤ簬娴嬭瘯妗嗘灦涓 > **璇存槑锛** > diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md index b734967666cdd2beb6e8302137135c598d34c1e8..717f2bdcb2fa2e29dea7912d42b843e971681a43 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md @@ -112,7 +112,7 @@ getAbilityRunningInfos(callback: AsyncCallback\>): vo | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | --------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback\> | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | +| callback | AsyncCallback\> | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | **绀轰緥**锛 @@ -138,7 +138,7 @@ getAbilityRunningInfos(): Promise\> | 绫诲瀷 | 璇存槑 | | ---------------------------------------- | ------- | -| Promise\> | 杩斿洖鎵ц缁撴灉銆 | +| Promise\> | 杩斿洖鎵ц缁撴灉銆 | **绀轰緥**锛 @@ -150,119 +150,4 @@ abilitymanager.getAbilityRunningInfos().then((data) => { }).catch((err) => { console.log("getAbilityRunningInfos err: " + err) }); -``` - -## getExtensionRunningInfos9+ - -getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\>): void - -鑾峰彇鍏充簬杩愯鎵╁睍鑳藉姏鐨勪俊鎭紙callback褰㈠紡锛夈 - -**闇瑕佹潈闄**: ohos.permission.GET_RUNNING_INFO - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core - -**鍙傛暟**锛 - -| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | -| --------- | ---------------------------------------- | ---- | -------------- | -| upperLimit | number | 鏄 | 鑾峰彇娑堟伅鏁伴噺鐨勬渶澶ч檺鍒躲 | -| callback | AsyncCallback\> | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | - -**绀轰緥**锛 - -```ts -import abilitymanager from '@ohos.application.abilityManager'; - -var upperLimit = 0; - -abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => { - console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data)); -}); -``` - -## getExtensionRunningInfos9+ - -getExtensionRunningInfos(upperLimit: number): Promise\> - -鑾峰彇鍏充簬杩愯鎵╁睍鑳藉姏鐨勪俊鎭紙Promise褰㈠紡锛夈 - -**闇瑕佹潈闄**: ohos.permission.GET_RUNNING_INFO - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core - -**鍙傛暟**锛 - -| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | -| --------- | ---------------------------------------- | ---- | -------------- | -| upperLimit | number | 鏄 | 鑾峰彇娑堟伅鏁伴噺鐨勬渶澶ч檺鍒躲 | - -**杩斿洖鍊硷細** - -| 绫诲瀷 | 璇存槑 | -| ---------------------------------------- | ------- | -| Promise\> | 杩斿洖鎵ц缁撴灉銆 | - -**绀轰緥**锛 - -```ts -import abilitymanager from '@ohos.application.abilityManager'; - -var upperLimit = 0; - -abilitymanager.getExtensionRunningInfos(upperLimit).then((data) => { - console.log("getAbilityRunningInfos data: " + JSON.stringify(data)); -}).catch((err) => { - console.log("getAbilityRunningInfos err: " + err); -}) -``` - -## getTopAbility9+ - -getTopAbility(callback: AsyncCallback\): void; - -鑾峰彇绐楀彛鐒︾偣鐨刟bility鎺ュ彛锛坈allback褰㈠紡锛夈 - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core - -**鍙傛暟**锛 - -| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | -| --------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback\ | 鏄 | 琚寚瀹氱殑鍥炶皟鏂规硶銆 | - -**绀轰緥**锛 - -```ts -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getTopAbility((err,data) => { - console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data)); -}); -``` - -## getTopAbility9+ - -getTopAbility(): Promise\; - -鑾峰彇绐楀彛鐒︾偣鐨刟bility鎺ュ彛锛圥romise褰㈠紡锛夈 - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core - -**杩斿洖鍊硷細** - -| 绫诲瀷 | 璇存槑 | -| ---------------------------------------- | ------- | -| Promise\| 杩斿洖鎵ц缁撴灉銆 | - -**绀轰緥**锛 - -```ts -import abilitymanager from '@ohos.application.abilityManager'; - -abilitymanager.getTopAbility().then((data) => { - console.log("getTopAbility data: " + JSON.stringify(data)); -}).catch((err) => { - console.log("getTopAbility err: " + err); -}) ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md index 2804125a07b0e6406101d314360b1ec2874aadbb..ef6a02866bd167e79d6f7bd148403401b1daaec7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md @@ -31,7 +31,7 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | --------- | ---------------------------------------- | ---- | ---- | ---------- | | eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | 鏄 | 鍚 | 鍏蜂綋浜嬩欢绫诲瀷銆 | -| target | AccessibilityElement | 鏄 | 鍚 | 鍙戠敓浜嬩欢鐨勭洰鏍囩粍浠躲 | +| target | [AccessibilityElement](js-apis-inner-application-accessibilityExtensionContext.md#accessibilityelement9) | 鏄 | 鍚 | 鍙戠敓浜嬩欢鐨勭洰鏍囩粍浠躲 | | timeStamp | number | 鏄 | 鍚 | 浜嬩欢鏃堕棿鎴炽 | ## GestureType diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md index 5fd234ed4ac08c2fdc2617d73e0fcb870b05710c..2bd63a24e45ee5bb6f0d249266d9d53ca61c98a1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md @@ -121,7 +121,7 @@ getAppMemorySize(): Promise\; | 绫诲瀷 | 璇存槑 | | -------- | -------- | - | Promise<number> | 搴旂敤绋嬪簭鍐呭瓨澶у皬銆 | + | Promise<number> | 搴旂敤绋嬪簭鍐呭瓨澶у皬, 鍗曚綅涓篗銆 | **绀轰緥锛** @@ -145,7 +145,7 @@ getAppMemorySize(callback: AsyncCallback\): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<number> | 鏄 | 搴旂敤绋嬪簭鍐呭瓨澶у皬銆 | + | callback | AsyncCallback<number> | 鏄 | 搴旂敤绋嬪簭鍐呭瓨澶у皬, 鍗曚綅涓篗銆 | **绀轰緥锛** @@ -171,7 +171,7 @@ getProcessRunningInfos(): Promise\>; | 绫诲瀷 | 璇存槑 | | -------- | -------- | -| Promise\> | 鑾峰彇鏈夊叧杩愯杩涚▼鐨勪俊鎭 | +| Promise\> | 鑾峰彇鏈夊叧杩愯杩涚▼鐨勪俊鎭 | **绀轰緥锛** @@ -199,7 +199,7 @@ getProcessRunningInfos(callback: AsyncCallback\>): vo | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\> | 鏄 | 鑾峰彇鏈夊叧杩愯杩涚▼鐨勪俊鎭 | +| callback | AsyncCallback\> | 鏄 | 鑾峰彇鏈夊叧杩愯杩涚▼鐨勪俊鎭 | **绀轰緥锛** @@ -369,8 +369,8 @@ unregisterApplicationStateObserver(observerId: number): Promise\; getForegroundApplications(callback: AsyncCallback\>): void; -鑾峰彇鍓嶅彴杩涚▼鐨勫簲鐢ㄧ▼搴忋 - +鑾峰彇鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆傝搴旂敤淇℃伅鐢盵AppStateData](js-apis-inner-application-appStateData.md)瀹氫箟銆 + **闇瑕佹潈闄**锛歰hos.permission.GET_RUNNING_INFO **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -381,7 +381,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\> | 鏄 | 琛ㄧず搴旂敤鐨勭姸鎬佹暟鎹 | +| callback | AsyncCallback\> | 鏄 | callback褰㈠紡杩斿洖鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆 | **绀轰緥锛** @@ -400,7 +400,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; getForegroundApplications(): Promise\>; -鑾峰彇鍓嶅彴杩涚▼鐨勫簲鐢ㄧ▼搴忋 +鑾峰彇鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆傝搴旂敤淇℃伅鐢盵AppStateData](js-apis-inner-application-appStateData.md)瀹氫箟銆 **闇瑕佹潈闄**锛歰hos.permission.GET_RUNNING_INFO @@ -412,7 +412,7 @@ getForegroundApplications(): Promise\>; | 绫诲瀷 | 璇存槑 | | -------- | -------- | -| Promise\> | 杩斿洖杩涚▼杩愯淇℃伅鐨勬暟缁勩 | +| Promise\> | Promise褰㈠紡杩斿洖鎵鏈夊綋鍓嶅浜庡墠鍙扮殑搴旂敤淇℃伅銆 | **绀轰緥锛** @@ -633,32 +633,4 @@ clearUpApplicationData(bundleName: string): Promise\; .catch((err) => { console.log('------------ clearUpApplicationData fail ------------', err); }) - ``` - -## ApplicationState9+ - -**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core - -**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 - -| 鍚嶇О | 鍊 | 璇存槑 | -| -------------------- | --- | --------------------------------- | -| STATE_CREATE | 1 | 褰撳簲鐢ㄥ湪鍒涘缓涓殑鏃跺欏浜庣殑鐘舵併 | -| STATE_FOREGROUND | 2 | 褰撳簲鐢ㄥ垏鎹㈠埌鍓嶅彴鐨勬椂鍊欏浜庣殑鐘舵併 | -| STATE_ACTIVE | 3 | 褰撳簲鐢ㄥ湪鑾风劍鐨勬椂鍊欏浜庣殑鐘舵併 | -| STATE_BACKGROUND | 4 | 褰撳簲鐢ㄥ浜庡悗鍙颁笉鍙鏃跺浜庣殑鐘舵併 | -| STATE_DESTROY | 5 | 褰撳簲鐢ㄥ湪閿姣佺殑鏃跺欏浜庣殑鐘舵併 | - -## ProcessState9+ - -**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core - -**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 - -| 鍚嶇О | 鍊 | 璇存槑 | -| -------------------- | --- | --------------------------------- | -| STATE_CREATE | 1 | 褰撹繘绋嬪湪鍒涘缓涓殑鏃跺欏浜庣殑鐘舵併 | -| STATE_FOREGROUND | 2 | 褰撹繘绋嬪垏鎹㈠埌鍓嶅彴鐨勬椂鍊欏浜庣殑鐘舵併 | -| STATE_ACTIVE | 3 | 褰撹繘绋嬪湪鑾风劍鐨勬椂鍊欏浜庣殑鐘舵併 | -| STATE_BACKGROUND | 4 | 褰撹繘绋嬪浜庡悗鍙颁笉鍙鏃跺浜庣殑鐘舵併 | -| STATE_DESTROY | 5 | 褰撹繘绋嬪湪閿姣佺殑鏃跺欏浜庣殑鐘舵併 | \ No newline at end of file + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md index b632f5ddd1e8703b864c507ec8376325bfc6a88f..1e4211c7b01b29f38829f231f2b9f054db71b47c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md @@ -1,27 +1,17 @@ # @ohos.application.Configuration (Configuration) -瀹氫箟鐜鍙樺寲淇℃伅銆 +瀹氫箟鐜鍙樺寲淇℃伅銆侰onfiguration鏄帴鍙e畾涔夛紝浠呭仛瀛楁澹版槑銆 > **璇存槑锛** > 鏈ā鍧楅鎵规帴鍙d粠API version 8寮濮嬫敮鎸併傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 > 鏈ā鍧椾粠API version 9搴熷純锛屾浛鎹㈡ā鍧椾负[@ohos.app.ability.Configuration (Configuration)](js-apis-app-ability-configuration.md) -## 瀵煎叆妯″潡 - -```ts -import Configuration from '@ohos.application.Configuration' -``` - **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | | language8+ | string | 鏄 | 鏄 | 琛ㄧず搴旂敤绋嬪簭鐨勫綋鍓嶈瑷銆 | | colorMode8+ | [ColorMode](js-apis-application-configurationConstant.md#configurationconstantcolormode) | 鏄 | 鏄 | 琛ㄧず娣辨祬鑹叉ā寮忥紝鍙栧艰寖鍥达細娴呰壊妯″紡锛圕OLOR_MODE_LIGHT锛夛紝娣辫壊妯″紡锛圕OLOR_MODE_DARK锛夈傞粯璁や负娴呰壊銆 | -| direction9+ | [Direction](js-apis-application-configurationConstant.md#configurationconstantdirection9) | 鏄 | 鍚 | 琛ㄧず灞忓箷鏂瑰悜锛屽彇鍊艰寖鍥达細姘村钩鏂瑰悜锛圖IRECTION_HORIZONTAL锛夛紝鍨傜洿鏂瑰悜锛圖IRECTION_VERTICAL锛夈 | -| screenDensity9+ | [ScreenDensity](js-apis-application-configurationConstant.md#configurationconstantscreendensity9) | 鏄 | 鍚 | 琛ㄧず灞忓箷鍒嗚鲸鐜囷紝鍙栧艰寖鍥达細SCREEN_DENSITY_SDPI锛120锛夈丼CREEN_DENSITY_MDPI锛160锛夈丼CREEN_DENSITY_LDPI锛240锛夈丼CREEN_DENSITY_XLDPI锛320锛夈丼CREEN_DENSITY_XXLDPI锛480锛夈丼CREEN_DENSITY_XXXLDPI锛640锛夈 | -| displayId9+ | number | 鏄 | 鍚 | 琛ㄧず搴旂敤鎵鍦ㄧ殑鐗╃悊灞忓箷Id銆 | -| hasPointerDevice9+ | boolean | 鏄 | 鍚 | 鎸囩ず鎸囬拡绫诲瀷璁惧鏄惁宸茶繛鎺ワ紝濡傞敭榧犮佽Е鎺ф澘绛夈 | 鍏蜂綋瀛楁鎻忚堪鍙傝僶hos.application.Configuration.d.ts鏂囦欢 @@ -45,10 +35,6 @@ export default class MainAbility extends Ability { console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`) let language = config.language; let colorMode = config.colorMode; - let direction = config.direction; - let screenDensity = config.screenDensity; - let displayId = config.displayId; - let hasPointerDevice = config.hasPointerDevice; } }; diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-configurationConstant.md b/zh-cn/application-dev/reference/apis/js-apis-application-configurationConstant.md index f7908e521cbbe805352a7c305f00340ce8e9be20..43c5dd975a8ccf19622bfae531774001f2199f0e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-configurationConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-configurationConstant.md @@ -24,32 +24,3 @@ import ConfigurationConstant from '@ohos.application.ConfigurationConstant'; | COLOR_MODE_DARK | 0 | 娣辫壊妯″紡銆 | | COLOR_MODE_LIGHT | 1 | 娴呰壊妯″紡銆 | - -## ConfigurationConstant.Direction9+ - -浣跨敤鏃堕氳繃ConfigurationConstant.Direction鑾峰彇銆 - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase - -| 鍚嶇О | 鍊 | 璇存槑 | -| -------- | -------- | -------- | -| DIRECTION_NOT_SET | -1 | 鏈缃柟鍚戙 | -| DIRECTION_VERTICAL | 0 | 鍨傜洿鏂瑰悜銆 | -| DIRECTION_HORIZONTAL | 1 | 姘村钩鏂瑰悜銆 | - - -## ConfigurationConstant.ScreenDensity9+ - -浣跨敤鏃堕氳繃ConfigurationConstant.ScreenDensity鑾峰彇銆 - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase - -| 鍚嶇О | 鍊 | 璇存槑 | -| -------- | -------- | -------- | -| SCREEN_DENSITY_NOT_SET | 0 | 鏈缃睆骞曞垎杈ㄧ巼銆 | -| SCREEN_DENSITY_SDPI | 120 | 灞忓箷鍒嗚鲸鐜囦负"sdpi"銆 | -| SCREEN_DENSITY_MDPI | 160 | 灞忓箷鍒嗚鲸鐜囦负"mdpi"銆 | -| SCREEN_DENSITY_LDPI | 240 | 灞忓箷鍒嗚鲸鐜囦负"ldpi"銆 | -| SCREEN_DENSITY_XLDPI | 320 | 灞忓箷鍒嗚鲸鐜囦负"xldpi"銆 | -| SCREEN_DENSITY_XXLDPI | 480 | 灞忓箷鍒嗚鲸鐜囦负"xxldpi"銆 | -| SCREEN_DENSITY_XXXLDPI | 640 | 灞忓箷鍒嗚鲸鐜囦负"xxxldpi"銆 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-application-context.md deleted file mode 100644 index c5253ad01b9b50bff483ae8f0ab7e7234f43dfd0..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/apis/js-apis-application-context.md +++ /dev/null @@ -1,41 +0,0 @@ -# @ohos.application.context (Context) - -Context妯″潡灏嗕簩绾фā鍧桝PI缁勭粐鍦ㄤ竴璧锋柟渚垮紑鍙戣呰繘琛屽鍑恒 - -> **璇存槑锛** -> -> 鏈ā鍧楅鎵规帴鍙d粠API version 9寮濮嬫敮鎸併傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 -> 鏈ā鍧楁帴鍙d粎鍙湪Stage妯″瀷涓嬩娇鐢 - -## 瀵煎叆妯″潡 - -```ts -import context from '@ohos.application.context' -``` - -**绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase - -| 鍚嶇О | 璇诲啓灞炴 | 绫诲瀷 | 蹇呭~ | 鎻忚堪 | -| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| AbilityContext | 鍙 | [AbilityContext](js-apis-ability-context.md) | 鍚 | AbilityContext浜岀骇妯″潡銆 | -| AbilityStageContext | 鍙 | [AbilityStageContext](js-apis-inner-application-abilityStageContext.md) | 鍚 | AbilityStageContext浜岀骇妯″潡銆 | -| ApplicationContext | 鍙 | [ApplicationContext](js-apis-inner-application-applicationContext.md) | 鍚 | ApplicationContext浜岀骇妯″潡銆 | -| BaseContext | 鍙 | [BaseContext](js-apis-inner-application-baseContext.md) | 鍚 | BaseContext浜岀骇妯″潡銆 | -| Context | 鍙 | [Context](js-apis-inner-application-context.md) | 鍚 | Context浜岀骇妯″潡銆 | -| ExtensionContext | 鍙 | [ExtensionContext](js-apis-inner-application-extensionContext.md) | 鍚 | ExtensionContext浜岀骇妯″潡銆 | -| FormExtensionContext | 鍙 | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | 鍚 | FormExtensionContext浜岀骇妯″潡銆 | -| EventHub | 鍙 | [EventHub](js-apis-inner-application-eventHub.md) | 鍚 | EventHub浜岀骇妯″潡銆 | -| PermissionRequestResult | 鍙 | [PermissionRequestResult](js-apis-inner-application-permissionRequestResult.md) | 鍚 | PermissionRequestResult浜岀骇妯″潡銆 | - -**绀轰緥锛** -```ts -let abilityContext: context.AbilityContext; -let abilityStageContext: context.AbilityStageContext; -let applicationContext: context.ApplicationContext; -let baseContext: context.BaseContext; -let context: context.Context; -let extensionContext: context.ExtensionContext; -let formExtensionContext: context.FormExtensionContext; -let eventHub: context.EventHub; -let permissionRequestResult: context.PermissionRequestResult; -``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-extensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-extensionAbility.md deleted file mode 100644 index 807159d2145c83f533e8ea242820088d352f75ef..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/apis/js-apis-application-extensionAbility.md +++ /dev/null @@ -1,62 +0,0 @@ -# @ohos.application.ExtensionAbility (ExtensionAbility) - -ExtensionAbility妯″潡鎻愪緵瀵笶xtensionAbility鐢熷懡鍛ㄦ湡銆佷笂涓嬫枃鐜绛夎皟鐢ㄧ鐞嗙殑鑳藉姏锛屽寘鎷珽xtensionAbility鍒涘缓銆侀攢姣併佽浆鍌ㄥ鎴风淇℃伅绛夈 - -> **璇存槑锛** -> -> 鏈ā鍧楅鎵规帴鍙d粠API version 9 寮濮嬫敮鎸併傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 -> 鏈ā鍧楁帴鍙d粎鍙湪Stage妯″瀷涓嬩娇鐢ㄣ - -## 瀵煎叆妯″潡 - -```ts -import ExtensionAbility from '@ohos.application.ExtensionAbility'; -``` - -## ExtensionAbility.onConfigurationUpdated - -onConfigurationUpdated(newConfig: Configuration): void; - -褰撶郴缁熼厤缃洿鏂版椂璋冪敤銆 - -**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core - -**鍙傛暟锛** - - | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | - | -------- | -------- | -------- | -------- | - | newConfig | [Configuration](js-apis-application-configuration.md) | 鏄 | 琛ㄧず闇瑕佹洿鏂扮殑閰嶇疆淇℃伅銆 | - -**绀轰緥锛** - - ```ts - class MyExtensionAbility extends ExtensionAbility { - onConfigurationUpdated(config) { - console.log('onConfigurationUpdated, config:' + JSON.stringify(config)); - } - } - ``` - -## ExtensionAbility.onMemoryLevel - -onMemoryLevel(level: AbilityConstant.MemoryLevel): void; - -褰撶郴缁熷凡鍐冲畾璋冩暣鍐呭瓨鏃惰皟鐢ㄣ備緥濡傦紝褰撹鍔熻兘鍦ㄥ悗鍙拌繍琛屾椂锛屾病鏈夎冻澶熺殑鍐呭瓨鏉ヨ繍琛屽敖鍙兘澶氱殑鍚庡彴杩涚▼鏃跺彲浠ヤ娇鐢ㄣ - -**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.AbilityCore - -**鍙傛暟锛** - - | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | - | -------- | -------- | -------- | -------- | - | level | [AbilityConstant.MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | 鏄 | 鍥炶皟杩斿洖鍐呭瓨寰皟绾у埆锛屾樉绀哄綋鍓嶅唴瀛樹娇鐢ㄧ姸鎬併倈 - -**绀轰緥锛** - - ```ts - class MyExtensionAbility extends ExtensionAbility { - onMemoryLevel(level) { - console.log('onMemoryLevel, level:' + JSON.stringify(level)); - } - } - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md index 21b6a8f94ec1289e3b51740c8b7fdea15f13d2c9..db27ea9695657671148f45f203201f4095180466 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md @@ -31,12 +31,9 @@ onReceiveEvent(event: CommonEventData): void; **绀轰緥锛** ```ts - var StaticSubscriberExtensionAbility = requireNapi("application.StaticSubscriberExtensionAbility") - { - onReceiveEvent(event){ - console.log('onReceiveEvent,event:' + event.code); - } - } - export default MyStaticSubscriberExtensionAbility - + class MyStaticSubscriberExtensionAbility extends StaticSubscriberExtensionAbility { + onReceiveEvent(event) { + console.log("onReceiveEvent, event: " + JSON.stringify(event)) + } + } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-want.md b/zh-cn/application-dev/reference/apis/js-apis-application-want.md index 972d7e6e118dc8c4f9ee9562d439c48bf1be0ebb..63c9523e66a7cc67b9483aef3b0a4e2a9b713a9a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-want.md @@ -4,7 +4,7 @@ Want鏄璞¢棿淇℃伅浼犻掔殑杞戒綋, 鍙互鐢ㄤ簬搴旂敤缁勪欢闂寸殑淇℃伅浼 > **璇存槑锛** > -> 鏈ā鍧楅鎵规帴鍙d粠API version 8 寮濮嬫敮鎸併傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 +> 鏈ā鍧楅鎵规帴鍙d粠API version 8 寮濮嬫敮鎸侊紝浠嶢PI version 9搴熷純锛屾浛鎹㈡ā鍧椾负[@ohos.app.ability.Want](js-apis-app-ability-want.md)銆傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 ## 瀵煎叆妯″潡 @@ -25,7 +25,7 @@ import Want from '@ohos.application.Want'; | type | string | 鍚 | 琛ㄧずMIME type绫诲瀷鎻忚堪锛屾墦寮鏂囦欢鐨勭被鍨嬶紝涓昏鐢ㄤ簬鏂囩鎵撳紑鏂囦欢銆傛瘮濡傦細"text/xml" 銆 "image/*"绛夛紝MIME瀹氫箟鍙傝冿細https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com銆 | | flags | number | 鍚 | 琛ㄧず澶勭悊Want鐨勬柟寮忋傞粯璁や紶鏁板瓧锛屽叿浣撳弬鑰冿細[flags璇存槑](js-apis-ability-wantConstant.md#wantConstant.Flags)銆 | | action | string | 鍚 | 琛ㄧず瑕佹墽琛岀殑閫氱敤鎿嶄綔锛堝锛氭煡鐪嬨佸垎浜佸簲鐢ㄨ鎯咃級銆傚湪闅愬紡Want涓紝鎮ㄥ彲浠ュ畾涔夎瀛楁锛岄厤鍚坲ri鎴杙arameters鏉ヨ〃绀哄鏁版嵁瑕佹墽琛岀殑鎿嶄綔銆 | -| parameters | {[key: string]: any} | 鍚 | 琛ㄧずWantParams鎻忚堪锛岀敱寮鍙戣呰嚜琛屽喅瀹氫紶鍏ョ殑閿煎銆傞粯璁や細鎼哄甫浠ヤ笅key鍊硷細
ohos.aafwk.callerPid 琛ㄧず鎷夎捣鏂圭殑pid銆
ohos.aafwk.param.callerToken 琛ㄧず鎷夎捣鏂圭殑token銆
ohos.aafwk.param.callerUid 琛ㄧず[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)涓殑uid锛屽簲鐢ㄥ寘閲屽簲鐢ㄧ▼搴忕殑uid銆 | +| parameters | {[key: string]: any} | 鍚 | 琛ㄧずWantParams鎻忚堪锛岀敱寮鍙戣呰嚜琛屽喅瀹氫紶鍏ョ殑閿煎銆傞粯璁や細鎼哄甫浠ヤ笅key鍊硷細
ohos.aafwk.callerPid 琛ㄧず鎷夎捣鏂圭殑pid銆
ohos.aafwk.param.callerToken 琛ㄧず鎷夎捣鏂圭殑token銆
ohos.aafwk.param.callerUid 琛ㄧず[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)涓殑uid锛屽簲鐢ㄥ寘閲屽簲鐢ㄧ▼搴忕殑uid銆
- component.startup.newRules锛氳〃绀烘槸鍚﹀惎鐢ㄦ柊鐨勭鎺ц鍒欍
- moduleName锛氳〃绀烘媺璧锋柟鐨勬ā鍧楀悕锛岃瀛楁鐨勫煎嵆浣垮畾涔夋垚鍏朵粬瀛楃涓诧紝鍦ㄤ紶閫掑埌鍙︿竴绔椂浼氳淇敼涓烘纭殑鍊笺
- ohos.dlp.params.sandbox锛氳〃绀篸lp鏂囦欢鎵嶄細鏈夈 | | | entities | Array\ | 鍚 | 琛ㄧず鐩爣Ability棰濆鐨勭被鍒俊鎭紙濡傦細娴忚鍣ㄣ佽棰戞挱鏀惧櫒锛夛紝鍦ㄩ殣寮廤ant涓槸瀵筧ction瀛楁鐨勮ˉ鍏呫傚湪闅愬紡Want涓紝鎮ㄥ彲浠ュ畾涔夎瀛楁锛屾潵杩囨护鍖归厤Ability绫诲瀷銆 | | moduleName9+ | string | 鍚 | 琛ㄧず寰呭惎鍔ㄧ殑Ability鎵灞炵殑妯″潡锛坢odule锛夈 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md index efed827ea454ccca8441b20d897ce01591783ab3..fa4599ed7a537d6f4bc802e10e0ad9777b19645c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md @@ -205,9 +205,9 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { Stage妯″瀷绀轰緥锛 ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.backgroundTaskManager'; -import wantAgent from '@ohos.wantAgent'; +import wantAgent from '@ohos.app.ability.wantAgent'; function callback(err, data) { if (err) { @@ -217,13 +217,13 @@ function callback(err, data) { } } -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { let wantAgentInfo = { wants: [ { bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility" + abilityName: "EntryAbility" } ], operationType: wantAgent.OperationType.START_ABILITY, @@ -297,17 +297,17 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { Stage妯″瀷绀轰緥锛 ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.backgroundTaskManager'; -import wantAgent from '@ohos.wantAgent'; +import wantAgent from '@ohos.app.ability.wantAgent'; -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { let wantAgentInfo = { wants: [ { bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility" + abilityName: "EntryAbility" } ], operationType: wantAgent.OperationType.START_ABILITY, @@ -365,7 +365,7 @@ backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext(), callbac Stage妯″瀷绀轰緥锛 ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.backgroundTaskManager'; function callback(err, data) { @@ -376,7 +376,7 @@ function callback(err, data) { } } -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { backgroundTaskManager.stopBackgroundRunning(this.context, callback); } @@ -422,10 +422,10 @@ backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() Stage妯″瀷绀轰緥锛 ```ts -import Ability from '@ohos.application.Ability'; +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.backgroundTaskManager'; -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { backgroundTaskManager.stopBackgroundRunning(this.context).then(() => { console.info("Operation stopBackgroundRunning succeeded"); diff --git a/zh-cn/application-dev/reference/apis/js-apis-battery-info.md b/zh-cn/application-dev/reference/apis/js-apis-battery-info.md index e1d8fcba7fcfec4f65a7071443352345e95d0850..6013eb8cd4cf6ec626fd097fdedba537febb53d3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-battery-info.md +++ b/zh-cn/application-dev/reference/apis/js-apis-battery-info.md @@ -84,12 +84,13 @@ import batteryInfo from '@ohos.batteryInfo'; | 鍚嶇О | 鍊 | 璇存槑 | | -------------- | ------ | ---------------------------- | -| LEVEL_NONE | 0 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇鏈煡銆 | | LEVEL_FULL | 1 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓烘弧鐢甸噺銆 | | LEVEL_HIGH | 2 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓洪珮鐢甸噺銆 | | LEVEL_NORMAL | 3 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓烘甯哥數閲忋 | | LEVEL_LOW | 4 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓轰綆鐢甸噺銆 | -| LEVEL_CRITICAL | 5 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓烘瀬浣庣數閲忋 | +| LEVEL_WARNING | 5 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓哄憡璀︾數閲忋 | +| LEVEL_CRITICAL | 6 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓烘瀬浣庣數閲忋 | +| LEVEL_SHUTDOWN | 7 | 琛ㄧず鐢垫睜鐢甸噺绛夌骇涓哄叧鏈虹數閲忋 | ## CommonEventBatteryChangedCode9+ @@ -110,3 +111,4 @@ import batteryInfo from '@ohos.batteryInfo'; | EXTRA_CHARGE_COUNTER | 8 | 琛ㄧず褰撳墠璁惧鐢垫睜鍏呯數娆℃暟鐨勬煡璇㈤敭銆 | | EXTRA_PRESENT | 9 | 琛ㄧず褰撳墠璁惧鏄惁鏀寔鐢垫睜鎴栬呯數姹犳槸鍚﹀湪浣嶇殑鏌ヨ閿 | | EXTRA_TECHNOLOGY | 10 | 琛ㄧず褰撳墠璁惧鐢垫睜鎶鏈瀷鍙风殑鏌ヨ閿 | +| EXTRA_CAPACITY_LEVEL | 11 | 琛ㄧず褰撳墠璁惧鐢垫睜鐢甸噺绛夌骇鐨勬煡璇㈤敭銆 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md index 52c116bbe5cf55ff943782f0142d752bdd94fa42..9e16c1775ccaaaafc4cb50c35440e2caed7e196b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md @@ -571,8 +571,9 @@ stopDeviceDiscovery(subscribeId: number): void **绀轰緥锛** ```js - // 鍏ュ弬闇瑕佸拰startDeviceDiscovery鎺ュ彛浼犲叆鐨剆ubscribeId閰嶅浣跨敤 try { + // stopDeviceDiscovery鍜宻tartDeviceDiscovery闇閰嶅浣跨敤锛屽叆鍙傞渶瑕佸拰startDeviceDiscovery鎺ュ彛浼犲叆鐨剆ubscribeId鍊肩浉绛 + var subscribeId = 12345; dmInstance.stopDeviceDiscovery(subscribeId); } catch (err) { console.error("stopDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message); @@ -611,7 +612,7 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void "publishId": publishId, "mode": 0xAA, // 涓诲姩妯″紡 "freq": 2, // 楂橀鐜 - "ranging": 1 // 鏀寔鍙戠幇鏃舵祴璺 + "ranging": true // 鏀寔鍙戠幇鏃舵祴璺 }; try { dmInstance.publishDeviceDiscovery(publishInfo); // 褰撴湁鍙戝竷缁撴灉鏃讹紝閫氳繃鍥炶皟閫氱煡缁欏簲鐢ㄧ▼搴 @@ -645,8 +646,9 @@ unPublishDeviceDiscovery(publishId: number): void **绀轰緥锛** ```js - // 鍏ュ弬闇瑕佸拰publishDeviceDiscovery鎺ュ彛浼犲叆鐨刾ublishId閰嶅浣跨敤 try { + // unPublishDeviceDiscovery鍜宲ublishDeviceDiscovery閰嶅浣跨敤锛屽叆鍙傞渶瑕佸拰publishDeviceDiscovery鎺ュ彛浼犲叆鐨刾ublishId鍊肩浉绛 + var publishId = 12345; dmInstance.unPublishDeviceDiscovery(publishId); } catch (err) { console.error("unPublishDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message); @@ -685,11 +687,19 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async var deviceInfo ={ "deviceId": "XXXXXXXX", "deviceName": "", - deviceType: 0x0E + "deviceType": 0x0E, + "networkId" : "xxxxxxx", + "range" : 0 }; + let extraInfo = { + 'targetPkgName': 'ohos.samples.xxx', + 'appName': 'xxx', + 'appDescription': 'xxx', + 'business': '0' + } let authParam = { - "authType": 1, // 璁よ瘉绫诲瀷锛 1 - 鏃犲笎鍙稰IN鐮佽璇 - "extraInfo": {} + 'authType': 1,// 璁よ瘉绫诲瀷锛 1 - 鏃犲笎鍙稰IN鐮佽璇 + 'extraInfo': extraInfo } try { dmInstance.authenticateDevice(deviceInfo, authParam, (err, data) => { @@ -731,6 +741,13 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void ```js try { + var deviceInfo ={ + "deviceId": "XXXXXXXX", + "deviceName": "", + "deviceType": 0x0E, + "networkId" : "xxxxxxx", + "range" : 0 + }; dmInstance.unAuthenticateDevice(deviceInfo); } catch (err) { console.error("unAuthenticateDevice errCode:" + err.code + ",errMessage:" + err.message); @@ -765,7 +782,7 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, ```js let authInfo = { "authType": 1, - "token": xxxxxx, + "token": 123456, "extraInfo": {} } try { @@ -809,7 +826,7 @@ setUserOperation(operateAction: number, params: string): void; operateAction = 5 - pin鐮佽緭鍏ユ纭畾鎿嶄綔 */ let operation = 0; - this.dmInstance.setUserOperation(operation, "extra") + dmInstance.setUserOperation(operation, "extra") } catch (err) { console.error("setUserOperation errCode:" + err.code + ",errMessage:" + err.message); } @@ -837,11 +854,8 @@ ui鐘舵佸彉鏇村洖璋冦 dmInstance.on('uiStateChange', (data) => { console.log("uiStateChange executed, dialog closed" + JSON.stringify(data)) var tmpStr = JSON.parse(data.param) - this.isShow = tmpStr.verifyFailed - console.log("uiStateChange executed, dialog closed" + this.isShow) - if (!this.isShow) { - this.destruction() - } + var isShow = tmpStr.verifyFailed + console.log("uiStateChange executed, dialog closed" + isShow) }); } catch (err) { console.error("uiStateChange errCode:" + err.code + ",errMessage:" + err.message); diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md b/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md index 0382803a154a023dd21abca0f9333618f9ab4bf5..c8ced91e73e6b52952098b952e99843848237b73 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md @@ -2846,7 +2846,7 @@ try { ### get -get(key: string, callback: AsyncCallback): void +get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void 鑾峰彇鎸囧畾閿殑鍊硷紝浣跨敤callback寮傛鍥炶皟銆 @@ -2897,7 +2897,7 @@ try { ### get -get(key: string): Promise<boolean | string| number | Uint8Array> +get(key: string): Promise<boolean | string | number | Uint8Array> 鑾峰彇鎸囧畾閿殑鍊硷紝浣跨敤Promise寮傛鍥炶皟銆 @@ -4848,7 +4848,7 @@ try { ### get -get(key: string, callback: AsyncCallback): void +get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void 鑾峰彇鏈澶囨寚瀹氶敭鐨勫硷紝浣跨敤callback寮傛鍥炶皟銆 @@ -4899,7 +4899,7 @@ try { ### get -get(key: string): Promise<boolean | string| number | Uint8Array> +get(key: string): Promise<boolean | string | number | Uint8Array> 鑾峰彇鏈澶囨寚瀹氶敭鐨勫硷紝浣跨敤Promise寮傛鍥炶皟銆 @@ -4951,7 +4951,7 @@ try { ### get -get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|number|Uint8Array>): void +get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void 鑾峰彇涓庢寚瀹氳澶嘔D鍜宬ey鍖归厤鐨剆tring鍊硷紝浣跨敤callback寮傛鍥炶皟銆 @@ -5003,7 +5003,7 @@ try { ### get -get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array> +get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array> 鑾峰彇涓庢寚瀹氳澶嘔D鍜宬ey鍖归厤鐨剆tring鍊硷紝浣跨敤Promise寮傛鍥炶皟銆 diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-environment.md b/zh-cn/application-dev/reference/apis/js-apis-file-environment.md index a3d891cf5660e8ece94b572669be80dd6f54a049..f6bb1c415116c14505e2cc211caa15e78c1ccc99 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-environment.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-environment.md @@ -30,9 +30,9 @@ getStorageDataDir():Promise<string> **绀轰緥锛** ```js - environment.getStorageDataDir().then(function (path) { + environment.getStorageDataDir().then((path) => { console.info("getStorageDataDir successfully, Path: " + path); - }).catch(function (err) { + }).catch((err) => { console.info("getStorageDataDir failed with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -54,7 +54,7 @@ getStorageDataDir(callback:AsyncCallback<string>):void **绀轰緥锛** ```js - environment.getStorageDataDir(function (error, path) { + environment.getStorageDataDir((err, path) => { if (err) { console.info("getStorageDataDir failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -80,9 +80,9 @@ getUserDataDir():Promise<string> **绀轰緥锛** ```js - environment.getUserDataDir().then(function (path) { + environment.getUserDataDir().then((path) => { console.info("getUserDataDir successfully, Path: " + path); - }).catch(function (err) { + }).catch((err) => { console.info("getUserDataDir failed with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -104,7 +104,7 @@ getUserDataDir(callback:AsyncCallback<string>): void **绀轰緥锛** ```js - environment.getUserDataDir(function (err, path) { + environment.getUserDataDir((err, path) => { if (err) { console.info("getUserDataDir failed with error message: " + err.message + ", error code: " + err.code); } else { diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md index 0d4dce46885203594d419320d5aae0ff09208ad3..a0271c550005f13ed9f863c593649fa55da5d611 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md @@ -481,7 +481,7 @@ mkdirSync(path: string): void ## fs.open -open(path: string, flags?: number): Promise<File> +open(path: string, mode?: number): Promise<File> 鎵撳紑鏂囦欢锛屼娇鐢≒romise寮傛鍥炶皟銆傛敮鎸佷娇鐢║RI鎵撳紑鏂囦欢銆 @@ -492,7 +492,7 @@ open(path: string, flags?: number): Promise<File> | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | 鏄 | 鏂囦欢鐨勫簲鐢ㄦ矙绠辫矾寰勬垨鏂囦欢URI銆 | -| flags | number | 鍚 | 鎵撳紑鏂囦欢鐨刐閫夐」](#openmode)锛屽繀椤绘寚瀹氬涓嬮夐」涓殑涓涓紝榛樿浠ュ彧璇绘柟寮忔墦寮锛
- OpenMode.READ_ONLY(0o0)锛氬彧璇绘墦寮銆
- OpenMode.WRITE_ONLY(0o1)锛氬彧鍐欐墦寮銆
- OpenMode.READ_WRITE(0o2)锛氳鍐欐墦寮銆
缁欏畾濡備笅鍔熻兘閫夐」锛屼互鎸変綅鎴栫殑鏂瑰紡杩藉姞锛岄粯璁や笉缁欏畾浠讳綍棰濆閫夐」锛
- OpenMode.CREATE(0o100)锛氳嫢鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘枃浠躲
- OpenMode.TRUNC(0o1000)锛氬鏋滄枃浠跺瓨鍦ㄤ笖浠ュ彧鍐欐垨璇诲啓鐨勬柟寮忔墦寮鏂囦欢锛屽垯灏嗗叾闀垮害瑁佸壀涓洪浂銆
- OpenMode.APPEND(0o2000)锛氫互杩藉姞鏂瑰紡鎵撳紑锛屽悗缁啓灏嗚拷鍔犲埌鏂囦欢鏈熬銆
- OpenMode.NONBLOCK(0o4000)锛氬鏋減ath鎸囧悜FIFO銆佸潡鐗规畩鏂囦欢鎴栧瓧绗︾壒娈婃枃浠讹紝鍒欐湰娆℃墦寮鍙婂悗缁 IO 杩涜闈為樆濉炴搷浣溿
- OpenMode.DIR(0o200000)锛氬鏋減ath涓嶆寚鍚戠洰褰曪紝鍒欏嚭閿欍
- OpenMode.NOFOLLOW(0o400000)锛氬鏋減ath鎸囧悜绗﹀彿閾炬帴锛屽垯鍑洪敊銆
- OpenMode.SYNC(0o4010000)锛氫互鍚屾IO鐨勬柟寮忔墦寮鏂囦欢銆 | +| mode | number | 鍚 | 鎵撳紑鏂囦欢鐨刐閫夐」](#openmode)锛屽繀椤绘寚瀹氬涓嬮夐」涓殑涓涓紝榛樿浠ュ彧璇绘柟寮忔墦寮锛
- OpenMode.READ_ONLY(0o0)锛氬彧璇绘墦寮銆
- OpenMode.WRITE_ONLY(0o1)锛氬彧鍐欐墦寮銆
- OpenMode.READ_WRITE(0o2)锛氳鍐欐墦寮銆
缁欏畾濡備笅鍔熻兘閫夐」锛屼互鎸変綅鎴栫殑鏂瑰紡杩藉姞锛岄粯璁や笉缁欏畾浠讳綍棰濆閫夐」锛
- OpenMode.CREATE(0o100)锛氳嫢鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘枃浠躲
- OpenMode.TRUNC(0o1000)锛氬鏋滄枃浠跺瓨鍦ㄤ笖浠ュ彧鍐欐垨璇诲啓鐨勬柟寮忔墦寮鏂囦欢锛屽垯灏嗗叾闀垮害瑁佸壀涓洪浂銆
- OpenMode.APPEND(0o2000)锛氫互杩藉姞鏂瑰紡鎵撳紑锛屽悗缁啓灏嗚拷鍔犲埌鏂囦欢鏈熬銆
- OpenMode.NONBLOCK(0o4000)锛氬鏋減ath鎸囧悜FIFO銆佸潡鐗规畩鏂囦欢鎴栧瓧绗︾壒娈婃枃浠讹紝鍒欐湰娆℃墦寮鍙婂悗缁 IO 杩涜闈為樆濉炴搷浣溿
- OpenMode.DIR(0o200000)锛氬鏋減ath涓嶆寚鍚戠洰褰曪紝鍒欏嚭閿欍
- OpenMode.NOFOLLOW(0o400000)锛氬鏋減ath鎸囧悜绗﹀彿閾炬帴锛屽垯鍑洪敊銆
- OpenMode.SYNC(0o4010000)锛氫互鍚屾IO鐨勬柟寮忔墦寮鏂囦欢銆 | **杩斿洖鍊硷細** @@ -514,7 +514,7 @@ open(path: string, flags?: number): Promise<File> ## fs.open -open(path: string, flags?: number, callback: AsyncCallback<File>): void +open(path: string, mode?: number, callback: AsyncCallback<File>): void 鎵撳紑鏂囦欢锛屼娇鐢╟allback寮傛鍥炶皟銆傛敮鎸佷娇鐢║RI鎵撳紑鏂囦欢銆 @@ -525,7 +525,7 @@ open(path: string, flags?: number, callback: AsyncCallback<File>): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | path | string | 鏄 | 鏂囦欢鐨勫簲鐢ㄦ矙绠辫矾寰勬垨URI銆 | -| flags | number | 鍚 | 鎵撳紑鏂囦欢鐨刐閫夐」](#openmode)锛屽繀椤绘寚瀹氬涓嬮夐」涓殑涓涓紝榛樿浠ュ彧璇绘柟寮忔墦寮锛
- OpenMode.READ_ONLY(0o0)锛氬彧璇绘墦寮銆
- OpenMode.WRITE_ONLY(0o1)锛氬彧鍐欐墦寮銆
- OpenMode.READ_WRITE(0o2)锛氳鍐欐墦寮銆
缁欏畾濡備笅鍔熻兘閫夐」锛屼互鎸変綅鎴栫殑鏂瑰紡杩藉姞锛岄粯璁や笉缁欏畾浠讳綍棰濆閫夐」锛
- OpenMode.CREATE(0o100)锛氳嫢鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘枃浠躲
- OpenMode.TRUNC(0o1000)锛氬鏋滄枃浠跺瓨鍦ㄤ笖浠ュ彧鍐欐垨璇诲啓鐨勬柟寮忔墦寮鏂囦欢锛屽垯灏嗗叾闀垮害瑁佸壀涓洪浂銆
- OpenMode.APPEND(0o2000)锛氫互杩藉姞鏂瑰紡鎵撳紑锛屽悗缁啓灏嗚拷鍔犲埌鏂囦欢鏈熬銆
- OpenMode.NONBLOCK(0o4000)锛氬鏋減ath鎸囧悜FIFO銆佸潡鐗规畩鏂囦欢鎴栧瓧绗︾壒娈婃枃浠讹紝鍒欐湰娆℃墦寮鍙婂悗缁 IO 杩涜闈為樆濉炴搷浣溿
- OpenMode.DIR(0o200000)锛氬鏋減ath涓嶆寚鍚戠洰褰曪紝鍒欏嚭閿欍
- OpenMode.NOFOLLOW(0o400000)锛氬鏋減ath鎸囧悜绗﹀彿閾炬帴锛屽垯鍑洪敊銆
- OpenMode.SYNC(0o4010000)锛氫互鍚屾IO鐨勬柟寮忔墦寮鏂囦欢銆 | +| mode | number | 鍚 | 鎵撳紑鏂囦欢鐨刐閫夐」](#openmode)锛屽繀椤绘寚瀹氬涓嬮夐」涓殑涓涓紝榛樿浠ュ彧璇绘柟寮忔墦寮锛
- OpenMode.READ_ONLY(0o0)锛氬彧璇绘墦寮銆
- OpenMode.WRITE_ONLY(0o1)锛氬彧鍐欐墦寮銆
- OpenMode.READ_WRITE(0o2)锛氳鍐欐墦寮銆
缁欏畾濡備笅鍔熻兘閫夐」锛屼互鎸変綅鎴栫殑鏂瑰紡杩藉姞锛岄粯璁や笉缁欏畾浠讳綍棰濆閫夐」锛
- OpenMode.CREATE(0o100)锛氳嫢鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘枃浠躲
- OpenMode.TRUNC(0o1000)锛氬鏋滄枃浠跺瓨鍦ㄤ笖浠ュ彧鍐欐垨璇诲啓鐨勬柟寮忔墦寮鏂囦欢锛屽垯灏嗗叾闀垮害瑁佸壀涓洪浂銆
- OpenMode.APPEND(0o2000)锛氫互杩藉姞鏂瑰紡鎵撳紑锛屽悗缁啓灏嗚拷鍔犲埌鏂囦欢鏈熬銆
- OpenMode.NONBLOCK(0o4000)锛氬鏋減ath鎸囧悜FIFO銆佸潡鐗规畩鏂囦欢鎴栧瓧绗︾壒娈婃枃浠讹紝鍒欐湰娆℃墦寮鍙婂悗缁 IO 杩涜闈為樆濉炴搷浣溿
- OpenMode.DIR(0o200000)锛氬鏋減ath涓嶆寚鍚戠洰褰曪紝鍒欏嚭閿欍
- OpenMode.NOFOLLOW(0o400000)锛氬鏋減ath鎸囧悜绗﹀彿閾炬帴锛屽垯鍑洪敊銆
- OpenMode.SYNC(0o4010000)锛氫互鍚屾IO鐨勬柟寮忔墦寮鏂囦欢銆 | **绀轰緥锛** @@ -542,7 +542,7 @@ open(path: string, flags?: number, callback: AsyncCallback<File>): void ## fs.openSync -openSync(path: string, flags?: number): File +openSync(path: string, mode?: number): File 浠ュ悓姝ユ柟娉曟墦寮鏂囦欢銆傛敮鎸佷娇鐢║RI鎵撳紑鏂囦欢銆 @@ -553,7 +553,7 @@ openSync(path: string, flags?: number): File | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | 鏄 | 鎵撳紑鏂囦欢鐨勫簲鐢ㄦ矙绠辫矾寰勬垨URI銆 | -| flags | number | 鍚 | 鎵撳紑鏂囦欢鐨刐閫夐」](#openmode)锛屽繀椤绘寚瀹氬涓嬮夐」涓殑涓涓紝榛樿浠ュ彧璇绘柟寮忔墦寮锛
- OpenMode.READ_ONLY(0o0)锛氬彧璇绘墦寮銆
- OpenMode.WRITE_ONLY(0o1)锛氬彧鍐欐墦寮銆
- OpenMode.READ_WRITE(0o2)锛氳鍐欐墦寮銆
缁欏畾濡備笅鍔熻兘閫夐」锛屼互鎸変綅鎴栫殑鏂瑰紡杩藉姞锛岄粯璁や笉缁欏畾浠讳綍棰濆閫夐」锛
- OpenMode.CREATE(0o100)锛氳嫢鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘枃浠躲
- OpenMode.TRUNC(0o1000)锛氬鏋滄枃浠跺瓨鍦ㄤ笖浠ュ彧鍐欐垨璇诲啓鐨勬柟寮忔墦寮鏂囦欢锛屽垯灏嗗叾闀垮害瑁佸壀涓洪浂銆
- OpenMode.APPEND(0o2000)锛氫互杩藉姞鏂瑰紡鎵撳紑锛屽悗缁啓灏嗚拷鍔犲埌鏂囦欢鏈熬銆
- OpenMode.NONBLOCK(0o4000)锛氬鏋減ath鎸囧悜FIFO銆佸潡鐗规畩鏂囦欢鎴栧瓧绗︾壒娈婃枃浠讹紝鍒欐湰娆℃墦寮鍙婂悗缁 IO 杩涜闈為樆濉炴搷浣溿
- OpenMode.DIR(0o200000)锛氬鏋減ath涓嶆寚鍚戠洰褰曪紝鍒欏嚭閿欍
- OpenMode.NOFOLLOW(0o400000)锛氬鏋減ath鎸囧悜绗﹀彿閾炬帴锛屽垯鍑洪敊銆
- OpenMode.SYNC(0o4010000)锛氫互鍚屾IO鐨勬柟寮忔墦寮鏂囦欢銆 | +| mode | number | 鍚 | 鎵撳紑鏂囦欢鐨刐閫夐」](#openmode)锛屽繀椤绘寚瀹氬涓嬮夐」涓殑涓涓紝榛樿浠ュ彧璇绘柟寮忔墦寮锛
- OpenMode.READ_ONLY(0o0)锛氬彧璇绘墦寮銆
- OpenMode.WRITE_ONLY(0o1)锛氬彧鍐欐墦寮銆
- OpenMode.READ_WRITE(0o2)锛氳鍐欐墦寮銆
缁欏畾濡備笅鍔熻兘閫夐」锛屼互鎸変綅鎴栫殑鏂瑰紡杩藉姞锛岄粯璁や笉缁欏畾浠讳綍棰濆閫夐」锛
- OpenMode.CREATE(0o100)锛氳嫢鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘枃浠躲
- OpenMode.TRUNC(0o1000)锛氬鏋滄枃浠跺瓨鍦ㄤ笖浠ュ彧鍐欐垨璇诲啓鐨勬柟寮忔墦寮鏂囦欢锛屽垯灏嗗叾闀垮害瑁佸壀涓洪浂銆
- OpenMode.APPEND(0o2000)锛氫互杩藉姞鏂瑰紡鎵撳紑锛屽悗缁啓灏嗚拷鍔犲埌鏂囦欢鏈熬銆
- OpenMode.NONBLOCK(0o4000)锛氬鏋減ath鎸囧悜FIFO銆佸潡鐗规畩鏂囦欢鎴栧瓧绗︾壒娈婃枃浠讹紝鍒欐湰娆℃墦寮鍙婂悗缁 IO 杩涜闈為樆濉炴搷浣溿
- OpenMode.DIR(0o200000)锛氬鏋減ath涓嶆寚鍚戠洰褰曪紝鍒欏嚭閿欍
- OpenMode.NOFOLLOW(0o400000)锛氬鏋減ath鎸囧悜绗﹀彿閾炬帴锛屽垯鍑洪敊銆
- OpenMode.SYNC(0o4010000)锛氫互鍚屾IO鐨勬柟寮忔墦寮鏂囦欢銆 | **杩斿洖鍊硷細** diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-hash.md b/zh-cn/application-dev/reference/apis/js-apis-file-hash.md index 0405e3943eb4768af1a592889937b37796ba2cdd..a38e3189c58e52af35f5dae9a9ab3a7d136c1a7a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-hash.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-hash.md @@ -67,9 +67,9 @@ hash(path: string, algorithm: string): Promise<string> ```js let filePath = pathDir + "/test.txt"; - Hash.hash(filePath, "sha256").then(function (str) { + Hash.hash(filePath, "sha256").then((str) => { console.info("calculate file hash succeed:" + str); - }).catch(function (err) { + }).catch((err) => { console.info("calculate file hash failed with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -92,7 +92,7 @@ hash(path: string, algorithm: string, callback: AsyncCallback<string>): vo **绀轰緥锛** ```js - Hash.hash(filePath, "sha256", function (err, str) { + Hash.hash(filePath, "sha256", (err, str) => { if (err) { console.info("calculate file hash failed with error message: " + err.message + ", error code: " + err.code); } else { diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md b/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md index 4d725ba3edf970a79ab274bfb9a3d9aac5f3decb..511211522f361c78bac6ceb98779fa216a3d5c6d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md @@ -66,9 +66,9 @@ setSecurityLabel(path:string, type:dataLevel):Promise<void> **绀轰緥锛** ```js - securityLabel.setSecurityLabel(path, "s0").then(function () { + securityLabel.setSecurityLabel(path, "s0").then(() => { console.info("setSecurityLabel successfully"); - }).catch(function (err) { + }).catch((err) => { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -92,7 +92,7 @@ setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback<void> **绀轰緥锛** ```js - securityLabel.setSecurityLabel(path, "s0", function (err) { + securityLabel.setSecurityLabel(path, "s0", (err) => { if (err) { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -145,9 +145,9 @@ getSecurityLabel(path:string):Promise<string> **绀轰緥锛** ```js - securityLabel.getSecurityLabel(path).then(function (type) { + securityLabel.getSecurityLabel(path).then((type) => { console.log("getSecurityLabel successfully, Label: " + type); - }).catch(function (err) { + }).catch((err) => { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -170,7 +170,7 @@ getSecurityLabel(path:string, callback:AsyncCallback<string>): void **绀轰緥锛** ```js - securityLabel.getSecurityLabel(path, function (err, type) { + securityLabel.getSecurityLabel(path, (err, type) => { if (err) { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-statvfs.md b/zh-cn/application-dev/reference/apis/js-apis-file-statvfs.md index 99b8602eef0638f89cb1f6d239a00b0893113df9..4922e899d6e91946b7c4435df269340d5ad017c8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-statvfs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-statvfs.md @@ -35,9 +35,9 @@ getFreeSize(path:string):Promise<number> ```js let path = "/dev"; - statfs.getFreeSize(path).then(function (number) { + statfs.getFreeSize(path).then((number) => { console.info("getFreeSize promise successfully, Size: " + number); - }).catch(function (err) { + }).catch((err) => { console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -61,7 +61,7 @@ getFreeSize(path:string, callback:AsyncCallback<number>): void ```js let path = "/dev"; - statfs.getFreeSize(path, function (err, number) { + statfs.getFreeSize(path, (err, number) => { if (err) { console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -94,9 +94,9 @@ getTotalSize(path: string): Promise<number> ```js let path = "/dev"; - statfs.getTotalSize(path).then(function (number) { + statfs.getTotalSize(path).then((number) => { console.info("getTotalSize promise successfully, Size: " + number); - }).catch(function (err) { + }).catch((err) => { console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); }); ``` @@ -120,7 +120,7 @@ getTotalSize(path: string, callback: AsyncCallback<number>): void ```js let path = "/dev"; - statfs.getTotalSize(path, function(err, number) { + statfs.getTotalSize(path, (err, number) => { if (err) { console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); } else { diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md index 9e6e1755b9f38d829dac7d582362568a73afa703..23c699c61844ce162f0f2cce48305b5dfe0aab35 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md @@ -10,3 +10,25 @@ | onDisconnect7+ | function | 鏄 | 鏂紑杩炴帴鏃剁殑鍥炶皟鍑芥暟銆 | | onFailed7+ | function | 鏄 | 杩炴帴澶辫触鏃剁殑鍥炶皟鍑芥暟銆 | +**绀轰緥锛** + + ```ts + let want = { + bundleName: "com.example.myapp", + abilityName: "MyAbility" + }; + + let connectOptions = { + onConnect(elementName, remote) { + console.log('onConnect elementName: ' + elementName); + }, + onDisconnect(elementName) { + console.log('onDisconnect elementName: ' + elementName); + }, + onFailed(code) { + console.error('onFailed code: ' + code); + } + } + + let connection = this.context.connectAbility(want, connectOptions); + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md index be9ed68779a7f88e1d9bcb7111e06587c034d791..4caa0af24ff66ef7a50d6c8c0df8a302cf51880d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md @@ -4,7 +4,7 @@ Want鏄璞¢棿淇℃伅浼犻掔殑杞戒綋, 鍙互鐢ㄤ簬搴旂敤缁勪欢闂寸殑淇℃伅浼 > **璇存槑锛** > -> 鏈ā鍧楅鎵规帴鍙d粠API version 6寮濮嬫敮鎸併傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 +> 鏈ā鍧楅鎵规帴鍙d粠API version 6寮濮嬫敮鎸侊紝浠嶢PI version 9搴熷純锛屼娇鐢╗@ohos.app.ability.Want](js-apis-app-ability-want.md)妯″潡鏇夸唬銆傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityBase @@ -17,7 +17,7 @@ Want鏄璞¢棿淇℃伅浼犻掔殑杞戒綋, 鍙互鐢ㄤ簬搴旂敤缁勪欢闂寸殑淇℃伅浼 | type | string | 鍚 | 琛ㄧずMIME type绫诲瀷锛屾墦寮鏂囦欢鐨勭被鍨嬶紝涓昏鐢ㄤ簬鏂囩鎵撳紑鏂囦欢銆傛瘮濡傦細"text/xml" 銆 "image/*"绛夛紝MIME瀹氫箟鍙傝冿細https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com銆 | | flags | number | 鍚 | 琛ㄧず澶勭悊Want鐨勬柟寮忋傞粯璁や紶鏁板瓧锛屽叿浣撳弬鑰冿細[flags璇存槑](js-apis-ability-wantConstant.md#wantConstant.Flags)銆 | | action | string | 鍚 | 琛ㄧず瑕佹墽琛岀殑閫氱敤鎿嶄綔锛堝锛氭煡鐪嬨佸垎浜佸簲鐢ㄨ鎯咃級銆傚湪闅愬紡Want涓紝鎮ㄥ彲浠ュ畾涔夎瀛楁锛岄厤鍚坲ri鎴杙arameters鏉ヨ〃绀哄鏁版嵁瑕佹墽琛岀殑鎿嶄綔銆 | -| parameters | {[key: string]: any} | 鍚 | 琛ㄧずWantParams锛岀敱寮鍙戣呰嚜琛屽喅瀹氫紶鍏ョ殑閿煎銆傞粯璁や細鎼哄甫浠ヤ笅key鍊硷細
ohos.aafwk.callerPid 琛ㄧず鎷夎捣鏂圭殑pid銆
ohos.aafwk.param.callerToken 琛ㄧず鎷夎捣鏂圭殑token銆
ohos.aafwk.param.callerUid 琛ㄧず[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)涓殑uid锛屽簲鐢ㄥ寘閲屽簲鐢ㄧ▼搴忕殑uid銆 | +| parameters | {[key: string]: any} | 鍚 | 琛ㄧずWantParams锛岀敱寮鍙戣呰嚜琛屽喅瀹氫紶鍏ョ殑閿煎銆傞粯璁や細鎼哄甫浠ヤ笅key鍊硷細
ohos.aafwk.callerPid 琛ㄧず鎷夎捣鏂圭殑pid銆
ohos.aafwk.param.callerToken 琛ㄧず鎷夎捣鏂圭殑token銆
ohos.aafwk.param.callerUid 琛ㄧず[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)涓殑uid锛屽簲鐢ㄥ寘閲屽簲鐢ㄧ▼搴忕殑uid銆
- component.startup.newRules锛氳〃绀烘槸鍚﹀惎鐢ㄦ柊鐨勭鎺ц鍒欍
- moduleName锛氳〃绀烘媺璧锋柟鐨勬ā鍧楀悕锛岃瀛楁鐨勫煎嵆浣垮畾涔夋垚鍏朵粬瀛楃涓诧紝鍦ㄤ紶閫掑埌鍙︿竴绔椂浼氳淇敼涓烘纭殑鍊笺
- ohos.dlp.params.sandbox锛氳〃绀篸lp鏂囦欢鎵嶄細鏈夈 | | | entities | Array\ | 鍚 | 琛ㄧず鐩爣Ability棰濆鐨勭被鍒俊鎭紙濡傦細娴忚鍣ㄣ佽棰戞挱鏀惧櫒锛夛紝鍦ㄩ殣寮廤ant涓槸瀵筧ction瀛楁鐨勮ˉ鍏呫傚湪闅愬紡Want涓紝鎮ㄥ彲浠ュ畾涔夎瀛楁锛屾潵杩囨护鍖归厤Ability绫诲瀷銆 | | moduleName9+ | string | 鍚 | 琛ㄧず寰呭惎鍔ㄧ殑Ability鎵灞炵殑妯″潡锛坢odule锛夈 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md index 4a70b8ec6c4296606a5a0f06525fb98a2c651e6a..c648a2e0fc59849165c02b7b2a8ea395c086cfcd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md @@ -19,9 +19,11 @@ import featureAbility from '@ohos.ability.featureAbility'; var context = featureAbility.getContext(); context.getProcessInfo((err, data) => { - console.info("getProcessInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); - let pid = data.pid; - let processName = data.processName; + if (err.code != 0) { + console.info("getProcessInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + let pid = data.pid; + let processName = data.processName; + } }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md index 4664de608fb2b18de7a2160e1c178ade303a1de2..1aa125e161ae0c4118e3f4f989cdb2648c291dcc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md @@ -1,6 +1,6 @@ # AbilityStageContext -AbilityStageContext鏄疉bilityStage鐨勪笂涓嬫枃鐜锛岀户鎵胯嚜[Context](js-apis-application-context.md)銆 +AbilityStageContext鏄疉bilityStage鐨勪笂涓嬫枃鐜锛岀户鎵胯嚜[Context](js-apis-inner-application-context.md)銆 AbilityStageContext鎻愪緵鍏佽璁块棶鐗瑰畾浜巃bilityStage鐨勮祫婧愮殑鑳藉姏锛屽寘鎷幏鍙朅bilityStage瀵瑰簲鐨凪oduleInfo瀵硅薄銆佺幆澧冨彉鍖栧璞° @@ -28,5 +28,5 @@ class MyAbilityStage extends AbilityStage { | 鍚嶇О | 绫诲瀷 | 鍙 | 鍙啓 | 璇存槑 | | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | 鏄 | 鍚 | AbilityStage瀵瑰簲鐨凪oduleInfo瀵硅薄銆 | +| currentHapModuleInfo | [HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) | 鏄 | 鍚 | AbilityStage瀵瑰簲鐨凪oduleInfo瀵硅薄銆 | | config | [Configuration](js-apis-app-ability-configuration.md) | 鏄 | 鍚 | 鐜鍙樺寲瀵硅薄銆 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index 0b4e15087ccbd6d01561b57998b521c1cc113039..41dc3d57e5bd6782f1f8a2e32d27a6ddb41ab46e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -15,9 +15,9 @@ ApplicationContext妯″潡鎻愪緵寮鍙戣呭簲鐢ㄧ骇鍒殑鐨勪笂涓嬫枃鐨勮兘鍔涳紝 let applicationContext = this.context.getApplicationContext(); ``` -## ApplicationContext.registerAbilityLifecycleCallback +## ApplicationContext.on(type: "abilityLifecycle", callback: AbilityLifecycleCallback) -registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; +on(type: "abilityLifecycle", callback: AbilityLifecycleCallback): **number**; 娉ㄥ唽鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈 @@ -27,6 +27,7 @@ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number** | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------------------------ | -------- | ---- | ------------------------------ | +| type | "abilityLifecycle" | 鏄 | 鐩戝惉浜嬩欢鐨勭被鍨嬨 | | callback | [AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md) | 鏄 | 鍥炶皟鏂规硶锛岃繑鍥炴敞鍐岀洃鍚簨浠剁殑ID銆 | **杩斿洖鍊硷細** @@ -38,58 +39,58 @@ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number** **绀轰緥锛** ```ts -import Ability from "@ohos.application.Ability"; +import UIAbility from '@ohos.app.ability.UIAbility'; var lifecycleId; -export default class MyAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate() { console.log("MyAbility onCreate") let AbilityLifecycleCallback = { onAbilityCreate(ability) { - console.log("AbilityLifecycleCallback onAbilityCreate ability:" + JSON.stringify(ability)); + console.log("AbilityLifecycleCallback onAbilityCreate ability:" + ability); }, onWindowStageCreate(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageCreate ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageCreate windowStage:" + JSON.stringify(windowStage)); + console.log("AbilityLifecycleCallback onWindowStageCreate ability:" + ability); + console.log("AbilityLifecycleCallback onWindowStageCreate windowStage:" + windowStage); }, onWindowStageActive(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageActive ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageActive windowStage:" + JSON.stringify(windowStage)); + console.log("AbilityLifecycleCallback onWindowStageActive ability:" + ability); + console.log("AbilityLifecycleCallback onWindowStageActive windowStage:" + windowStage); }, onWindowStageInactive(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageInactive ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageInactive windowStage:" + JSON.stringify(windowStage)); + console.log("AbilityLifecycleCallback onWindowStageInactive ability:" + ability); + console.log("AbilityLifecycleCallback onWindowStageInactive windowStage:" + windowStage); }, onWindowStageDestroy(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageDestroy ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageDestroy windowStage:" + JSON.stringify(windowStage)); + console.log("AbilityLifecycleCallback onWindowStageDestroy ability:" + ability); + console.log("AbilityLifecycleCallback onWindowStageDestroy windowStage:" + windowStage); }, onAbilityDestroy(ability) { - console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + JSON.stringify(ability)); + console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + ability); }, onAbilityForeground(ability) { - console.log("AbilityLifecycleCallback onAbilityForeground ability:" + JSON.stringify(ability)); + console.log("AbilityLifecycleCallback onAbilityForeground ability:" + ability); }, onAbilityBackground(ability) { - console.log("AbilityLifecycleCallback onAbilityBackground ability:" + JSON.stringify(ability)); + console.log("AbilityLifecycleCallback onAbilityBackground ability:" + ability); }, onAbilityContinue(ability) { - console.log("AbilityLifecycleCallback onAbilityContinue ability:" + JSON.stringify(ability)); + console.log("AbilityLifecycleCallback onAbilityContinue ability:" + ability); } } // 1.閫氳繃context灞炴ц幏鍙朼pplicationContext let applicationContext = this.context.getApplicationContext(); // 2.閫氳繃applicationContext娉ㄥ唽鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈 - lifecycleId = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); + lifecycleId = applicationContext.on("abilityLifecycle", AbilityLifecycleCallback); console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleId)); } } ``` -## ApplicationContext.unregisterAbilityLifecycleCallback +## ApplicationContext.off(type: "abilityLifecycle", callbackId: number, callback: AsyncCallback) -unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; +off(type: "abilityLifecycle", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; 鍙栨秷鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈 @@ -99,30 +100,62 @@ unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallb | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------------- | -------- | ---- | -------------------------- | +| type | "abilityLifecycle" | 鏄 | 鍙栨秷鐩戝惉浜嬩欢鐨勭被鍨嬨 | | callbackId | number | 鏄 | 娉ㄥ唽鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈熺殑ID銆 | | callback | AsyncCallback\ | 鏄 | 鍥炶皟鏂规硶銆 | **绀轰緥锛** ```ts -import Ability from "@ohos.application.Ability"; +import UIAbility from '@ohos.app.ability.UIAbility'; var lifecycleId; -export default class MyAbility extends Ability { +export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); - console.log("stage applicationContext: " + JSON.stringify(applicationContext)); - applicationContext.unregisterAbilityLifecycleCallback(lifecycleId, (error, data) => { + console.log("stage applicationContext: " + applicationContext); + applicationContext.off(type: "abilityLifecycle", lifecycleId, (error, data) => { console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error)); }); } } ``` -## ApplicationContext.registerEnvironmentCallback +## ApplicationContext.off(type: "abilityLifecycle", callbackId: number) + +off(type: "abilityLifecycle", callbackId: **number**): **void**; + +鍙栨秷鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈 + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core + +**鍙傛暟锛** + +| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | +| ------------- | -------- | ---- | -------------------------- | +| type | "abilityLifecycle" | 鏄 | 鍙栨秷鐩戝惉浜嬩欢鐨勭被鍨嬨 | +| callbackId | number | 鏄 | 娉ㄥ唽鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈熺殑ID銆 | + +**绀轰緥锛** + +```ts +import Ability from "@ohos.app.ability.UIAbility"; + +var lifecycleId; + +export default class MyAbility extends Ability { + onDestroy() { + let applicationContext = this.context.getApplicationContext(); + console.log("stage applicationContext: " + applicationContext); + applicationContext.off(type: "abilityLifecycle", lifecycleId); + } +} +``` + +## ApplicationContext.on(type: "environment", callback: EnvironmentCallback) -registerEnvironmentCallback(callback: EnvironmentCallback): **number**; +on(type: "environment", callback: EnvironmentCallback): **number**; 娉ㄥ唽瀵圭郴缁熺幆澧冨彉鍖栫殑鐩戝惉銆備娇鐢╟allback寮傛鍥炶皟銆 @@ -132,6 +165,7 @@ registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------------------------ | -------- | ---- | ------------------------------ | +| type | "environment" | 鏄 | 鐩戝惉浜嬩欢鐨勭被鍨嬨 | | callback | [EnvironmentCallback](js-apis-app-ability-environmentCallback.md) | 鏄 | 鍥炶皟鏂规硶锛岃繑鍥炴敞鍐岀洃鍚簨浠剁殑ID銆 | **杩斿洖鍊硷細** @@ -143,11 +177,11 @@ registerEnvironmentCallback(callback: EnvironmentCallback): **number**; **绀轰緥锛** ```ts -import Ability from "@ohos.application.Ability"; +import UIAbility from '@ohos.app.ability.UIAbility'; var callbackId; -export default class MyAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate() { console.log("MyAbility onCreate") globalThis.applicationContext = this.context.getApplicationContext(); @@ -155,19 +189,22 @@ export default class MyAbility extends Ability { onConfigurationUpdated(config){ console.log("onConfigurationUpdated config:" + JSON.stringify(config)); }, + onMemoryLevel(level){ + console.log("onMemoryLevel level:" + level); + } } // 1.鑾峰彇applicationContext let applicationContext = globalThis.applicationContext; // 2.閫氳繃applicationContext娉ㄥ唽鐩戝惉搴旂敤鍐呯敓鍛藉懆鏈 - callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); + callbackId = applicationContext.on("environment", EnvironmentCallback); console.log("registerEnvironmentCallback number: " + JSON.stringify(callbackId)); } } ``` -## ApplicationContext.unregisterEnvironmentCallback +## ApplicationContext.off(type: "environment", callbackId: number, callback: AsyncCallback) -unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; +off(type: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; 鍙栨秷瀵圭郴缁熺幆澧冨彉鍖栫殑鐩戝惉銆備娇鐢╟allback寮傛鍥炶皟銆 @@ -177,22 +214,163 @@ unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<* | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ------------- | -------- | ---- | -------------------------- | +| type | "environment" | 鏄 | 鍙栨秷鐩戝惉浜嬩欢鐨勭被鍨嬨 | | callbackId | number | 鏄 | 娉ㄥ唽鐩戝惉绯荤粺鐜鍙樺寲鐨処D銆 | | callback | AsyncCallback\ | 鏄 | 鍥炶皟鏂规硶銆 | **绀轰緥锛** ```ts -import Ability from "@ohos.application.Ability"; +import UIAbility from '@ohos.app.ability.UIAbility'; var callbackId; -export default class MyAbility extends Ability { +export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); - applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => { + applicationContext.off("environment", callbackId, (error, data) => { console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error)); }); } } +``` + +## ApplicationContext.off(type: "environment", callbackId: number) + +off(type: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; + +鍙栨秷瀵圭郴缁熺幆澧冨彉鍖栫殑鐩戝惉銆備娇鐢╟allback寮傛鍥炶皟銆 + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core + +**鍙傛暟锛** + +| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | +| ------------- | -------- | ---- | -------------------------- | +| type | "environment" | 鏄 | 鍙栨秷鐩戝惉浜嬩欢鐨勭被鍨嬨 | +| callbackId | number | 鏄 | 娉ㄥ唽鐩戝惉绯荤粺鐜鍙樺寲鐨処D銆 | + +**绀轰緥锛** + +```ts +import Ability from "@ohos.app.ability.UIAbility"; + +var callbackId; + +export default class MyAbility extends Ability { + onDestroy() { + let applicationContext = this.context.getApplicationContext(); + applicationContext.off("environment", callbackId); + } +} +``` + +## ApplicationContext.getProcessRunningInformation9+ + +getProcessRunningInformation(): Promise\>; + +鑾峰彇鏈夊叧杩愯杩涚▼鐨勪俊鎭 + +**闇瑕佹潈闄**锛歰hos.permission.GET_RUNNING_INFO + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core + +**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 + +**杩斿洖鍊硷細** + +| 绫诲瀷 | 璇存槑 | +| -------- | -------- | +| Promise\> | 浠romise鏂瑰紡杩斿洖鎺ュ彛杩愯缁撴灉鍙婃湁鍏宠繍琛岃繘绋嬬殑淇℃伅锛屽彲杩涜閿欒澶勭悊鎴栧叾浠栬嚜瀹氫箟澶勭悊銆 | + +**绀轰緥锛** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.getProcessRunningInformation().then((data) => { + console.log("The process running information is:" + JSON.stringify(data)); +}).catch((error) => { + console.log("error:" + JSON.stringify(error)); +}); +``` + +## ApplicationContext.getProcessRunningInformation9+ + +getProcessRunningInformation(callback: AsyncCallback\>): void; + +鑾峰彇鏈夊叧杩愯杩涚▼鐨勪俊鎭 + +**闇瑕佹潈闄**锛歰hos.permission.GET_RUNNING_INFO + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core + +**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 + +**杩斿洖鍊硷細** + +| 绫诲瀷 | 璇存槑 | +| -------- | -------- | +|AsyncCallback\> | 浠ュ洖璋冩柟寮忚繑鍥炴帴鍙h繍琛岀粨鏋滃強鏈夊叧杩愯杩涚▼鐨勪俊鎭紝鍙繘琛岄敊璇鐞嗘垨鍏朵粬鑷畾涔夊鐞嗐 | + +**绀轰緥锛** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.getProcessRunningInformation((err, data) => { + if (err.code !== 0) { + console.error("getProcessRunningInformation faile, err: " + JSON.stringify(err)); + } else { + console.log("The process running information is:" + JSON.stringify(data)); + } +}) +``` + +## ApplicationContext.killProcessesBySelf9+ + +killProcessesBySelf(): Promise; + +鏉姝诲簲鐢ㄦ墍鍦ㄧ殑杩涚▼銆 + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core + +**杩斿洖鍊硷細** + +| 绫诲瀷 | 璇存槑 | +| -------- | -------- | +| Promise\> | 浠romise鏂瑰紡杩斿洖鏉姝诲簲鐢ㄦ墍鍦ㄧ殑杩涚▼缁撴灉銆 | + +**绀轰緥锛** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.killProcessesBySelf().then((data) => { + console.log("The process running information is:" + JSON.stringify(data)); +}).catch((error) => { + console.error("error:" + JSON.stringify(error)); +}); +``` + +## ApplicationContext.killProcessesBySelf9+ + +killProcessesBySelf(callback: AsyncCallback); + +鏉姝诲簲鐢ㄦ墍鍦ㄧ殑杩涚▼銆 + +**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core + +**杩斿洖鍊硷細** + +| 绫诲瀷 | 璇存槑 | +| -------- | -------- | +|AsyncCallback\ | 浠allback鏂瑰紡杩斿洖鏉姝诲簲鐢ㄦ墍鍦ㄧ殑杩涚▼缁撴灉銆 | + +**绀轰緥锛** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.killProcessesBySelf(err => { + if (err.code !== 0) { + console.error("killProcessesBySelf faile, err: " + JSON.stringify(err)); + } +}) ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md index efc468667c404b323709d3a6d65ac1012cb80e0b..a467c686ec24c88df1c2d50c7cdb84b851dd1196 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md @@ -1,6 +1,6 @@ # ProcessInformation -ProcessInformation妯″潡鎻愪緵瀵硅繘绋嬭繍琛屼俊鎭繘琛岃缃拰鏌ヨ鐨勮兘鍔涖 +ProcessInformation妯″潡鎻愪緵瀵硅繘绋嬭繍琛屼俊鎭繘琛屾煡璇㈢殑鑳藉姏銆 > **璇存槑锛** > diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md index 89fe63cefa465aff076454462e6484838be2057e..3a5ee1fad4647b6acfda1ece58627252b9b8112f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md @@ -1,6 +1,6 @@ # ProcessRunningInfo -鏈ā鍧楁彁渚涘杩涚▼杩愯淇℃伅杩涜璁剧疆鍜屾煡璇㈢殑鑳藉姏銆 +鏈ā鍧楁彁渚涘杩涚▼杩愯淇℃伅杩涜鏌ヨ鐨勮兘鍔涖 > **璇存槑锛** > - 鏈ā鍧楁帴鍙d粠API version 9 寮濮嬪簾寮冿紝寤鸿浣跨敤[ProcessInformation9+](js-apis-inner-application-processInformation.md)鏇夸唬銆 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 85861abfda9517597aba145bed6686b1c049e841..d1e4ce8fe87b619680f64bc080d6ab87d1bfc33e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -245,6 +245,11 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< 鏍规嵁account鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 @@ -316,6 +321,11 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca 鏍规嵁account鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 @@ -392,6 +402,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): 鏍规嵁account鍚姩Ability锛圥romise褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 @@ -1199,7 +1214,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| connection | number | 鏄 | 鍦╟onnectAbility涓繑鍥炵殑number銆 | +| connection | number | 鏄 | 鍦╟onnectServiceExtensionAbility涓繑鍥炵殑number銆 | | callback | AsyncCallback<void> | 鍚 | 鍥炶皟鍑芥暟锛岃繑鍥炴帴鍙h皟鐢ㄦ槸鍚︽垚鍔熺殑缁撴灉銆 | **閿欒鐮侊細** @@ -1251,7 +1266,7 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>; | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------- | -------- | -------- | -| connection | number | 鏄 | 鍦╟onnectAbility涓繑鍥炵殑number銆 | +| connection | number | 鏄 | 鍦╟onnectServiceExtensionAbility涓繑鍥炵殑number銆 | **杩斿洖鍊硷細** @@ -1273,7 +1288,7 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>; **绀轰緥锛** ```ts - // connection涓篶onnectAbility涓殑杩斿洖鍊 + // connection涓篶onnectServiceExtensionAbility涓殑杩斿洖鍊 var connection = 1; try { @@ -1300,6 +1315,11 @@ startAbilityByCall(want: Want): Promise<Caller>; 鍚姩鎸囧畾Ability鑷冲墠鍙版垨鍚庡彴锛屽悓鏃惰幏鍙栧叾Caller閫氫俊鎺ュ彛锛岃皟鐢ㄦ柟鍙娇鐢–aller涓庤鍚姩鐨凙bility杩涜閫氫俊銆 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **绯荤粺API**锛氭鎺ュ彛涓虹郴缁熸帴鍙o紝涓夋柟搴旂敤涓嶆敮鎸佽皟鐢ㄣ diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 176c5601ce25fa5acb334a7cd7486bc0f534a0e8..212a2428e5e77a8de8344be9d0242e2357d69e30 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -25,6 +25,11 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; 鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** @@ -91,6 +96,11 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& 鍚姩Ability锛坈allback褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** @@ -161,6 +171,11 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; 鍚姩Ability锛坧romise褰㈠紡锛夈 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** @@ -234,7 +249,12 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; -鍚姩Ability骞跺湪璇bility閫鍑虹殑鏃跺欒繑鍥炴墽琛岀粨鏋滐紙callback褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#uiabilitycontextterminateselfwithresult)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙callback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -301,7 +321,12 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; -鍚姩Ability骞跺湪璇bility閫鍑虹殑鏃跺欒繑鍥炴墽琛岀粨鏋滐紙callback褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#uiabilitycontextterminateselfwithresult)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙callback褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -373,7 +398,12 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; -鍚姩Ability骞跺湪璇bility閫鍑虹殑鏃跺欒繑鍥炴墽琛岀粨鏋滐紙promise褰㈠紡锛夈 +鍚姩涓涓狝bility銆侫bility琚惎鍔ㄥ悗锛屾甯告儏鍐典笅鍙氳繃璋冪敤[terminateSelfWithResult](#uiabilitycontextterminateselfwithresult)鎺ュ彛浣夸箣缁堟骞朵笖杩斿洖缁撴灉缁欒皟鐢ㄨ呫傚紓甯告儏鍐典笅姣斿鏉姝籄bility浼氳繑鍥炲紓甯镐俊鎭粰璋冪敤鑰咃紙promise褰㈠紡锛夈 + +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1251,7 +1281,7 @@ terminateSelf(): Promise<void>; terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; -鍋滄Ability锛岄厤鍚坰tartAbilityForResult浣跨敤锛岃繑鍥炵粰鎺ュ彛璋冪敤鏂笰bilityResult淇℃伅锛坈allback褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility銆傚鏋滆Ability鏄氳繃璋冪敤[startAbilityForResult](#uiabilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵細灏嗙粨鏋滆繑鍥炵粰璋冪敤鑰咃紝濡傛灉璇bility涓嶆槸閫氳繃璋冪敤[startAbilityForResult](#uiabilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵笉浼氭湁缁撴灉杩斿洖缁欒皟鐢ㄨ咃紙callback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1310,7 +1340,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi terminateSelfWithResult(parameter: AbilityResult): Promise<void>; -鍋滄Ability锛岄厤鍚坰tartAbilityForResult浣跨敤锛岃繑鍥炵粰鎺ュ彛璋冪敤鏂笰bilityResult淇℃伅锛坧romise褰㈠紡锛夈 +鍋滄褰撳墠鐨凙bility銆傚鏋滆Ability鏄氳繃璋冪敤[startAbilityForResult](#uiabilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵細灏嗙粨鏋滆繑鍥炵粰璋冪敤鑰咃紝濡傛灉璇bility涓嶆槸閫氳繃璋冪敤[startAbilityForResult](#uiabilitycontextstartabilityforresult)鎺ュ彛琚媺璧风殑锛岃皟鐢╰erminateSelfWithResult鎺ュ彛鏃朵笉浼氭湁缁撴灉杩斿洖缁欒皟鐢ㄨ咃紙promise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -1607,6 +1637,11 @@ startAbilityByCall(want: Want): Promise<Caller>; 鍚姩鎸囧畾Ability鑷冲墠鍙版垨鍚庡彴锛屽悓鏃惰幏鍙栧叾Caller閫氫俊鎺ュ彛锛岃皟鐢ㄦ柟鍙娇鐢–aller涓庤鍚姩鐨凙bility杩涜閫氫俊銆 +浣跨敤瑙勫垯锛 + - 璋冪敤鏂瑰簲鐢ㄤ綅浜庡悗鍙版椂锛屼娇鐢ㄨ鎺ュ彛鍚姩Ability闇鐢宠`ohos.permission.START_ABILITIES_FROM_BACKGROUND`鏉冮檺 + - 鐩爣Ability鐨剉isible灞炴ц嫢閰嶇疆涓篺alse锛岃皟鐢ㄦ柟搴旂敤闇鐢宠`ohos.permission.START_INVISIBLE_ABILITY`鏉冮檺 + - 缁勪欢鍚姩瑙勫垯璇﹁锛歔缁勪欢鍚姩瑙勫垯锛圫tage妯″瀷锛塢(../../application-models/component-startup-rules.md) + **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core **鍙傛暟锛** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md index 4f8c88b6cef94a4cc0fbd79c90c7ccf098ae9ba7..7d51a7aa49dc04ff3f5ee2f40eff4af9f90cb51c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md @@ -1,6 +1,6 @@ # TriggerInfo -浣滀负[trigger](js-apis-app-ability-wantAgent.md#wantagenttrigger)鐨勫叆鍙傚畾涔夎Е鍙慦antAgent鎵闇瑕佺殑鐨勪俊鎭 +浣滀负[trigger](js-apis-app-ability-wantAgent.md#wantagenttrigger)鐨勫叆鍙傚畾涔夎Е鍙慦antAgent鎵闇瑕佺殑淇℃伅銆 **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md index 7228bf96d4552040fc72de80826c082076802b14..ecfcd0cab044593a8af2bef35fb77bc404a65cea 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md @@ -7,7 +7,7 @@ | 鍚嶇О | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------------- | ------------------------------- | ---- | ---------------------- | | wants | Array\ | 鏄 | 灏嗚鎵ц鐨勫姩浣滃垪琛ㄣ | -| operationType | wantAgent.OperationType | 鏄 | 鍔ㄤ綔绫诲瀷銆 | +| operationType | [wantAgent.OperationType](js-apis-app-ability-wantAgent.md#operationtype) | 鏄 | 鍔ㄤ綔绫诲瀷銆 | | requestCode | number | 鏄 | 浣跨敤鑰呭畾涔夌殑涓涓鏈夊笺 | -| wantAgentFlags | Array<[wantAgent.WantAgentFlags](js-apis-wantAgent.md#WantAgentFlags)> | 鍚 | 鍔ㄤ綔鎵ц灞炴с | -| extraInfo | {[key: string]: any} | 鍚 | 棰濆鏁版嵁銆 | +| wantAgentFlags | Array<[wantAgent.WantAgentFlags](js-apis-app-ability-wantAgent.md#wantagentflags)> | 鍚 | 鍔ㄤ綔鎵ц灞炴с | +| extraInfo | {[key: string]: any} | 鍚 | 棰濆鏁版嵁銆 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md index c9f77d0afa4b0f5ddc5156e51047bf6cff80a6b1..b9d826798fdd2de5aa9351200412daa06de9d1bf 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md @@ -255,9 +255,9 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want **绀轰緥**锛 ```js -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; -import wantAgent from '@ohos.wantAgent'; +import wantAgent from '@ohos.app.ability.wantAgent'; function callback(error, data) { if (error) { @@ -267,13 +267,13 @@ function callback(error, data) { } } -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { let wantAgentInfo = { wants: [ { bundleName: "com.example.myapplication", - abilityName: "MainAbility" + abilityName: "EntryAbility" } ], operationType: wantAgent.OperationType.START_ABILITY, @@ -281,14 +281,18 @@ export default class MainAbility extends Ability { wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; - wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { - try { - backgroundTaskManager.startBackgroundRunning(this.context, - backgroundTaskManager.BackgroundMode.LOCATION, wantAgentObj, callback) - } catch (error) { - console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } - }); + try { + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + try { + backgroundTaskManager.startBackgroundRunning(this.context, + backgroundTaskManager.BackgroundMode.LOCATION, wantAgentObj, callback) + } catch (error) { + console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + }); + } catch (error) { + console.error(`Operation getWantAgent failed. code is ${error.code} message is ${error.message}`); + } } }; ``` @@ -334,17 +338,17 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want **绀轰緥**锛 ```js -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; -import wantAgent from '@ohos.wantAgent'; +import wantAgent from '@ohos.app.ability.wantAgent'; -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { let wantAgentInfo = { wants: [ { bundleName: "com.example.myapplication", - abilityName: "MainAbility" + abilityName: "EntryAbility" } ], operationType: wantAgent.OperationType.START_ABILITY, @@ -352,18 +356,22 @@ export default class MainAbility extends Ability { wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; - wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { - try { - backgroundTaskManager.startBackgroundRunning(this.context, - backgroundTaskManager.BackgroundMode.LOCATION, wantAgentObj).then(() => { - console.info("Operation startBackgroundRunning succeeded"); - }).catch((error) => { + try { + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + try { + backgroundTaskManager.startBackgroundRunning(this.context, + backgroundTaskManager.BackgroundMode.LOCATION, wantAgentObj).then(() => { + console.info("Operation startBackgroundRunning succeeded"); + }).catch((error) => { + console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + }); + } catch (error) { console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - }); - } catch (error) { - console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } - }); + } + }); + } catch (error) { + console.error(`Operation getWantAgent failed. code is ${error.code} message is ${error.message}`); + } } }; ``` @@ -400,7 +408,7 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): vo **绀轰緥**锛 ```js -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; function callback(error, data) { @@ -411,7 +419,7 @@ function callback(error, data) { } } -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { try { backgroundTaskManager.stopBackgroundRunning(this.context, callback); @@ -461,10 +469,10 @@ stopBackgroundRunning(context: Context): Promise<void> **绀轰緥**锛 ```js -import Ability from '@ohos.application.Ability' +import UIAbility from '@ohos.app.ability.UIAbility'; import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { try { backgroundTaskManager.stopBackgroundRunning(this.context).then(() => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md index d2aa44078efd38274ac491b9a7eca0e95f7141d5..c697eaaf1e8bdbcb72b17defafa25433825ca08d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md @@ -35,8 +35,12 @@ isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void 鍒ゆ柇鎸囧畾bundleName鐨勫簲鐢ㄥ綋鍓嶆槸鍚︽槸绌洪棽鐘舵侊紝涓夋柟搴旂敤鍙兘鏌ヨ鑷韩鐨勭┖闂茬姸鎬侊紝浣跨敤Callback褰㈠紡杩斿洖銆 +**闇瑕佹潈闄**锛歰hos.permission.BUNDLE_ACTIVE_INFO + **绯荤粺鑳藉姏**锛歋ystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**绯荤粺API**锛氭鎺ュ彛涓虹郴缁熸帴鍙c + **鍙傛暟**锛 | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | @@ -53,8 +57,8 @@ isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | **绀轰緥**锛 ```js @@ -77,8 +81,12 @@ isIdleState(bundleName: string): Promise<boolean> 鍒ゆ柇鎸囧畾bundleName鐨勫簲鐢ㄥ綋鍓嶆槸鍚︽槸绌洪棽鐘舵侊紝涓夋柟搴旂敤鍙兘鏌ヨ鑷韩鐨勭┖闂茬姸鎬侊紝浣跨敤Promise褰㈠紡杩斿洖銆 +**闇瑕佹潈闄**锛歰hos.permission.BUNDLE_ACTIVE_INFO + **绯荤粺鑳藉姏**锛歋ystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**绯荤粺API**锛氭鎺ュ彛涓虹郴缁熸帴鍙c + **鍙傛暟**锛 | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | @@ -100,8 +108,8 @@ isIdleState(bundleName: string): Promise<boolean> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | **绀轰緥**锛 @@ -140,10 +148,10 @@ queryAppGroup(): Promise<number> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000004 | IPC failed. | +| 10000005 | Application is not installed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **绀轰緥**锛 @@ -182,10 +190,10 @@ queryAppGroup(callback: AsyncCallback<number>): void | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000004 | IPC failed. | +| 10000005 | Application is not installed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **绀轰緥**锛 @@ -232,9 +240,9 @@ queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback<Bun | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -292,9 +300,9 @@ queryBundleStatsInfos(begin: number, end: number): Promise<BundleStatsMap> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -346,9 +354,9 @@ queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: num | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -405,9 +413,9 @@ queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: num | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -456,9 +464,9 @@ queryBundleEvents(begin: number, end: number, callback: AsyncCallback<Array&l | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -514,9 +522,9 @@ queryBundleEvents(begin: number, end: number): Promise<Array<BundleEvents& | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -561,9 +569,9 @@ queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback< | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -615,9 +623,9 @@ queryCurrentBundleEvents(begin: number, end: number): Promise<Array<Bundle | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -664,9 +672,9 @@ queryModuleUsageRecords(): Promise<Array<HapModuleInfo>> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -714,9 +722,9 @@ queryModuleUsageRecords(callback: AsyncCallback<Array<HapModuleInfo>> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -771,9 +779,9 @@ queryModuleUsageRecords(maxNum: number): Promise<Array<HapModuleInfo>&g | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -821,9 +829,9 @@ queryModuleUsageRecords(maxNum: number, callback: AsyncCallback<Array<HapM | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -878,10 +886,10 @@ queryAppGroup(bundleName : string): Promise<number> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | +| 10000004 | IPC failed. | | 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **绀轰緥**锛 @@ -927,10 +935,10 @@ queryAppGroup(bundleName : string, callback: AsyncCallback<number>): void | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | +| 10000004 | IPC failed. | | 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **绀轰緥**锛 @@ -977,9 +985,9 @@ setAppGroup(bundleName: string, newGroup: GroupType): Promise<void> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10100001 | Repeated operation on the application group. | **杩斿洖鍊**锛 @@ -1033,9 +1041,9 @@ setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback< | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10100001 | Repeated operation on the application group. | **绀轰緥**锛 @@ -1083,8 +1091,8 @@ registerAppGroupCallBack(groupCallback: Callback<AppGroupCallbackInfo>): P | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **杩斿洖鍊**锛 @@ -1142,13 +1150,14 @@ registerAppGroupCallBack(groupCallback: Callback<AppGroupCallbackInfo>, ca | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **绀轰緥**锛 ```javascript + // @ts-nocheck let onBundleGroupChanged = (err, res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); console.log('BUNDLE_ACTIVE registerAppGroupCallBack result appOldGroup is : ' + res.appOldGroup); @@ -1197,8 +1206,8 @@ unregisterAppGroupCallBack(): Promise<void> | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **绀轰緥**锛 @@ -1241,8 +1250,8 @@ unregisterAppGroupCallBack(callback: AsyncCallback<void>): void; | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **绀轰緥**锛 @@ -1294,9 +1303,9 @@ queryDeviceEventStats(begin: number, end: number): Promise<Array<DeviceEve | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -1342,9 +1351,9 @@ queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback<Arr | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -1397,9 +1406,9 @@ queryNotificationEventStats(begin: number, end: number): Promise<Array<Dev | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 @@ -1445,9 +1454,9 @@ queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback& | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **绀轰緥**锛 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md index f41b78e15b0fa85f0e983acab1990c31f05f0a75..77b82a63795aa688fa946c9130f71615978e9795 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md @@ -49,5 +49,4 @@ static getLocale(): LocaleResponse | ---- | ------ | ---- | ---- | ---------------------------------------- | | language | string | 鏄 | 鍚 | 璇█銆備緥濡傦細zh銆 | | countryOrRegion | string | 鏄 | 鍚 | 鍥藉鎴栧湴鍖恒備緥濡傦細CN銆 | -| dir | string | 鏄 | 鍚 | 鏂囧瓧甯冨眬鏂瑰悜銆傚彇鍊艰寖鍥达細
- ltr锛氫粠宸﹀埌鍙筹紱
- rtl锛氫粠鍙冲埌宸︺ | -| unicodeSetting5+ | string | 鏄 | 鍚 | 璇█鐜瀹氫箟鐨刄nicode璇█鐜閿泦锛屽鏋滄璇█鐜娌℃湁鐗瑰畾閿泦锛屽垯杩斿洖绌洪泦銆
渚嬪锛歿"nu":"arab"}锛岃〃绀哄綋鍓嶇幆澧冧笅鐨勬暟瀛楅噰鐢ㄩ樋鎷変集璇殑鏁板瓧銆 | \ No newline at end of file +| dir | string | 鏄 | 鍚 | 鏂囧瓧甯冨眬鏂瑰悜銆傚彇鍊艰寖鍥达細
- ltr锛氫粠宸﹀埌鍙筹紱
- rtl锛氫粠鍙冲埌宸︺ | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-storage.md b/zh-cn/application-dev/reference/apis/js-apis-system-storage.md index d35b15d1ff5afe4fef74655c11b1b44da7e39621..d7f1a842246dbcbb3c934b8c89cf0d705f0a8670 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-storage.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-storage.md @@ -51,7 +51,7 @@ export default { ## storage.set -get(options: SetStorageOptions): void +set(options: SetStorageOptions): void 淇敼缂撳瓨涓储寮曞搴旂殑鍊笺 diff --git a/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md index c3bb4e06631f7d6874be1ccf34dad5570d78470e..deeeb5de5371e20b42983ee7f9d2ae1d26cbbffe 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @@ -1,14 +1,14 @@ # @ohos.wantAgent (WantAgent妯″潡) -WantAgent妯″潡鎻愪緵浜嗚Е鍙戙佸彇娑堛佹瘮杈僕antAgent瀹炰緥鍜岃幏鍙朾undle鍙傛暟鍚嶇殑鑳藉姏锛屽寘鎷垱寤篧antAgent瀹炰緥銆佽幏鍙栧疄渚嬬殑鐢ㄦ埛ID銆佽幏鍙杦ant淇℃伅绛夈 +WantAgent妯″潡鎻愪緵浜嗗垱寤篧antAgent瀹炰緥銆佽幏鍙栧疄渚嬬殑鐢ㄦ埛ID銆佽幏鍙杦ant淇℃伅銆佹瘮杈僕antAgent瀹炰緥鍜岃幏鍙朾undle鍚嶇О绛夎兘鍔涖 > **璇存槑锛** > -> 鏈ā鍧楅鎵规帴鍙d粠API version 7寮濮嬫敮鎸侊紝浠嶢PI version 9搴熷純锛屾浛鎹㈡ā鍧椾负[@ohos.app.ability.wantAgent](js-apis-app-ability-wantAgent.md)銆傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 +> 鏈ā鍧楅鎵规帴鍙d粠API version 7寮濮嬫敮鎸侊紝浠嶢PI version 9搴熷純锛屾浛鎹㈡ā鍧椾负[@ohos.app.ability.wantAgent](js-apis-app-ability-wantAgent.md)銆傚悗缁増鏈殑鏂板鎺ュ彛锛岄噰鐢ㄤ笂瑙掓爣鍗曠嫭鏍囪鎺ュ彛鐨勮捣濮嬬増鏈 ## 瀵煎叆妯″潡 -```js +```ts import WantAgent from '@ohos.wantAgent'; ``` @@ -24,37 +24,41 @@ getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | -------- | -------------------------- | ---- | ----------------------- | -| info | WantAgentInfo | 鏄 | WantAgent淇℃伅銆 | +| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | 鏄 | WantAgent淇℃伅銆 | | callback | AsyncCallback\ | 鏄 | 鍒涘缓WantAgent鐨勫洖璋冩柟娉曘 | **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //getWantAgent鍥炶皟 function getWantAgentCallback(err, data) { - console.info("==========================>getWantAgentCallback=======================>"); + if (err.code) { + console.info('getWantAgent Callback err:' + JSON.stringify(err)) + } else { + console.info('getWantAgent Callback success') + } } //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -64,11 +68,9 @@ var wantAgentInfo = { wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] } -WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); ``` - - ## WantAgent.getWantAgent getWantAgent(info: WantAgentInfo): Promise\ @@ -81,7 +83,7 @@ getWantAgent(info: WantAgentInfo): Promise\ | 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | | ---- | ------------- | ---- | ------------- | -| info | WantAgentInfo | 鏄 | WantAgent淇℃伅銆 | +| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | 鏄 | WantAgent淇℃伅銆 | **杩斿洖鍊硷細** @@ -91,29 +93,29 @@ getWantAgent(info: WantAgentInfo): Promise\ **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -124,17 +126,15 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); }); ``` - - ## WantAgent.getBundleName getBundleName(agent: WantAgent, callback: AsyncCallback\): void -鑾峰彇WantAgent瀹炰緥鐨勫寘鍚嶏紙callback褰㈠紡锛夈 +鑾峰彇WantAgent瀹炰緥鐨凚undle鍚嶇О锛坈allback褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -147,41 +147,48 @@ getBundleName(agent: WantAgent, callback: AsyncCallback\): void **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //getWantAgent鍥炶皟 function getWantAgentCallback(err, data) { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; + } + + //getBundleName鍥炶皟 + function getBundleNameCallback(err, data) { + console.info('==========================>getBundleNameCallback=======================>'); } + WantAgent.getBundleName(wantAgent, getBundleNameCallback); } //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -192,12 +199,6 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -//getBundleName鍥炶皟 -function getBundleNameCallback(err, data) { - console.info("==========================>getBundleNameCallback=======================>"); -} -WantAgent.getBundleName(wantAgent, getBundleNameCallback) ``` @@ -206,7 +207,7 @@ WantAgent.getBundleName(wantAgent, getBundleNameCallback) getBundleName(agent: WantAgent): Promise\ -鑾峰彇WantAgent瀹炰緥鐨勫寘鍚嶏紙Promise褰㈠紡锛夈 +鑾峰彇WantAgent瀹炰緥鐨凚undle鍚嶇О锛圥romise褰㈠紡锛夈 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -218,38 +219,37 @@ getBundleName(agent: WantAgent): Promise\ **杩斿洖鍊硷細** -| 绫诲瀷 | 璇存槑 | -| ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\ | 浠romise褰㈠紡杩斿洖鑾峰彇WantAgent瀹炰緥鐨勫寘鍚嶃 | +| 绫诲瀷 | 璇存槑 | +| ----------------- | ------------------------------------------------ | +| Promise\ | 浠romise褰㈠紡杩斿洖鑾峰彇WantAgent瀹炰緥鐨凚undle鍚嶇О銆 | **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; - //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -260,12 +260,13 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; -}); - -WantAgent.getBundleName(wantAgent).then((data) => { - console.info("==========================>getBundleNameCallback=======================>"); + if (wantAgent) { + WantAgent.getBundleName(wantAgent).then((data) => { + console.info('==========================>getBundleNameCallback=======================>'); + }); + } }); ``` @@ -288,41 +289,48 @@ getUid(agent: WantAgent, callback: AsyncCallback\): void **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //getWantAgent鍥炶皟 function getWantAgentCallback(err, data) { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; + } + + //getUid鍥炶皟 + function getUidCallback(err, data) { + console.info('==========================>getUidCallback=======================>'); } + WantAgent.getUid(wantAgent, getUidCallback); } //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -333,12 +341,6 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -//getUid鍥炶皟 -function getUidCallback(err, data) { - console.info("==========================>getUidCallback=======================>"); -} -WantAgent.getUid(wantAgent, getUidCallback) ``` @@ -365,32 +367,32 @@ getUid(agent: WantAgent): Promise\ **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -401,162 +403,17 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; -}); - -WantAgent.getUid(wantAgent).then((data) => { - console.info("==========================>getUidCallback=======================>"); -}); -``` - - - -## WantAgent.getWant - -getWant(agent: WantAgent, callback: AsyncCallback\): void - -鑾峰彇WantAgent瀵硅薄鐨剋ant锛坈allback褰㈠紡锛夈 - -**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core - -**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 - -**鍙傛暟锛** - -| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | -| -------- | --------------------- | ---- | ------------------------------- | -| agent | WantAgent | 鏄 | WantAgent瀵硅薄銆 | -| callback | AsyncCallback\ | 鏄 | 鑾峰彇WantAgent瀵硅薄want鐨勫洖璋冩柟娉曘 | - -**绀轰緥锛** - -```js -import WantAgent from '@ohos.wantAgent'; - - -//wantAgent瀵硅薄 -var wantAgent; - -//getWantAgent鍥炶皟 -function getWantAgentCallback(err, data) { - console.info("==========================>getWantAgentCallback=======================>"); - if (err.code == 0) { - wantAgent = data; - } else { - console.info('----getWantAgent failed!----'); + if (wantAgent) { + WantAgent.getUid(wantAgent).then((data) => { + console.info('==========================>getUidCallback=======================>'); + }); } -} -//WantAgentInfo瀵硅薄 -var wantAgentInfo = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -//getWant鍥炶皟 -function getWantCallback(err, data) { - console.info("==========================>getWantCallback=======================>"); -} -WantAgent.getWant(wantAgent, getWantCallback) -``` - - - -## WantAgent.getWant - -getWant(agent: WantAgent): Promise\ - -鑾峰彇WantAgent瀵硅薄鐨剋ant锛圥romise褰㈠紡锛夈 - -**绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core - -**绯荤粺API**: 姝ゆ帴鍙d负绯荤粺鎺ュ彛锛屼笁鏂瑰簲鐢ㄤ笉鏀寔璋冪敤銆 - -**鍙傛暟锛** - -| 鍙傛暟鍚 | 绫诲瀷 | 蹇呭~ | 璇存槑 | -| ----- | --------- | ---- | ------------- | -| agent | WantAgent | 鏄 | WantAgent瀵硅薄銆 | - -**杩斿洖鍊硷細** - -| 绫诲瀷 | 璇存槑 | -| ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\ | 浠romise褰㈠紡杩斿洖鑾峰彇WantAgent瀵硅薄鐨剋ant銆 | - -**绀轰緥锛** - -```js -import WantAgent from '@ohos.wantAgent'; - - -//wantAgent瀵硅薄 -var wantAgent; - -//WantAgentInfo瀵硅薄 -var wantAgentInfo = { - wants: [ - { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); - wantAgent = data; -}); - -WantAgent.getWant(wantAgent).then((data) => { - console.info("==========================>getWantCallback=======================>"); }); ``` - ## WantAgent.cancel cancel(agent: WantAgent, callback: AsyncCallback\): void @@ -574,41 +431,48 @@ cancel(agent: WantAgent, callback: AsyncCallback\): void **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //getWantAgent鍥炶皟 function getWantAgentCallback(err, data) { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + //cancel鍥炶皟 + function cancelCallback(err, data) { + console.info('==========================>cancelCallback=======================>'); + } + WantAgent.cancel(wantAgent, cancelCallback); } //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -619,12 +483,6 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -//cancel鍥炶皟 -function cancelCallback(err, data) { - console.info("==========================>cancelCallback=======================>"); -} -WantAgent.cancel(wantAgent, cancelCallback) ``` @@ -651,32 +509,32 @@ cancel(agent: WantAgent): Promise\ **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -687,12 +545,13 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; -}); - -WantAgent.cancel(wantAgent).then((data) => { - console.info("==========================>cancelCallback=======================>"); + if (wantAgent) { + WantAgent.cancel(wantAgent).then((data) => { + console.info('==========================>cancelCallback=======================>'); + }); + } }); ``` @@ -711,46 +570,57 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback\ | 鍚 | 涓诲姩婵鍙慦antAgent瀹炰緥鐨勫洖璋冩柟娉曘 | **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //getWantAgent鍥炶皟 function getWantAgentCallback(err, data) { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + //trigger鍥炶皟 + function triggerCallback(data) { + console.info('==========================>triggerCallback=======================>'); + } + + var triggerInfo = { + code:0 + } + WantAgent.trigger(wantAgent, triggerInfo, triggerCallback) } //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -761,16 +631,6 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -//trigger鍥炶皟 -function triggerCallback(data) { - console.info("==========================>triggerCallback=======================>"); -} - -var triggerInfo = { - code:0 -} -WantAgent.trigger(wantAgent, triggerInfo, triggerCallback) ``` @@ -779,7 +639,7 @@ WantAgent.trigger(wantAgent, triggerInfo, triggerCallback) equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\): void -鍒ゆ柇涓や釜WantAgent瀹炰緥鏄惁鐩哥瓑锛坈allback褰㈠紡锛夈 +鍒ゆ柇涓や釜WantAgent瀹炰緥鏄惁鐩哥瓑锛坈allback褰㈠紡锛,浠ユ鏉ュ垽鏂槸鍚︽槸鏉ヨ嚜鍚屼竴搴旂敤鐨勭浉鍚屾搷浣溿 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -793,43 +653,50 @@ equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); if (err.code == 0) { wantAgent1 = data; wantAgent2 = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + //equal鍥炶皟 + function equalCallback(err, data) { + console.info('==========================>equalCallback=======================>'); + } + WantAgent.equal(wantAgent1, wantAgent2, equalCallback) } //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -840,12 +707,6 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -//equal鍥炶皟 -function equalCallback(err, data) { - console.info("==========================>equalCallback=======================>"); -} -WantAgent.equal(wantAgent1, wantAgent2, equalCallback) ``` @@ -854,7 +715,7 @@ WantAgent.equal(wantAgent1, wantAgent2, equalCallback) equal(agent: WantAgent, otherAgent: WantAgent): Promise\ -鍒ゆ柇涓や釜WantAgent瀹炰緥鏄惁鐩哥瓑锛圥romise褰㈠紡锛夈 +鍒ゆ柇涓や釜WantAgent瀹炰緥鏄惁鐩哥瓑锛圥romise褰㈠紡锛,浠ユ鏉ュ垽鏂槸鍚︽槸鏉ヨ嚜鍚屼竴搴旂敤鐨勭浉鍚屾搷浣溿 **绯荤粺鑳藉姏**锛歋ystemCapability.Ability.AbilityRuntime.Core @@ -873,33 +734,33 @@ equal(agent: WantAgent, otherAgent: WantAgent): Promise\ **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent1; -var wantAgent2; +let wantAgent1; +let wantAgent2; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -910,13 +771,18 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); wantAgent1 = data; wantAgent2 = data; + if (data) { + WantAgent.equal(wantAgent1, wantAgent2).then((data) => { + console.info('==========================>equalCallback=======================>'); + }); + } }); WantAgent.equal(wantAgent1, wantAgent2).then((data) => { - console.info("==========================>equalCallback=======================>"); + console.info('==========================>equalCallback=======================>'); }); ``` @@ -937,31 +803,31 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\): void; **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -972,13 +838,14 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; + if (data) { + WantAgent.getOperationType(wantAgent, (OperationType) => { + console.log('----------- getOperationType ----------, OperationType: ' + OperationType); + }) + } }); - -WantAgent.getOperationType(wantAgent, (OperationType) => { - console.log('----------- getOperationType ----------, OperationType: ' + OperationType); -}) ``` ## WantAgent.getOperationType9+ @@ -1003,31 +870,31 @@ getOperationType(agent: WantAgent): Promise\; **绀轰緥锛** -```js +```ts import WantAgent from '@ohos.wantAgent'; //wantAgent瀵硅薄 -var wantAgent; +let wantAgent; //WantAgentInfo瀵硅薄 -var wantAgentInfo = { +let wantAgentInfo = { wants: [ { - deviceId: "deviceId", - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', parameters: { mykey0: 2222, mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], mykey6: true, } } @@ -1038,18 +905,16 @@ var wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info("==========================>getWantAgentCallback=======================>"); + console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; + WantAgent.getOperationType(wantAgent).then((OperationType) => { + console.log('getOperationType success, OperationType: ' + OperationType); + }).catch((err) => { + console.log('getOperationType fail, err: ' + err); + }) }); - -WantAgent.getOperationType(wantAgent).then((OperationType) => { - console.log('getOperationType success, OperationType: ' + OperationType); -}).catch((err) => { - console.log('getOperationType fail, err: ' + err); -}) ``` - ## WantAgentFlags **绯荤粺鑳藉姏**锛氫互涓嬪悇椤瑰搴旂殑绯荤粺鑳藉姏鍧囦负SystemCapability.Ability.AbilityRuntime.Core @@ -1088,5 +953,5 @@ WantAgent.getOperationType(wantAgent).then((OperationType) => { | info | WantAgent | 鏄 | 瑙﹀彂鐨剋antAgent銆 | | want | Want | 鏄 | 瀛樺湪鐨勮瑙﹀彂鐨剋ant銆 | | finalCode | number | 鏄 | 瑙﹀彂wantAgent鐨勮姹備唬鐮併倈 -| finalData | string | 鍚 | 鍏叡浜嬩欢鏀堕泦鐨勬渶缁堟暟鎹 | -| extraInfo | {[key: string]: any} | 鍚 | 棰濆鏁版嵁銆 | +| finalData | string | 鏄 | 鍏叡浜嬩欢鏀堕泦鐨勬渶缁堟暟鎹 | +| extraInfo | {[key: string]: any} | 鍚 | 棰濆鏁版嵁銆 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md index c072a4cf54fec80813302d637c748ca382a60306..3579acfe447e6c34457ea9337d0502357c9d5a43 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -51,7 +51,7 @@ | Normal | 鏅氭寜閽紙榛樿涓嶅甫鍦嗚锛夈 | > **璇存槑锛** -> - 鎸夐挳鍦嗚閫氳繃[閫氱敤灞炴orderRadius](ts-universal-attributes-border.md)璁剧疆锛堜笉鏀寔閫氳繃border鎺ュ彛璁剧疆鍦嗚锛夈 +> - 鎸夐挳鍦嗚閫氳繃[閫氱敤灞炴orderRadius](ts-universal-attributes-border.md)璁剧疆锛堜笉鏀寔閫氳繃border鎺ュ彛璁剧疆鍦嗚锛夛紝涓斿彧鏀寔璁剧疆涓涓浉鍚岀殑鍦嗚銆 > - 褰撴寜閽被鍨嬩负Capsule鏃讹紝borderRadius璁剧疆涓嶇敓鏁堬紝鎸夐挳鍦嗚濮嬬粓涓洪珮搴︾殑涓鍗娿 > - 褰撴寜閽被鍨嬩负Circle鏃讹紝borderRadius鍗充负鎸夐挳鍗婂緞锛岃嫢鏈缃産orderRadius鎸夐挳鍗婂緞鍒欎负瀹姐侀珮涓緝灏忓肩殑涓鍗娿 > - 鎸夐挳鏂囨湰閫氳繃[閫氱敤鏂囨湰鏍峰紡](ts-universal-attributes-text-style.md)杩涜璁剧疆銆 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md index 15d655ff27b9b2e468f2509b93b058f3279ad64c..22231ba443c6382fb645d04b9833424324be8e55 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md @@ -145,91 +145,3 @@ struct ShapeExample { ``` ![zh-cn_image_0000001184628104](figures/zh-cn_image_0000001184628104.png) - -### 绀轰緥2 - -```ts -// xxx.ets -@Entry -@Component -struct ShapeMeshExample { - @State columnVal: number = 0 - @State rowVal: number = 0 - @State count: number = 0 - @State verts: Array = [] - @State shapeWidth: number = 600 - @State shapeHeight: number = 600 - - build() { - Column() { - Shape() { - Rect() - .width('250px') - .height('250px') - .radiusWidth('10px') - .radiusHeight('10px') - .stroke('10px') - .margin({ left: '10px', top: '10px' }) - .strokeWidth('10px') - .fill(Color.Blue) - Rect() - .width('250px') - .height('250px') - .radiusWidth('10px') - .radiusHeight('10px') - .stroke('10px') - .margin({ left: '270px', top: '10px' }) - .strokeWidth('10px') - .fill(Color.Red) - } - .mesh(this.verts, this.columnVal, this.rowVal) - .width(this.shapeWidth + 'px') - .height(this.shapeHeight + 'px') - // 鎵嬫寚瑙︽懜Shape缁勪欢鏃朵細鏄剧ずmesh鎵洸鏁堟灉 - .onTouch((event: TouchEvent) => { - var touchX = event.touches[0].x * 2 - var touchY = event.touches[0].y * 2 - this.columnVal = 20 - this.rowVal = 20 - this.count = (this.columnVal + 1) * (this.rowVal + 1) - var orig = [this.count * 2] - var index = 0 - for (var i = 0; i <= this.rowVal; i++) { - var fy = this.shapeWidth * i / this.rowVal - for (var j = 0; j <= this.columnVal; j++) { - var fx = this.shapeWidth * j / this.columnVal - orig[index * 2 + 0] = this.verts[index * 2 + 0] = fx - orig[index * 2 + 1] = this.verts[index * 2 + 1] = fy - index++; - } - } - for (var k = 0; k < this.count * 2; k += 2) { - var dx = touchX - orig[k + 0] - var dy = touchY - orig[k + 1] - var dd = dx * dx + dy * dy - var d = Math.sqrt(dd) - var pull = 80000 / (dd * d) - if (pull >= 1) { - this.verts[k + 0] = touchX - this.verts[k + 1] = touchY - } else { - this.verts[k + 0] = orig[k + 0] + dx * pull - this.verts[k + 1] = orig[k + 1] + dy * pull - } - } - }) - } - .width('600px') - .height('600px') - .border({ width: 3, color: Color.Black }) - } -} -``` - -绀烘剰鍥撅細 - -![zh-cn_image1_0000001184628104](figures/zh-cn_image1_0000001184628104.png) - -鎵嬫寚瑙︽懜Shape缁勪欢鏃朵細鏄剧ずmesh鎵洸鏁堟灉锛 - -![zh-cn_image2_0000001184628104](figures/zh-cn_image2_0000001184628104.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index ab47fc96adfd0e3f7bfa5b006be15dfe050f15dd..7d001c0c0781ca41d72d34398a668b563d46b30f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -23,7 +23,7 @@ | primaryButton | {
value: string,
action: () => void
} | 鍚 | 绗竴涓寜閽
value: 寮圭獥閲屼富鎸夐挳鐨勬枃鏈
action: 鐐瑰嚮涓绘寜閽殑鍥炶皟鍑芥暟銆 | | secondaryButton | {
value: string,
action: () => void
} | 鍚 | 绗簩涓寜閽
value: 寮圭獥閲岃緟鍔╂寜閽殑鏂囨湰銆
action: 鐐瑰嚮杈呭姪鎸夐挳鐨勫洖璋冨嚱鏁般 | | onStateChange | (event: { isVisible: boolean }) => void | 鍚 | 寮圭獥鐘舵佸彉鍖栦簨浠跺洖璋冿紝鍙傛暟isVisible涓哄脊绐楀綋鍓嶇殑鏄剧ず鐘舵併 | -| arrowOffset9+ | [Length](ts-types.md#length) | 鍚 | popup绠ご鍦ㄥ脊绐楀鐨勫亸绉汇傜澶村湪姘旀场涓婁笅鏂规椂锛岄粯璁ゅ眳宸︼紱绠ご鍦ㄦ皵娉″乏鍙充晶鏃讹紝榛樿灞呬笂銆 | +| arrowOffset9+ | [Length](ts-types.md#length) | 鍚 | popup绠ご鍦ㄥ脊绐楀鐨勫亸绉汇傜澶村湪姘旀场涓婁笅鏂规椂锛屾暟鍊间负0琛ㄧず绠ご灞呮渶宸︿晶锛屽亸绉婚噺涓虹澶磋嚦鏈宸︿晶鐨勮窛绂伙紝榛樿灞呬腑銆傜澶村湪姘旀场宸﹀彸渚ф椂锛屽亸绉婚噺涓虹澶磋嚦鏈涓婁晶鐨勮窛绂伙紝榛樿灞呬腑銆傚鏋滄樉绀哄湪灞忓箷杈圭紭锛屾皵娉′細鑷姩宸﹀彸鍋忕Щ锛屾暟鍊间负0鏃剁澶村缁堟寚鍚戠粦瀹氱粍浠躲 | | showInSubWindow9+ | boolean | 鍚 | 鏄惁鍦ㄥ瓙绐楀彛鏄剧ず姘旀场锛岄粯璁ゅ间负false銆 | ## CustomPopupOptions8+绫诲瀷璇存槑 @@ -34,10 +34,10 @@ | placement | [Placement](ts-appendix-enums.md#placement8) | 鍚 | 姘旀场缁勪欢浼樺厛鏄剧ず鐨勪綅缃紝褰撳墠浣嶇疆鏄剧ず涓嶄笅鏃讹紝浼氳嚜鍔ㄨ皟鏁翠綅缃
榛樿鍊硷細Placement.Bottom | | maskColor | [ResourceColor](ts-types.md#resourcecolor) | 鍚 | 鎻愮ず姘旀场閬殰灞傜殑棰滆壊銆 | | popupColor | [ResourceColor](ts-types.md#resourcecolor) | 鍚 | 鎻愮ず姘旀场鐨勯鑹层 | -| enableArrow | boolean | 鍚 | 鏄惁鏄剧ず绠ご銆
浠嶢PI Version 9寮濮嬶紝濡傛灉绠ご鎵鍦ㄦ柟浣嶄晶鐨勬皵娉¢暱搴︿笉瓒充互鏄剧ず涓嬬澶达紝鍒欎細榛樿涓嶆樉绀虹澶淬傛瘮濡傦細placement璁剧疆涓篖eft锛屼絾姘旀场楂樺害灏忎簬绠ご鐨勫搴︼紙32vp锛夛紝鍒欏疄闄呬笉浼氭樉绀虹澶淬
榛樿鍊硷細true | +| enableArrow | boolean | 鍚 | 鏄惁鏄剧ず绠ご銆
浠嶢PI Version 9寮濮嬶紝濡傛灉绠ご鎵鍦ㄦ柟浣嶄晶鐨勬皵娉¢暱搴︿笉瓒充互鏄剧ず涓嬬澶达紝鍒欎細榛樿涓嶆樉绀虹澶淬傛瘮濡傦細placement璁剧疆涓篖eft锛屼絾姘旀场楂樺害灏忎簬绠ご鐨勫搴︾殑涓ゅ嶏紙64vp锛夛紝鍒欏疄闄呬笉浼氭樉绀虹澶淬
榛樿鍊硷細true | | autoCancel | boolean | 鍚 | 椤甸潰鏈夋搷浣滄椂锛屾槸鍚﹁嚜鍔ㄥ叧闂皵娉°
榛樿鍊硷細true | | onStateChange | (event: { isVisible: boolean }) => void | 鍚 | 寮圭獥鐘舵佸彉鍖栦簨浠跺洖璋冿紝鍙傛暟涓哄脊绐楀綋鍓嶇殑鏄剧ず鐘舵併 | -| arrowOffset9+ | [Length](ts-types.md#length) | 鍚 | popup绠ご鍦ㄥ脊绐楀鐨勫亸绉汇傜澶村湪姘旀场涓婁笅鏂规椂锛岄粯璁ゅ眳宸︼紱绠ご鍦ㄦ皵娉″乏鍙充晶鏃讹紝榛樿灞呬笂銆 | +| arrowOffset9+ | [Length](ts-types.md#length) | 鍚 | popup绠ご鍦ㄥ脊绐楀鐨勫亸绉汇傜澶村湪姘旀场涓婁笅鏂规椂锛屾暟鍊间负0琛ㄧず绠ご灞呮渶宸︿晶锛屽亸绉婚噺涓虹澶磋嚦鏈宸︿晶鐨勮窛绂伙紝榛樿灞呬腑銆傜澶村湪姘旀场宸﹀彸渚ф椂锛屽亸绉婚噺涓虹澶磋嚦鏈涓婁晶鐨勮窛绂伙紝榛樿灞呬腑銆傚鏋滄樉绀哄湪灞忓箷杈圭紭锛屾皵娉′細鑷姩宸﹀彸鍋忕Щ锛屾暟鍊间负0鏃剁澶村缁堟寚鍚戠粦瀹氱粍浠躲 | | showInSubWindow9+ | boolean | 鍚 | 鏄惁鍦ㄥ瓙绐楀彛鏄剧ず姘旀场锛岄粯璁ゅ间负false銆 | diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md b/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md index e7611c35ea75641a984219be39fd62dccba5d6f6..dda2607a4d9de5f979f26ca206313fad3dd84804 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md @@ -58,7 +58,7 @@ System service operation failed. **閿欒淇℃伅** -IPC communication failed. +IPC failed. **閿欒鎻忚堪** @@ -94,7 +94,7 @@ The application is not installed. **閿欒淇℃伅** -Get application info failed. +Failed to get the application information. **閿欒鎻忚堪** @@ -114,11 +114,11 @@ Get application info failed. **閿欒淇℃伅** -Get system or actual time operation failed. +Failed to get the system time. **閿欒鎻忚堪** -绯荤粺鏈嶅姟鑾峰彇绯荤粺浜嬩欢鎴栬呭疄闄呬簨浠舵搷浣滃け璐ャ +绯荤粺鏈嶅姟鑾峰彇绯荤粺鏃堕棿鎴栬呭疄闄呮椂闂存搷浣滃け璐ャ **鍙兘鍘熷洜** @@ -132,7 +132,7 @@ Get system or actual time operation failed. **閿欒淇℃伅** -Application group operation failed. The application group are the the same or do not need te be updated. +Repeated operation on the application group. **閿欒鎻忚堪** @@ -150,7 +150,7 @@ Application group operation failed. The application group are the the same or do **閿欒淇℃伅** -Get application group info failed. The application group infomation cannot be found. +Failed to get the application group information. **閿欒鎻忚堪** diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index ec1395659377b317564302cbdc5e9d56140189b8..43acda4d53954079b619111187bec2cba61cadc8 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -231,5 +231,5 @@ 閽堝璁块棶鎺у埗锛屾湁浠ヤ笅鐩稿叧瀹炰緥鍙緵鍙傝冿細 -- [`AbilityAccessCtrl`锛氳闂潈闄愭帶鍒讹紙ArkTS锛夛紙API8锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Safety/AbilityAccessCtrl) -- [涓哄簲鐢ㄦ坊鍔犺繍琛屾椂鏉冮檺锛圓rkTS锛夛紙API 9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file +- [`AbilityAccessCtrl`锛氳闂潈闄愭帶鍒讹紙ArkTS锛夛紙Full SDK锛夛紙API8锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Safety/AbilityAccessCtrl) +- [涓哄簲鐢ㄦ坊鍔犺繍琛屾椂鏉冮檺锛圓rkTS锛夛紙Full SDK锛夛紙API 9锛塢(https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file diff --git a/zh-cn/application-dev/security/accesstoken-overview.md b/zh-cn/application-dev/security/accesstoken-overview.md index 5aae9b27ec59c39aac848a0c3653a27cc393b5fe..a712cc0a6c635c2a415c4e7b7ac9b35fb0e1ecdc 100644 --- a/zh-cn/application-dev/security/accesstoken-overview.md +++ b/zh-cn/application-dev/security/accesstoken-overview.md @@ -175,7 +175,7 @@ ATM (AccessTokenManager) 鏄疧penHarmony涓婂熀浜嶢ccessToken鏋勫缓鐨勭粺涓鐨勫簲 **娉ㄦ剰浜嬮」锛** - 姣忔鎵ц闇瑕佺洰鏍囨潈闄愮殑鎿嶄綔鏃讹紝搴旂敤閮藉繀椤绘鏌ヨ嚜宸辨槸鍚﹀凡缁忓叿鏈夎鏉冮檺銆 -- 濡傞渶妫鏌ョ敤鎴锋槸鍚﹀凡鍚戞偍鐨勫簲鐢ㄦ巿浜堢壒瀹氭潈闄愶紝鍙互浣跨敤[verifyAccessToken](../reference/apis/js-apis-abilityAccessCtrl.md)鍑芥暟锛屾鏂规硶浼氳繑鍥 [PERMISSION_GRANTED](../reference/apis/js-apis-abilityAccessCtrl.md)鎴朳PERMISSION_DENIED](../reference/apis/js-apis-abilityAccessCtrl.md)銆傚叿浣撶殑绀轰緥浠g爜鍙互鏌ョ湅[璁块棶鎺у埗寮鍙戞寚瀵糫(accesstoken-guidelines.md)銆 +- 濡傞渶妫鏌ョ敤鎴锋槸鍚﹀凡鍚戞偍鐨勫簲鐢ㄦ巿浜堢壒瀹氭潈闄愶紝鍙互浣跨敤[checkAccessToken](../reference/apis/js-apis-abilityAccessCtrl.md#checkaccesstoken9)鍑芥暟锛屾鏂规硶浼氳繑鍥 [PERMISSION_GRANTED](../reference/apis/js-apis-abilityAccessCtrl.md)鎴朳PERMISSION_DENIED](../reference/apis/js-apis-abilityAccessCtrl.md)銆傚叿浣撶殑绀轰緥浠g爜鍙互鏌ョ湅[璁块棶鎺у埗寮鍙戞寚瀵糫(accesstoken-guidelines.md)銆 - user_grant鏉冮檺鎺堟潈瑕佸熀浜庣敤鎴峰彲鐭ュ彲鎺х殑鍘熷垯锛岄渶瑕佸簲鐢ㄥ湪杩愯鏃朵富鍔ㄨ皟鐢ㄧ郴缁熷姩鎬佺敵璇锋潈闄愮殑鎺ュ彛锛岀郴缁熷脊妗嗙敱鐢ㄦ埛鎺堟潈锛岀敤鎴风粨鍚堝簲鐢ㄨ繍琛屽満鏅殑涓婁笅鏂囷紝璇嗗埆鍑哄簲鐢ㄧ敵璇风浉搴旀晱鎰熸潈闄愮殑鍚堢悊鎬э紝浠庤屽仛鍑烘纭殑閫夋嫨銆 - 鍗充娇鐢ㄦ埛鍚戝簲鐢ㄦ巿浜堣繃璇锋眰鐨勬潈闄愶紝搴旂敤鍦ㄨ皟鐢ㄥ彈姝ゆ潈闄愮鎺х殑鎺ュ彛鍓嶏紝涔熷簲璇ュ厛妫鏌ヨ嚜宸辨湁鏃犳鏉冮檺锛岃屼笉鑳芥妸涔嬪墠鎺堜簣鐨勭姸鎬佹寔涔呭寲锛屽洜涓虹敤鎴峰湪鍔ㄦ佹巿浜堝悗杩樺彲浠ラ氳繃璁剧疆鍙栨秷搴旂敤鐨勬潈闄愩 diff --git a/zh-cn/application-dev/task-management/reminder-agent-development.md b/zh-cn/application-dev/task-management/reminder-agent-development.md index 50d843483acfb9703224d56ed0f739ee8afde793..579d2100d068b5038a61a91e75df59fb79d46dba 100644 --- a/zh-cn/application-dev/task-management/reminder-agent-development.md +++ b/zh-cn/application-dev/task-management/reminder-agent-development.md @@ -175,3 +175,9 @@ console.log("cancelReminder code: " + error.code + ", message: " + error.message); }; ``` + +## 鐩稿叧瀹炰緥 + +鍩轰簬鍚庡彴浠g悊鎻愰啋鐨勫紑鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 + +- [闂归挓锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock) \ No newline at end of file diff --git a/zh-cn/application-dev/tools/aa-tool.md b/zh-cn/application-dev/tools/aa-tool.md index fef305b1cdfde1530a69630e8967c73dc7064fd4..3a5665c2767600fbb10d83fe4bc97ce5ba5fe5d5 100644 --- a/zh-cn/application-dev/tools/aa-tool.md +++ b/zh-cn/application-dev/tools/aa-tool.md @@ -68,7 +68,7 @@ Ability assistant锛圓bility鍔╂墜锛岀畝绉颁负aa锛夛紝鏄疄鐜板簲鐢ㄥ強娴嬭瘯鐢 | -------- | -------- | -------- | | -h/--help | - | 甯姪淇℃伅銆 | | -a/--all | - | 鎵撳嵃鎵鏈塵ission鍐呯殑搴旂敤缁勪欢淇℃伅銆 | - | -l/--mission-list | type锛堢己鐪佹墦鍗板叏閮級 | 鎵撳嵃浠诲姟鏍堜俊鎭
鍙彇鍊硷細
- NORMAL
- DEFAULT_STANDARD
- DEFAULT_SINGLE
- LAUNCHER | + | -l/--mission-list | type锛堢己鐪佹墦鍗板叏閮級 | 鏈嶅姟渚т负浜嗘柟渚跨鐞嗕换鍔¢摼锛屽唴閮ㄧ淮鎶や簡4绉嶇被鍨嬬殑浠诲姟閾俱
鍙彇鍊硷細
- NORMAL: 姝e父鍚姩鐨勪换鍔¢摼(姣斿A鎷夎捣B鎷夎捣C, 鍒欏搴旂殑浠诲姟閾炬槸A->B->C)
- DEFAULT_STANDARD: 宸茬粡琚牬鍧忕殑浠诲姟閾句腑鐨勪换鍔, 鍚姩妯″紡涓簊tandard鐨勪换鍔¤鏀惧埌璇ヤ换鍔¢摼涓, 杩欓噷闈㈢殑浠诲姟涔嬮棿娌℃湁鍏宠仈鍏崇郴
- DEFAULT_SINGLE: 宸茬粡琚牬鍧忕殑浠诲姟閾句腑鐨勪换鍔, 鍚姩妯″紡涓簊ingleton鐨勪换鍔¤鏀惧埌璇ヤ换鍔¢摼涓, 杩欓噷闈㈢殑浠诲姟涔嬮棿娌℃湁鍏宠仈鍏崇郴
- LAUNCHER: launcher鐨勪换鍔¢摼 | | -e/--extension | elementName | 鎵撳嵃鎵╁睍缁勪欢淇℃伅銆 | | -u/--userId | UserId | 鎵撳嵃鎸囧畾UserId鐨勬爤淇℃伅锛岄渶瑕佸拰鍏朵粬鍙傛暟缁勫悎浣跨敤锛屼緥濡俛a dump -a -u 100銆乤a dump -d -u 100銆 | | -d/--data | - | 鎵撳嵃DataAbility鐩稿叧淇℃伅銆 | diff --git a/zh-cn/application-dev/ui/ui-js-building-ui-component.md b/zh-cn/application-dev/ui/ui-js-building-ui-component.md index 6ef14c79e61a3b67a9c5b63053a80fb919c316c1..53f345facae16f1885214e63bc7f43f6d3bb9561 100755 --- a/zh-cn/application-dev/ui/ui-js-building-ui-component.md +++ b/zh-cn/application-dev/ui/ui-js-building-ui-component.md @@ -25,6 +25,8 @@ 閽堝缁勪欢寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 +- [`JsComponentCollection`锛氱粍浠堕泦鍚堬紙JS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsComponentCollection) + - [`JsPanel`锛氬唴瀹瑰睍绀洪潰鏉匡紙JS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsPanel) - [`Popup`锛氭皵娉★紙JS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/UI/Popup) diff --git a/zh-cn/application-dev/ui/ui-ts-components-intro.md b/zh-cn/application-dev/ui/ui-ts-components-intro.md index 098791ee5e3a4787d7a85eee43b417a5f88007d5..717d61c3f5257a3858956111bbcc2a02f500b184 100644 --- a/zh-cn/application-dev/ui/ui-ts-components-intro.md +++ b/zh-cn/application-dev/ui/ui-ts-components-intro.md @@ -15,6 +15,12 @@ ## 鐩稿叧瀹炰緥 +鍩轰簬ArkTS鐨勫父鐢ㄧ粍浠跺紑鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 + +- [`ComponentCollection`锛氱粍浠堕泦鍚堬紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/ComponentCollection) + +- [`OrangeShopping`锛氳喘鐗╃ず渚嬪簲鐢紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/OrangeShopping) + - [`Canvas`锛氱敾甯冪粍浠讹紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Canvas) - [`Clock`锛氱畝鍗曟椂閽燂紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/Preset/Clock) @@ -25,6 +31,8 @@ - [`QRCode`锛氫簩缁寸爜锛圓rkTS锛夛紙API9锛夛紙Full SDK锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/QRCode) -- [鍩虹缁勪欢Slider鐨勪娇鐢紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderApplicationEts) - - [`Gallery`锛氱粍浠堕泦鍚堬紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Gallery) + +- [List缁勪欢鐨勪娇鐢ㄤ箣鍟嗗搧鍒楄〃锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/List_HDC) + +- [List缁勪欢鐨勪娇鐢ㄤ箣璁剧疆椤癸紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/List_HDC) diff --git a/zh-cn/application-dev/ui/ui-ts-components-web.md b/zh-cn/application-dev/ui/ui-ts-components-web.md index 9a913bd2d0914de37b3157bc38aae4c4c4dcbbe1..0a8e25f2e32fb13eb16975c6a180dac0c3a5c701 100644 --- a/zh-cn/application-dev/ui/ui-ts-components-web.md +++ b/zh-cn/application-dev/ui/ui-ts-components-web.md @@ -8,10 +8,12 @@ Web鏄彁渚涚綉椤垫樉绀鸿兘鍔涚殑缁勪欢锛屽叿浣撶敤娉曡鍙傝 [Web API](../ref ```ts // xxx.ets + import web_webview from '@ohos.web.webview'; + @Entry @Component struct WebComponent { - controller: WebController = new WebController(); + controller: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Web({ src: 'https://www.example.com', controller: this.controller }) @@ -26,11 +28,13 @@ Web缁勪欢鐨勪娇鐢ㄩ渶瑕佹坊鍔犱赴瀵岀殑椤甸潰鏍峰紡鍜屽姛鑳藉睘鎬с傝缃甴eigh ```ts // xxx.ets +import web_webview from '@ohos.web.webview'; + @Entry @Component struct WebComponent { fileAccess: boolean = true; - controller: WebController = new WebController(); + controller: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Text('Hello world!') @@ -54,13 +58,15 @@ struct WebComponent { ```ts // xxx.ets +import web_webview from '@ohos.web.webview'; + @Entry @Component struct WebComponent { @State progress: number = 0; @State hideProgress: boolean = true; fileAccess: boolean = true; - controller: WebController = new WebController(); + controller: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Text('Hello world!') @@ -93,14 +99,17 @@ struct WebComponent { ```ts // xxx.ets +import web_webview from '@ohos.web.webview'; + @Entry @Component struct WebComponent { @State progress: number = 0; @State hideProgress: boolean = true; + @State webResult: string = '' fileAccess: boolean = true; // 瀹氫箟Web缁勪欢鐨勬帶鍒跺櫒controller - controller: WebController = new WebController(); + controller: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Text('Hello world!') @@ -124,8 +133,23 @@ struct WebComponent { }) .onPageEnd(e => { // test()鍦╥ndex.html涓畾涔 - this.controller.runJavaScript({ script: 'test()' }); - console.info('url: ', e.url); + try { + this.controller.runJavaScript( + 'test()', + (error, result) => { + if (error) { + console.info(`run JavaScript error: ` + JSON.stringify(error)) + return; + } + if (result) { + this.webResult = result + console.info(`The test() return value is: ${result}`) + } + }); + console.info('url: ', e.url); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } }) Text('End') .fontSize(20) @@ -160,10 +184,12 @@ struct WebComponent { 1銆侀鍏堣缃甒eb缁勪欢灞炴ebDebuggingAccess涓簍rue銆 ```ts // xxx.ets + import web_webview from '@ohos.web.webview'; + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -189,20 +215,30 @@ struct WebComponent { ```ts // xxx.ets +import web_webview from '@ohos.web.webview'; + @Entry @Component struct WebComponent { - controller: WebController = new WebController(); + controller: web_webview.WebviewController = new web_webview.WebviewController(); build() { Column() { Row() { Button('onActive').onClick(() => { console.info("Web Component onActive"); - this.controller.onActive(); + try { + this.controller.onActive(); + } catch (error) { + console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + } }) Button('onInactive').onClick(() => { console.info("Web Component onInactive"); - this.controller.onInactive(); + try { + this.controller.onInactive(); + } catch (error) { + console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + } }) } Web({ src: $rawfile('index.html'), controller: this.controller }) @@ -231,3 +267,7 @@ struct WebComponent { 閽堝Web寮鍙戯紝鏈変互涓嬬浉鍏冲疄渚嬪彲渚涘弬鑰冿細 - [`Web`锛歐eb锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Web) + +- [Web缁勪欢鐨勪娇鐢紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/WebCookie) + +- [Web缁勪欢鎶藉妗堜緥锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/WebComponent) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-overview.md b/zh-cn/application-dev/ui/ui-ts-overview.md index e7bf1744db4373eb141e219dd19ca003782b82d8..304ddc7382ecb17004bc0fb1c515ec831ad21660 100644 --- a/zh-cn/application-dev/ui/ui-ts-overview.md +++ b/zh-cn/application-dev/ui/ui-ts-overview.md @@ -76,12 +76,14 @@ ArkTS璇█鐨勫熀纭鐭ヨ瘑璇峰弬鑰僛瀛︿範ArkTS璇█](../quick-start/arkts-get- - [`TransitionAnimation`锛氳浆鍦哄姩鐢(ArkTS)锛圓PI9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/TransitionAnimation) +- [鍩虹缁勪欢Slider鐨勪娇鐢紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderExample) + +- [杞満鍔ㄧ敾鐨勪娇鐢紙ArkTS锛夛紙API9锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimation) + - [鏋佺畝澹版槑寮廢I鑼冨紡锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts) - [璐墿搴旂敤锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ShoppingEts) -- [杞満鍔ㄧ敾鐨勪娇鐢紙ArkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimtaionEts) - - [寮圭獥锛圓rkTS锛夛紙API8锛塢(https://gitee.com/openharmony/codelabs/tree/master/ETSUI/CustomDialogEts) - [`UpgradePopup`锛氳嚜瀹氫箟寮圭獥锛圓rkTS锛夛紙API9锛塢(https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/UpgradePopup) diff --git a/zh-cn/design/OpenHarmony-API-governance.md b/zh-cn/design/OpenHarmony-API-governance.md index b56d09d461dd22683fcd66a0b4085fd865fa082d..91b732c41359b76bcffe48821db8b53c40b7e84c 100755 --- a/zh-cn/design/OpenHarmony-API-governance.md +++ b/zh-cn/design/OpenHarmony-API-governance.md @@ -12,7 +12,7 @@ OpenHarmony杞欢鏍堜腑鍖呭惈浜嗗涓鑹诧紝鍥犳API涔熷垎浣滃绉嶇被鍨嬨 - +![](figures/API-Category.png) 涓嶅悓鐨凙PI绫诲瀷鍏跺吋瀹规ц姹備篃涓嶄竴鏍凤紝鍏蜂綋濡備笅琛ㄦ墍杩帮細 @@ -60,7 +60,7 @@ OpenHarmony鐨勭洰鏍囨槸鏋勫缓闈㈠悜涓囩墿浜掕仈鏃朵唬鐨勬柊涓浠f搷浣滅郴缁燂紝 ### API璇勫娴佺▼ API璇勫娴佺▼濡備笅锛 - +![](figures/API-Workflow.png) 涓昏杩囩▼璇存槑锛 diff --git a/zh-cn/device-dev/device-test/xdevice.md b/zh-cn/device-dev/device-test/xdevice.md index 54662ecf75e2248d40b287edba9ead3fc3f9e491..c870962ca121ad0aca4b65217f55dcefe993a01b 100644 --- a/zh-cn/device-dev/device-test/xdevice.md +++ b/zh-cn/device-dev/device-test/xdevice.md @@ -476,7 +476,7 @@ run鎸囦护鍩烘湰浣跨敤鏂规硶濡備笅銆 type涓篶md鐨刢om鍙e搴旀澘瀛愪笂鐨凙T鍛戒护涓插彛锛岀敤浜庡璁惧鍙戦佹寚浠わ紝绀轰緥涓厤缃负ChA(COM20)涓插彛鍙枫 - L0-1 + ![L0-1](figures/L0-1.PNG) ipcamera璁惧鏈変袱绉嶈繛鎺ユ柟寮忥紝涓绉嶆槸鏈湴涓插彛杩炴帴锛屼竴绉嶆槸閫氳繃灞鍩熺綉ip杩炴帴銆 @@ -490,17 +490,17 @@ run鎸囦护鍩烘湰浣跨敤鏂规硶濡備笅銆 2. 閰嶇疆杈撳嚭->缂栬緫杈撳嚭琛ㄦ枃浠躲 - + ![](figures/NFS-1.PNG) 3. 娣诲姞璺緞NFS鍏变韩璺緞锛堝锛欴:\HS\NFS_Share_File -public 鈥揳lldirs锛夛紝杩欓噷瑕佹敞鎰廸tp鐨処P鍦板潃192.168.1.10涓哄紑鍙戞澘鐨処P銆 - + ![](figures/NFS-2.PNG) 4. 鍋滄NFS鏈嶅姟鍣->閲嶅惎杩愯NFS鏈嶅姟鍣ㄤ娇鍒氭墠娣诲姞鐨勫叡浜矾寰勭敓鏁堛 5. 鎵惧埌ipcamera璁惧鍦≒C涓婇潰鏄犲皠鐨勭綉鍙o細鎺у埗闈㈡澘->缃戠粶鍜孖nternet->缃戠粶鍏变韩涓績->浠ュお缃戠姸鎬->浠ュお缃戝睘鎬->鎵嬪姩璁剧疆IP鍦板潃涓:192.168.1.11銆 - + ![](figures/NFS-3.PNG) 3. 淇敼鏍圭洰褰曚腑鐨剈ser_config.xml鏂囦欢锛岀ず渚嬪涓嬨 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-ability.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..903fbad8c70147006c457bca8c4a7e6548a8b808 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-ability.md @@ -0,0 +1,36 @@ +# 鍏冭兘鍔涘瓙绯荤粺ChangeLog + +## cl.ability.1 appRecovery鎺ュ彛涓璕estartFlag灞炴у悕绉板彉鏇达紝鍒犻櫎浜嗘湭鏀寔鐨勫睘鎬 + +appRecovery鎺ュ彛涓璕estartFlag鏋氫妇鍛藉悕浠庣壒瀹氭晠闅滃彂鐢熷悗**涓嶉噸鍚**鏀规垚浜嗙壒瀹氭晠闅滃彂鐢熷悗**閲嶅惎**銆 +鍒犻櫎浜咰PP_CRASH_NO_RESTART銆 + +**鍙樻洿褰卞搷** + +3.2.10.6鐗堟湰涔嬪墠浣跨敤CPP_CRASH_NO_RESTART/JS_CRASH_NO_RESTART/APP_FREEZE_NO_RESTART绫诲瀷寮鍙戠殑搴旂敤锛屽湪3.2.10.6鐗堟湰涔嬪悗琛屼负浼氬彂鐢熷彉鍖栥 + +**鍏抽敭鎺ュ彛/缁勪欢鍙樻洿** + +**RestartFlag** 9+ + +鍙樻洿鍓嶏細 +| 鍚嶇О | 鍊 | 璇存槑 | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| ALWAYS_RESTART | 0 | 鎬绘槸閲嶅惎搴旂敤銆 | +| CPP_CRASH_NO_RESTART | 0x0001 | 鍙戠敓CPP_CRASH鏃**涓嶉噸鍚**搴旂敤銆 | +| JS_CRASH_NO_RESTART | 0x0002 | 鍙戠敓JS_CRASH鏃**涓嶉噸鍚**搴旂敤銆 | +| APP_FREEZE_NO_RESTART | 0x0004 | 鍙戠敓APP_FREEZE鏃**涓嶉噸鍚**搴旂敤銆 | +| NO_RESTART | 0xFFFF | 鎬绘槸涓嶉噸鍚簲鐢ㄣ | + +鍙樻洿鍚庯細 +| 鍚嶇О | 鍊 | 璇存槑 | +| ---------- | ---- | ---------- | +| ALWAYS_RESTART | 0 | 鎬绘槸閲嶅惎搴旂敤銆 | +| CPP_CRASH_NO_RESTART | NA | **鍒犻櫎**锛屼笉鏀寔璇ュ満鏅殑閲嶅惎銆 | +| RESTART_WHEN_JS_CRASH | 0x0001 | 鍙戠敓JS_CRASH鏃**閲嶅惎**搴旂敤銆 | +| RESTART_WHEN_APP_FREEZE | 0x0002 | 鍙戠敓APP_FREEZE鏃**閲嶅惎**搴旂敤銆 | +| NO_RESTART | 0xFFFF | 鎬绘槸涓嶉噸鍚簲鐢ㄣ | + +**閫傞厤鎸囧** + +鎸夋柊鐨勮涔夎繘琛岄傞厤銆 \ No newline at end of file