提交 27105540 编写于 作者: L LiAn 提交者: Gitee

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

Signed-off-by: NLiAn <lian15@huawei.com>
...@@ -73,8 +73,8 @@ BackupExtensionAbility is a class derived from the [ExtensionAbility](../applica ...@@ -73,8 +73,8 @@ BackupExtensionAbility is a class derived from the [ExtensionAbility](../applica
"data/storage/el2/base/files/", "data/storage/el2/base/files/",
"data/storage/el2/base/preferences/", "data/storage/el2/base/preferences/",
"data/storage/el2/base/haps/*/database/", "data/storage/el2/base/haps/*/database/",
"data/storage/el2/base/haps/*/base/files/", "data/storage/el2/base/haps/*/files/",
"data/storage/el2/base/haps/*/base/preferences/", "data/storage/el2/base/haps/*/preferences/",
] ]
} }
``` ```
...@@ -42,7 +42,7 @@ let fetchOptions = { ...@@ -42,7 +42,7 @@ let fetchOptions = {
}; };
``` ```
Call **PhotoAccessHelper.getAssets** to obtain the image asset. Call **PhotoAccessHelper.getAssets** to obtain image assets.
```ts ```ts
try { try {
...@@ -55,7 +55,7 @@ try { ...@@ -55,7 +55,7 @@ try {
} }
``` ```
### Obtaining an Image or Video by URI ### Obtaining an Image or Video Asset by URI
Example: Obtain the image with the file URI **file://media/Photo/1**. Example: Obtain the image with the file URI **file://media/Photo/1**.
...@@ -70,7 +70,7 @@ let fetchOptions = { ...@@ -70,7 +70,7 @@ let fetchOptions = {
}; };
``` ```
Call **PhotoAccessHelper.getAssets** to obtain the image asset. Call **PhotoAccessHelper.getAssets** to obtain image assets.
```ts ```ts
try { try {
...@@ -103,7 +103,7 @@ let fetchOptions = { ...@@ -103,7 +103,7 @@ let fetchOptions = {
}; };
``` ```
Call **PhotoAccessHelper.getAssets** to obtain the image assets. Call **PhotoAccessHelper.getAssets** to obtain image assets.
```ts ```ts
try { try {
...@@ -250,7 +250,7 @@ The files moved to the trash will be retained for 30 days, and deleted permanent ...@@ -250,7 +250,7 @@ The files moved to the trash will be retained for 30 days, and deleted permanent
**Prerequisites** **Prerequisites**
- A **photoAccessHelper** instance is obtained - A **photoAccessHelper** instance is obtained.
- The application has the **ohos.permission.WRITE_IMAGEVIDEO** and **ohos.permission.READ_IMAGEVIDEO** permissions. - The application has the **ohos.permission.WRITE_IMAGEVIDEO** and **ohos.permission.READ_IMAGEVIDEO** permissions.
Example: Move the first file in the result set to the trash. Example: Move the first file in the result set to the trash.
......
...@@ -5,7 +5,7 @@ The **photoAccessHelper** module provides APIs for managing system albums, inclu ...@@ -5,7 +5,7 @@ The **photoAccessHelper** module provides APIs for managing system albums, inclu
> **NOTE** > **NOTE**
> >
> Before you start, refer to [photoAccessHelper Overview](photoAccessHelper-overview.md) to learn how to obtain a **photoAccessHelper** instance and apply for permissions required. > Before you start, refer to [photoAccessHelper Overview](photoAccessHelper-overview.md) to learn how to obtain a **photoAccessHelper** instance and apply for permissions required.
> By default, the **photoAccessHelper** instance obtained in [photoAccessHelper Overview](photoAccessHelper-overview.md) is used when **photoAccessHelper** APIs are used. If the code for obtaining the **photoAccessHelper** instance is not added, an error indicating that **photoAccessHelper** is not defined is reported. > By default, the **PhotoAccessHelper** instance obtained in [photoAccessHelper Overview](photoAccessHelper-overview.md) is used when **PhotoAccessHelper** APIs are used. If the code for obtaining the **PhotoAccessHelper** instance is not added, an error indicating that **PhotoAccessHelper** is not defined is reported.
To ensure application running efficiency, most **photoAccessHelper** calls are asynchronous in callback or promise mode. The following code samples use promise-based APIs. For details about the APIs, see [Album Management](../reference/apis/js-apis-photoAccessHelper.md). To ensure application running efficiency, most **photoAccessHelper** calls are asynchronous in callback or promise mode. The following code samples use promise-based APIs. For details about the APIs, see [Album Management](../reference/apis/js-apis-photoAccessHelper.md).
Unless otherwise specified, all the media assets to be obtained in this document exist in the database. If no media asset is obtained when the sample code is executed, check whether the media assets exist in the database. Unless otherwise specified, all the media assets to be obtained in this document exist in the database. If no media asset is obtained when the sample code is executed, check whether the media assets exist in the database.
...@@ -133,8 +133,8 @@ Example: Unfavorite an image. ...@@ -133,8 +133,8 @@ Example: Unfavorite an image.
**How to Develop** **How to Develop**
1. [Obtain the image and videos in **Favorites**](#obtaining-images-and-videos-in-favorites). 1. [Obtain the image and videos in **Favorites**](#obtaining-images-and-videos-in-favorites).
2. Set **isFavorite** to **false**. 2. Set **favoriteState** to **false**.
3. Use **FileAsset.favorite** to remove the image from **Favorites**. 3. Use **FileAsset.setFavorite** to remove the image from **Favorites**.
```ts ```ts
......
...@@ -2,55 +2,100 @@ ...@@ -2,55 +2,100 @@
When a user needs to download a file from the network to a local directory or save a user file into another directory, use **FilePicker** to save the file. When a user needs to download a file from the network to a local directory or save a user file into another directory, use **FilePicker** to save the file.
The operations for saving images, audio or video clips, and documents are similar. Call **save()** of the corresponding picker instance and pass in **saveOptions**. The operations for saving images, audio or video clips, and documents are similar. Call **save()** of the corresponding picker instance and pass in **saveOptions**. No permission is required if **FilePicker** is used to access files.
The **save()** interface saves the file in the file manager, not in the Gallery. The **save()** method saves the file in the file manager, not in the Gallery.
## Saving Images or Video Files ## Saving Images or Video Files
1. Import the **picker** module and **fs** module. For example, select an image from **Gallery** and save it to the file manager.
1. Import the [picker](../reference/apis/js-apis-file-picker.md), [fs](../reference/apis/js-apis-file-fs.md), [photoAccessHelper](../reference/apis/js-apis-photoAccessHelper.md), and [dataSharePredicates](../reference/apis/js-apis-data-dataSharePredicates.md) modules.
```ts ```ts
import picker from '@ohos.file.picker'; import picker from '@ohos.file.picker';
import fs from '@ohos.file.fs'; import fs from '@ohos.file.fs';
import photoAccessHelper from '@ohos.file.photoAccessHelper';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
``` ```
2. Create a **photoSaveOptions** instance. 2. Obtain the thumbnail of the first image on the device. Before performing this operation, ensure that at least one image exists on the device.
```ts ```ts
const photoSaveOptions = new picker.PhotoSaveOptions(); // Create a photoSaveOptions instance. const context = getContext(this);
photoSaveOptions.newFileNames = ["PhotoViewPicker01.jpg"]; // (Optional) Set the names of the files to save. let photoAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
let pixelmapArrayBuffer;
async getPixelmap() {
try {
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOption = {
fetchColumns: [],
predicates: predicates
};
let fetchResult = await photoAccessHelper.getAssets(fetchOption);
console.info('[picker] getThumbnail fetchResult: ' + fetchResult);
const asset = await fetchResult.getFirstObject();
console.info('[picker] getThumbnail asset displayName = ', asset.displayName);
asset.getThumbnail().then((pixelMap) => {
let pixelBytesNumber = pixelMap.getPixelBytesNumber();
const readBuffer = new ArrayBuffer(pixelBytesNumber);
pixelMap.readPixelsToBuffer(readBuffer).then(() => {
pixelmapArrayBuffer = readBuffer;
})
}).catch((err) => {
console.error('[picker] getThumbnail failed with error: ' + err);
});
} catch (error) {
console.error('[picker] getThumbnail error = ' + error);
}
}
``` ```
3. Create a **photoViewPicker** instance and call [save()](../reference/apis/js-apis-file-picker.md#save) to open the **FilePicker** page to save the files. After the user selects the target folder, the file saving operation is complete. After the files are saved successfully, the URIs of the files saved are returned. 3. Create a **photoViewPicker** instance and call [save()](../reference/apis/js-apis-file-picker.md#save) to open the **FilePicker** page to save the image. After the user selects the target folder, the file saving operation is complete. After the image is saved successfully, the URI of the saved image is returned.
The permission on the URIs returned by **save()** is read/write. Further file operations can be performed based on the URIs in the result set. Note that the URI cannot be directly used in the **picker** callback to open a file. You need to define a global variable to save the URI and use a button to trigger file opening. The permission on the URI returned by **save()** is read/write. Further operations can be performed based on the URI in the result set. Note that the URI cannot be directly used in the **picker** callback to open a file. You need to define a global variable to save the URI and use a button to trigger file opening.
```ts ```ts
let uri = null; let uri:string;
const photoViewPicker = new picker.PhotoViewPicker(); async photoViewPickerSave() {
photoViewPicker.save(photoSaveOptions).then((photoSaveResult) => { try {
uri = photoSaveResult[0]; const photoSaveOptions = new picker.PhotoSaveOptions(); // Create a photoSaveOptions instance.
console.info('photoViewPicker.save to file succeed and uri is:' + uri); photoSaveOptions.newFileNames = ["PhotoViewPicker01.png"]; // (Optional) Name of the file to be saved. The file name in the square brackets can be customized and must be unique. If the file name already exists on the device, change the file name. Otherwise, an error will be returned.
}).catch((err) => {
console.error(`Invoke photoViewPicker.save failed, code is ${err.code}, message is ${err.message}`); const photoViewPicker = new picker.PhotoViewPicker();
}) try {
let photoSaveResult = await photoViewPicker.save(photoSaveOptions);
if (photoSaveResult != undefined) {
console.info("[picker] photoViewPickerSave photoSaveResult = " + JSON.stringify(photoSaveResult));
this.uri = photoSaveResult[0];
console.info('photoViewPicker.save to file succeed and uri is:' + photoSaveResult[0]);
}
} catch (err) {
console.error(`[picker] Invoke photoViewPicker.save failed, code is ${err.code}, message is ${err.message}`);
}
} catch (error) {
console.info("[picker] photoViewPickerSave error = " + error);
}
}
``` ```
4. Use a button to trigger invocation of other functions. Use [fs.openSync()](../reference/apis/js-apis-file-fs.md#fsopensync) to open the file based on the URI and obtain the FD. Note that the **mode** parameter of **fs.openSync()** must be **fs.OpenMode.READ_WRITE**. 4. Use a button to trigger invocation of other functions. Use [fs.openSync()](../reference/apis/js-apis-file-fs.md#fsopensync) to open the file based on the URI and obtain the FD. Note that the **mode** parameter of **fs.openSync()** must be **fs.OpenMode.READ_WRITE**.
```ts Use [fs.write](../reference/apis/js-apis-file-fs.md#fswrite) to edit and modify the file based on the FD. After the modification is complete, close the FD.
let file = fs.openSync(uri, fs.OpenMode.READ_WRITE);
console.info('file fd: ' + file.fd);
```
5. Use [fs.writeSync()](../reference/apis/js-apis-file-fs.md#writesync) to edit the file based on the FD, and then close the FD.
```ts ```ts
let writeLen = fs.writeSync(file.fd, 'hello, world'); async writeOnly(uri) {
console.info('write data to file succeed and size is:' + writeLen); try {
fs.closeSync(file); let file = fs.openSync(uri, fs.OpenMode.WRITE_ONLY);
let writeLen = await fs.write(file.fd, pixelmapArrayBuffer);
fs.closeSync(file);
console.info("[picker] writeOnly writeLen = " + writeLen);
} catch (error) {
console.info("[picker] writeOnly error: " + error);
}
}
``` ```
## Saving Documents ## Saving Documents
......
...@@ -353,7 +353,7 @@ A constructor used to create a **SessionBackup** instance. ...@@ -353,7 +353,7 @@ A constructor used to create a **SessionBackup** instance.
```js ```js
import fs from '@ohos.file.fs'; import fs from '@ohos.file.fs';
let generalCallbacks = backup.GeneralCallbacks({ let generalCallbacks = ({
onFileReady: (err, file) => { onFileReady: (err, file) => {
if (err) { if (err) {
console.error('onFileReady failed with err: ' + err); console.error('onFileReady failed with err: ' + err);
...@@ -568,7 +568,7 @@ A constructor used to create a **SessionRestore** instance. ...@@ -568,7 +568,7 @@ A constructor used to create a **SessionRestore** instance.
```js ```js
import fs from '@ohos.file.fs'; import fs from '@ohos.file.fs';
let generalCallbacks = backup.GeneralCallbacks({ let generalCallbacks = ({
onFileReady: (err, file) => { onFileReady: (err, file) => {
if (err) { if (err) {
console.error('onFileReady failed with err: ' + err); console.error('onFileReady failed with err: ' + err);
......
# @ohos.file.picker (File Picker) # @ohos.file.picker (File Picker)
**Picker** encapsulates the system applications such as **PhotoViewPicker**, **DocumentViewPicker** and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. The application can select the picker as required.
> **NOTE** > **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 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.
**Picker** encapsulates the system applications such as **PhotoViewPicker**, **DocumentViewPicker** and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. The application can select the picker as required.
## Modules to Import ## Modules to Import
```js ```js
...@@ -138,7 +138,7 @@ async function example() { ...@@ -138,7 +138,7 @@ async function example() {
save(option?: PhotoSaveOptions) : Promise&lt;Array&lt;string&gt;&gt; save(option?: PhotoSaveOptions) : Promise&lt;Array&lt;string&gt;&gt;
Saves one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. Saves one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. The **save()** API saves the file in the file manager, not in the Gallery.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -177,7 +177,7 @@ async function example() { ...@@ -177,7 +177,7 @@ async function example() {
save(option: PhotoSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void save(option: PhotoSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void
Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. The **save()** API saves the file in the file manager, not in the Gallery.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -213,7 +213,7 @@ async function example() { ...@@ -213,7 +213,7 @@ async function example() {
save(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void save(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;) : void
Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. The **save()** API saves the file in the file manager, not in the Gallery.
**System capability**: SystemCapability.FileManagement.UserFileService **System capability**: SystemCapability.FileManagement.UserFileService
...@@ -727,7 +727,7 @@ Defines information about the images or videos selected. ...@@ -727,7 +727,7 @@ Defines information about the images or videos selected.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ----------------------- | ------------------- | ---- | ---- | ------------------------------ | | ----------------------- | ------------------- | ---- | ---- | ------------------------------ |
| photoUris | Array&lt;string&gt; | Yes | Yes | URIs of the media files selected.| | photoUris | Array&lt;string&gt; | Yes | Yes | URIs of the media files selected.|
| isOriginalPhoto | boolean | Yes | Yes | Whether the selected media file is the original image.| | isOriginalPhoto | boolean | Yes | Yes | Whether the selected media file is the original image.|
## PhotoSaveOptions ## PhotoSaveOptions
......
...@@ -4,7 +4,7 @@ The **photoAccessHelper** module provides APIs for album management, including c ...@@ -4,7 +4,7 @@ The **photoAccessHelper** module provides APIs for album management, including c
> **NOTE** > **NOTE**
> >
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -341,7 +341,7 @@ For details about the error codes, see [File Management Error Codes](../errorcod ...@@ -341,7 +341,7 @@ For details about the error codes, see [File Management Error Codes](../errorcod
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 202 | Called by non-system application. | | 202 | Called by non-system application. |
| 401 | if type displayName is not string. | | 401 | if type displayName is not string. |
| 14000001 | if type of displayName is invalid. | | 14000001 | if type of displayName is invalid. |
...@@ -401,9 +401,9 @@ async function example() { ...@@ -401,9 +401,9 @@ async function example() {
let options = { let options = {
title: 'testPhoto' title: 'testPhoto'
} }
phAccessHelper.createAsset(photoType, extension, options, (err, photoAsset) => { phAccessHelper.createAsset(photoType, extension, options, (err, uri) => {
if (photoAsset != undefined) { if (uri != undefined) {
console.info('createAsset file displayName' + photoAsset.displayName); console.info('createAsset uri' + uri);
console.info('createAsset successfully'); console.info('createAsset successfully');
} else { } else {
console.error('createAsset failed, message = ', err); console.error('createAsset failed, message = ', err);
...@@ -445,9 +445,9 @@ async function example() { ...@@ -445,9 +445,9 @@ async function example() {
console.info('createAssetDemo'); console.info('createAssetDemo');
let photoType = photoAccessHelper.PhotoType.IMAGE; let photoType = photoAccessHelper.PhotoType.IMAGE;
let extension = 'jpg'; let extension = 'jpg';
phAccessHelper.createAsset(photoType, extension, (err, photoAsset) => { phAccessHelper.createAsset(photoType, extension, (err, uri) => {
if (photoAsset != undefined) { if (uri != undefined) {
console.info('createAsset file displayName' + photoAsset.displayName); console.info('createAsset uri' + uri);
console.info('createAsset successfully'); console.info('createAsset successfully');
} else { } else {
console.error('createAsset failed, message = ', err); console.error('createAsset failed, message = ', err);
...@@ -499,8 +499,8 @@ async function example() { ...@@ -499,8 +499,8 @@ async function example() {
let options = { let options = {
title: 'testPhoto' title: 'testPhoto'
} }
let photoAsset = await phAccessHelper.createAsset(photoType,extension, options); let uri = await phAccessHelper.createAsset(photoType, extension, options);
console.info('createAsset file displayName' + photoAsset.displayName); console.info('createAsset uri' + uri);
console.info('createAsset successfully'); console.info('createAsset successfully');
} catch (err) { } catch (err) {
console.error('createAsset failed, message = ', err); console.error('createAsset failed, message = ', err);
...@@ -1077,15 +1077,15 @@ async function example() { ...@@ -1077,15 +1077,15 @@ async function example() {
//file had changed, do something //file had changed, do something
} }
// Register onCallback1. // Register onCallback1.
phAccessHelper.registerChange(photoAsset.uri, false, onCallback1); phAccessHelper.registerChange(photoAsset.uri, false, onCallback1);
// Register onCallback2. // Register onCallback2.
phAccessHelper.registerChange(photoAsset.uri, false, onCallback2); phAccessHelper.registerChange(photoAsset.uri, false, onCallback2);
photoAsset.favorite(true, (err) => { photoAsset.setFavorite(true, (err) => {
if (err == undefined) { if (err == undefined) {
console.info('favorite successfully'); console.info('setFavorite successfully');
} else { } else {
console.error('favorite failed with error:' + err); console.error('setFavorite failed with error:' + err);
} }
}); });
} }
...@@ -1145,11 +1145,11 @@ async function example() { ...@@ -1145,11 +1145,11 @@ async function example() {
phAccessHelper.registerChange(photoAsset.uri, false, onCallback2); phAccessHelper.registerChange(photoAsset.uri, false, onCallback2);
// Unregister the listening of onCallback1. // Unregister the listening of onCallback1.
phAccessHelper.unRegisterChange(photoAsset.uri, onCallback1); phAccessHelper.unRegisterChange(photoAsset.uri, onCallback1);
photoAsset.favorite(true, (err) => { photoAsset.setFavorite(true, (err) => {
if (err == undefined) { if (err == undefined) {
console.info('favorite successfully'); console.info('setFavorite successfully');
} else { } else {
console.error('favorite failed with error:' + err); console.error('setFavorite failed with error:' + err);
} }
}); });
} }
...@@ -1539,7 +1539,7 @@ For details about the error codes, see [Universal Error Codes](../errorcodes/err ...@@ -1539,7 +1539,7 @@ For details about the error codes, see [Universal Error Codes](../errorcodes/err
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 401 | if values to commit is invalid. | | 401 | if values to commit is invalid. |
**Example** **Example**
```ts ```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates'; import dataSharePredicates from '@ohos.data.dataSharePredicates';
...@@ -2839,7 +2839,7 @@ Obtains image and video assets. This API uses an asynchronous callback to return ...@@ -2839,7 +2839,7 @@ Obtains image and video assets. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| options | [FetchOptions](#fetchoptions) | Yes | Options for fetching the album files.| | options | [FetchOptions](#fetchoptions) | Yes | Options for fetching the albums.|
| callback | AsyncCallback&lt;[FetchResult](#fetchresult)&lt;[PhotoAsset](#photoasset)&gt;&gt; | Yes | Callback invoked to return the image and video assets obtained.| | callback | AsyncCallback&lt;[FetchResult](#fetchresult)&lt;[PhotoAsset](#photoasset)&gt;&gt; | Yes | Callback invoked to return the image and video assets obtained.|
**Error codes** **Error codes**
...@@ -2856,17 +2856,17 @@ For details about the error codes, see [Universal Error Codes](../errorcodes/err ...@@ -2856,17 +2856,17 @@ For details about the error codes, see [Universal Error Codes](../errorcodes/err
import dataSharePredicates from '@ohos.data.dataSharePredicates'; import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() { async function example() {
console.info('albumGetPhotoAssetsDemoCallback'); console.info('albumGetAssetsDemoCallback');
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
let albumFetchOptions = { let albumFetchOptions = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
let fetchOption = { let fetchOption = {
fetchColumns: [], fetchColumns: [],
predicates: predicates predicates: predicates
}; };
const albumList = await phAccessHelper.getAlbums(albumFetchOptions); const albumList = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
const album = await albumList.getFirstObject(); const album = await albumList.getFirstObject();
album.getAssets(fetchOption, (err, albumFetchResult) => { album.getAssets(fetchOption, (err, albumFetchResult) => {
if (albumFetchResult != undefined) { if (albumFetchResult != undefined) {
...@@ -2914,17 +2914,18 @@ For details about the error codes, see [Universal Error Codes](../errorcodes/err ...@@ -2914,17 +2914,18 @@ For details about the error codes, see [Universal Error Codes](../errorcodes/err
import dataSharePredicates from '@ohos.data.dataSharePredicates'; import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() { async function example() {
console.info('albumGetPhotoAssetsDemoPromise'); console.info('albumGetAssetsDemoPromise');
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
let albumFetchOptions = { let albumFetchOptions = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
let fetchOption = { let fetchOption = {
fetchColumns: [], fetchColumns: [],
predicates: predicates predicates: predicates
}; };
const albumList = await phAccessHelper.getAlbums(albumFetchOptions); const albumList = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
const album = await albumList.getFirstObject(); const album = await albumList.getFirstObject();
album.getAssets(fetchOption).then((albumFetchResult) => { album.getAssets(fetchOption).then((albumFetchResult) => {
console.info('album getPhotoAssets successfully, getCount: ' + albumFetchResult.getCount()); console.info('album getPhotoAssets successfully, getCount: ' + albumFetchResult.getCount());
...@@ -2967,9 +2968,10 @@ async function example() { ...@@ -2967,9 +2968,10 @@ async function example() {
console.info('albumCommitModifyDemo'); console.info('albumCommitModifyDemo');
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
let albumFetchOptions = { let albumFetchOptions = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
const albumList = await phAccessHelper.getAlbums(albumFetchOptions); const albumList = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
const album = await albumList.getFirstObject(); const album = await albumList.getFirstObject();
album.albumName = 'hello'; album.albumName = 'hello';
album.commitModify((err) => { album.commitModify((err) => {
...@@ -3015,9 +3017,10 @@ async function example() { ...@@ -3015,9 +3017,10 @@ async function example() {
console.info('albumCommitModifyDemo'); console.info('albumCommitModifyDemo');
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
let albumFetchOptions = { let albumFetchOptions = {
fetchColumns: [],
predicates: predicates predicates: predicates
}; };
const albumList = await phAccessHelper.getAlbums(albumFetchOptions); const albumList = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
const album = await albumList.getFirstObject(); const album = await albumList.getFirstObject();
album.albumName = 'hello'; album.albumName = 'hello';
album.commitModify().then(() => { album.commitModify().then(() => {
...@@ -3496,6 +3499,131 @@ async function example() { ...@@ -3496,6 +3499,131 @@ async function example() {
} }
``` ```
### setCoverUri
setCoverUri(uri: string, callback: AsyncCallback&lt;void&gt;): void;
Sets the album cover. This API uses an asynchronous callback to return the result.
**NOTE**<br>This API can be used to set the user album cover, but not the system album cover.
**System API**: This is a system API.
**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| uri | string | Yes | URI of the file to be set as the album cover.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 202 | Called by non-system application. |
| 401 | if parameter is invalid. |
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('setCoverUriDemoCallback');
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOption = {
fetchColumns: [],
predicates: predicates
};
let albumFetchResult = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
let album = await albumFetchResult.getFirstObject();
let fetchResult = await album.getAssets(fetchOption);
let asset = await fetchResult.getFirstObject();
album.setCoverUri(asset.uri, (err) => {
if (err === undefined) {
console.info('album setCoverUri successfully');
} else {
console.error('album setCoverUri failed with error: ' + err);
}
});
} catch (err) {
console.error('setCoverUriDemoCallback failed with error: ' + err);
}
}
```
### setCoverUri
setCoverUri(uri: string): Promise&lt;void&gt;;
Sets the album cover. This API uses a promise to return the result.
**NOTE**<br>This API can be used to set the user album cover, but not the system album cover.
**System API**: This is a system API.
**Required permissions**: ohos.permission.WRITE_IMAGEVIDEO
**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- |
| uri | string | Yes | URI of the file to be set as the album cover.|
**Return value**
| Type | Description |
| --------------------------------------- | ----------------- |
|Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcodes/errorcode-universal.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 202 | Called by non-system application. |
| 401 | if parameter is invalid. |
**Example**
```ts
import dataSharePredicates from '@ohos.data.dataSharePredicates';
async function example() {
try {
console.info('setCoverUriDemoCallback');
let predicates = new dataSharePredicates.DataSharePredicates();
let fetchOption = {
fetchColumns: [],
predicates: predicates
};
let albumFetchResult = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC);
let album = await albumFetchResult.getFirstObject();
let fetchResult = await album.getAssets(fetchOption);
let asset = await fetchResult.getFirstObject();
album.setCoverUri(asset.uri, (err) => {
if (err === undefined) {
console.info('album setCoverUri successfully');
} else {
console.error('album setCoverUri failed with error: ' + err);
}
});
} catch (err) {
console.error('setCoverUriDemoCallback failed with error: ' + err);
}
}
```
## MemberType ## MemberType
Enumerates the member types. Enumerates the member types.
...@@ -3597,6 +3725,7 @@ Defines the key information about an image or video file. ...@@ -3597,6 +3725,7 @@ Defines the key information about an image or video file.
| POSITION | 'position' | File location type. **System API**: This is a system API. | | POSITION | 'position' | File location type. **System API**: This is a system API. |
| DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. | | DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. |
| HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. | | HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. |
| CAMERA_SHOT_KEY | 'camera_shot_key' | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.)<br/>**System API**: This is a system API. |
## AlbumKeys ## AlbumKeys
...@@ -3618,6 +3747,7 @@ Defines the options for creating an image or video asset. ...@@ -3618,6 +3747,7 @@ Defines the options for creating an image or video asset.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------------- | ------------------- | ---- | ------------------------------------------------ | | ---------------------- | ------------------- | ---- | ------------------------------------------------ |
| subtype | [PhotoSubtype](#photosubtype) | No | Subtype of the image or video. **System API**: This is a system API. | | subtype | [PhotoSubtype](#photosubtype) | No | Subtype of the image or video. **System API**: This is a system API. |
| cameraShotKey | string | No | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.)<br/>**System API**: This is a system API. |
## CreateOptions ## CreateOptions
......
...@@ -53,12 +53,12 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -53,12 +53,12 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```js ```js
import uriPermissionManager from '@ohos.application.uriPermissionManager'; import uriPermissionManager from '@ohos.application.uriPermissionManager';
import WantConstant from '@ohos.ability.wantConstant'; import WantConstant from '@ohos.ability.wantConstant';
import fileio from '@ohos.fileio'; import fs from '@ohos.file.fs';
import fileUri from '@ohos.file.fileuri'; import fileUri from '@ohos.file.fileuri';
let targetBundleName = 'com.example.test_case1' let targetBundleName = 'com.example.test_case1'
let path = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir"; let path = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir";
fileio.mkdir(path, function (err) { fs.mkdir(path, function (err) {
if (err) { if (err) {
console.log("mkdir error"+err.message) console.log("mkdir error"+err.message)
} else { } else {
...@@ -115,13 +115,13 @@ By default, an application can authorize its own URIs to another application. If ...@@ -115,13 +115,13 @@ By default, an application can authorize its own URIs to another application. If
```js ```js
import uriPermissionManager from '@ohos.application.uriPermissionManager'; import uriPermissionManager from '@ohos.application.uriPermissionManager';
import WantConstant from '@ohos.ability.wantConstant'; import WantConstant from '@ohos.ability.wantConstant';
import fileio from '@ohos.fileio'; import fs from '@ohos.file.fs';
import fileUri from '@ohos.file.fileuri'; import fileUri from '@ohos.file.fileuri';
let targetBundleName = 'com.example.test_case1' let targetBundleName = 'com.example.test_case1'
let path = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir"; let path = "file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir";
fileio.mkdir(path, function (err) { fs.mkdir(path, function (err) {
if (err) { if (err) {
console.log("mkdir error"+err.message) console.log("mkdir error"+err.message)
} else { } else {
......
...@@ -100,6 +100,18 @@ Allows an application to read telephony information. ...@@ -100,6 +100,18 @@ Allows an application to read telephony information.
**Start version**: 8 **Start version**: 8
## ohos.permission.GET_PHONE_NUMBERS
Allows an application to obtain the phone numbers of the device.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
**Start version**: 10
## ohos.permission.REQUIRE_FORM ## ohos.permission.REQUIRE_FORM
Allows an application to obtain the Ability Form. Allows an application to obtain the Ability Form.
...@@ -776,7 +788,7 @@ Allows an application to listen for input events. Only the system signed applica ...@@ -776,7 +788,7 @@ Allows an application to listen for input events. Only the system signed applica
## ohos.permission.MANAGE_MISSIONS ## ohos.permission.MANAGE_MISSIONS
Allows an application to manage ability mission stacks. Allows an application to manage missions in the system.
**Permission level**: system_core **Permission level**: system_core
...@@ -860,7 +872,7 @@ Allows an SA to call the network management, Wi-Fi, network adapter listening, a ...@@ -860,7 +872,7 @@ Allows an SA to call the network management, Wi-Fi, network adapter listening, a
## ohos.permission.SET_ABILITY_CONTROLLER ## ohos.permission.SET_ABILITY_CONTROLLER
Allows an application to set the start and stop of an ability. Allows an application to intercept the startup of the Ability component. This permission is used for testing, such as the stability test.
**Permission level**: system_basic **Permission level**: system_basic
...@@ -956,7 +968,7 @@ Allows an application to clear application data. ...@@ -956,7 +968,7 @@ Allows an application to clear application data.
## ohos.permission.RUNNING_STATE_OBSERVER ## ohos.permission.RUNNING_STATE_OBSERVER
Allows an application to observe the application status. Allows an application to listen for its status.
**Permission level**: system_basic **Permission level**: system_basic
...@@ -1004,7 +1016,7 @@ Allows a system application to obtain Wi-Fi parameters. ...@@ -1004,7 +1016,7 @@ Allows a system application to obtain Wi-Fi parameters.
## ohos.permission.SET_WIFI_INFO ## ohos.permission.SET_WIFI_INFO
Allows an application to set Wi-Fi devices. Allows an application to set a Wi-Fi device.
**Permission level**: normal **Permission level**: normal
...@@ -1280,7 +1292,7 @@ Allows a device administrator application to set the screen-off time. ...@@ -1280,7 +1292,7 @@ Allows a device administrator application to set the screen-off time.
## ohos.permission.ENTERPRISE_INSTALL_BUNDLE ## ohos.permission.ENTERPRISE_INSTALL_BUNDLE
Allows a device administrator application to install and uninstall bundles. Allows a device administrator application to install and uninstall applications.
**Permission level**: system_core **Permission level**: system_core
...@@ -1656,7 +1668,7 @@ Allows an application to access geographical locations in the user's media file. ...@@ -1656,7 +1668,7 @@ Allows an application to access geographical locations in the user's media file.
## ohos.permission.CAMERA ## ohos.permission.CAMERA
Allows an application to use the camera to take photos and record videos. Allows an application to use the camera.
**Permission level**: normal **Permission level**: normal
...@@ -2683,3 +2695,39 @@ Allows an application to listen for the card running status. ...@@ -2683,3 +2695,39 @@ Allows an application to listen for the card running status.
**Enable via ACL**: TRUE **Enable via ACL**: TRUE
**Start version**: 10 **Start version**: 10
## ohos.permission.MANAGE_DEVICE_AUTH_CRED
Allows an application to call interfaces of the DeviceAuthCredMgr application.
**Permission level**: system_basic
**Authorization mode**: system_grant
**Enable ACL**: FALSE
**Start version**: 10
## ohos.permission.UNINSTALL_BUNDLE
Allows an application to uninstall applications.
**Permission level**: system_core
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
**Start version**: 10
## ohos.permission.RECOVER_BUNDLE
Allows an application to restore pre-installed applications.
**Permission level**: system_core
**Authorization mode**: system_grant
**Enable via ACL**: TRUE
**Start version**: 10
...@@ -22,8 +22,8 @@ New IP provides at least 1% higher payload transmission efficiency than IPv4 and ...@@ -22,8 +22,8 @@ New IP provides at least 1% higher payload transmission efficiency than IPv4 and
| Scenario | Header Overhead (Bytes) | Payload Transmission Efficiency<br>(Wi-Fi MTU = 1500 Bytes, BT MTU = 255 Bytes)| | Scenario | Header Overhead (Bytes) | Payload Transmission Efficiency<br>(Wi-Fi MTU = 1500 Bytes, BT MTU = 255 Bytes)|
| --------------- | ------------ | ------------------------------------------- | | --------------- | ------------ | ------------------------------------------- |
| IPv4 for Wi-Fi | 30 + 8 + 20 = 58 | (1500 - 58)/1500 = 96.13% | | IPv4 for Wi-Fi | 30 + 8 + 20 = 58 | (1500 - 58)/1500 = 96.13% |
| IPv6 for Wi-Fi | 30 + 8 + 40 = 78 | (1500 - 78)/1500 = 94.8% | | IPv6 for Wi-Fi | 30 + 8 + 40 = 78 | (1500 - 78)/1500 = 94.8% |
| New IP for Wi-Fi | 30 + 8 + 5 = 43 | (1500 - 43)/1500 = 97.13% | | New IP for Wi-Fi | 30 + 8 + 5 = 43 | (1500 - 43)/1500 = 97.13% |
## Variable-Length Header Format ## Variable-Length Header Format
...@@ -97,7 +97,7 @@ Only the Linux 5.10 kernel of the RK3568 development board supports the New IP k ...@@ -97,7 +97,7 @@ Only the Linux 5.10 kernel of the RK3568 development board supports the New IP k
# kernel/linux/config/linux-5.10/arch/arm64/configs/rk3568_standard_defconfig # kernel/linux/config/linux-5.10/arch/arm64/configs/rk3568_standard_defconfig
CONFIG_NEWIP=y // Enable the New IP kernel protocol stack. CONFIG_NEWIP=y // Enable the New IP kernel protocol stack.
CONFIG_NEWIP_HOOKS=y // Enable New IP stub functions to be dynamically registered non-disruptively. This feature must be enabled when New IP is enabled. CONFIG_NEWIP_HOOKS=y // Enable New IP stub functions to be dynamically registered non-disruptively. This feature must be enabled when New IP is enabled.
VENDOR_HOOKS=y // Enable the basic kernel instrumentation framework. New IP depends on this setting. It is enabled by default for the RK3568 development board. HCK_VENDOR_HOOKS=y // Enable the basic kernel instrumentation framework. New IP depends on this framework. It is enabled by default on the RK3568 development board.
``` ```
Run the following command to check whether the New IP protocol stack is successfully enabled: Run the following command to check whether the New IP protocol stack is successfully enabled:
...@@ -119,8 +119,18 @@ out/kernel/OBJ/linux-5.10/net/newip/tcp_nip_output.o ...@@ -119,8 +119,18 @@ out/kernel/OBJ/linux-5.10/net/newip/tcp_nip_output.o
```c ```c
/* Register the New IP ehash function with the kernel. */ /* Register the New IP ehash function with the kernel. */
register_trace_ninet_ehashfn_hook(&ninet_ehashfn_hook, NULL); /* Call the newip hook function in sk_ehashfn function (net\ipv4\inet_hashtables.c):
*/
void nip_ninet_ehashfn(const struct sock *sk, u32 *ret)
{
*ret = ninet_ehashfn(sock_net(sk), &sk->SK_NIP_RCV_SADDR,
sk->sk_num, &sk->SK_NIP_DADDR, sk->sk_dport);
}
void nip_ninet_ehashfn_lhck_register(void)
{
REGISTER_HCK_LITE_HOOK(nip_ninet_ehashfn_lhck, nip_ninet_ehashfn);
}
/* Add the New IP stack processing to the general entry function of IPv4/IPv6 stacks. */ /* Add the New IP stack processing to the general entry function of IPv4/IPv6 stacks. */
static u32 sk_ehashfn(const struct sock *sk) static u32 sk_ehashfn(const struct sock *sk)
...@@ -134,14 +144,12 @@ static u32 sk_ehashfn(const struct sock *sk) ...@@ -134,14 +144,12 @@ static u32 sk_ehashfn(const struct sock *sk)
&sk->sk_v6_daddr, sk->sk_dport); &sk->sk_v6_daddr, sk->sk_dport);
#endif #endif
if (trace_vendor_ninet_ehashfn_enabled()) { if (sk->sk_family == AF_NINET) {
if (sk->sk_family == AF_NINET) { u32 ret = 0;
u32 ret = 0;
/* Register the New IP ehash function. */ /* Register the New IP ehash function. */
trace_vendor_ninet_ehashfn(sk, &ret); CALL_HCK_LITE_HOOK(nip_ninet_ehashfn_lhck, sk, &ret);
return ret; return ret;
}
} }
/* IPv4 */ /* IPv4 */
return inet_ehashfn(sock_net(sk), return inet_ehashfn(sock_net(sk),
...@@ -166,8 +174,8 @@ The user-mode application calls **socket()** to create a New IP socket and uses ...@@ -166,8 +174,8 @@ The user-mode application calls **socket()** to create a New IP socket and uses
| API | Input | Output | Return Value | Description | | API | Input | Output | Return Value | Description |
| -------- | ------------------------------------------------------------ | ---------------------------------------------- | ---------------- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---------------------------------------------- | ---------------- | ------------------------------------------------------------ |
| socket | int **domain**, int type, int **protocol** | NA | Socket handle **sockfd**.| Creates a New IP socket. <br>**domain** must be **AF_NINET**, which indicates a New IP socket.<br>**protocol** can be **IPPROTO_TCP** or **IPPROTO_UDP**.<br>This API returns the handle of the **socket** instance created.| | socket | int **domain**, int type, int **protocol** | NA | Socket handle **sockfd**.| Creates a New IP socket. <br>**domain** must be **AF_NINET**, which indicates a New IP socket.<br>**protocol** can be **IPPROTO_TCP** or **IPPROTO_UDP**.<br>This API returns the handle of the **socket** instance created. |
| bind | int sockfd, const **struct sockaddr_nin** *myaddr, socklen_t addrlen | NA | Error code, which is an integer. | Binds the **socket** instance to the specified IP address and port.<br> **myaddr->sin_family** must be **AF_NINET**.| | bind | int sockfd, const **struct sockaddr_nin** *myaddr, socklen_t addrlen | NA | Error code, which is an integer. | Binds the **socket** instance to the specified IP address and port.<br>**myaddr->sin_family** must be **AF_NINET**. |
| listen | int socket, int backlog | NA | Error code, which is an integer. | Listens for the New IP address and port from the server. | | listen | int socket, int backlog | NA | Error code, which is an integer. | Listens for the New IP address and port from the server. |
| connect | int sockfd, const **struct sockaddr_nin** *addr, aocklen_t addrlen | NA | Error code, which is an integer. | Sets up a connection between the client and the server. | | connect | int sockfd, const **struct sockaddr_nin** *addr, aocklen_t addrlen | NA | Error code, which is an integer. | Sets up a connection between the client and the server. |
| accept | int sockfd, **struct sockaddr_nin** *address, socklen_t *address_len | NA | **sockfd**. | Accepts the connection request from the client. | | accept | int sockfd, **struct sockaddr_nin** *address, socklen_t *address_len | NA | **sockfd**. | Accepts the connection request from the client. |
......
...@@ -441,3 +441,9 @@ export default class MySequenceable { ...@@ -441,3 +441,9 @@ export default class MySequenceable {
private str; private str;
} }
``` ```
## 相关实例
针对IDL的使用,有以下相关实例可供参考:
- [Ability与ServiceExtensionAbility通信(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/IDL/AbilityConnectServiceExtension)
\ No newline at end of file
...@@ -138,5 +138,4 @@ onAccessibilityEvent(accessibilityEvent) { ...@@ -138,5 +138,4 @@ onAccessibilityEvent(accessibilityEvent) {
针对AccessibilityExtensionAbility开发,有以下相关实例可供参考: 针对AccessibilityExtensionAbility开发,有以下相关实例可供参考:
[AccessibilityExtAbility的创建和使用(ArkTS)(API 9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility) - [无障碍扩展(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility)
...@@ -219,3 +219,9 @@ ...@@ -219,3 +219,9 @@
## 数据提供方开发步骤 ## 数据提供方开发步骤
参考[数据管理](../database/share-data-by-silent-access.md)开发指南。 参考[数据管理](../database/share-data-by-silent-access.md)开发指南。
## 相关实例
针对卡片代理开发,有以下相关实例可供参考:
- [应用主动添加数据代理卡片到桌面(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/RequestAddForm)
\ No newline at end of file
...@@ -60,3 +60,11 @@ ArkTS卡片相较于JS卡片具备了更加丰富的能力,但也增加了使 ...@@ -60,3 +60,11 @@ ArkTS卡片相较于JS卡片具备了更加丰富的能力,但也增加了使
- 暂不支持Hot Reload热重载。 - 暂不支持Hot Reload热重载。
- 暂不支持setTimeOut。 - 暂不支持setTimeOut。
## 相关实例
针对ArkTS卡片开发,有以下相关实例可供参考:
- [Stage模型卡片(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormExtAbility)
- [Stage模型卡片JS与C++通信(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormGame)
\ No newline at end of file
...@@ -118,5 +118,5 @@ ...@@ -118,5 +118,5 @@
针对StaticSubscriberExtensionAbility开发,可参考如下实例: 针对StaticSubscriberExtensionAbility开发,可参考如下实例:
- [StaticSubscriber:静态订阅(ArkTS)(API9)(Full SDK](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/StaticSubscriber) - [静态订阅(ArkTS)(Full SDK)(API10](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/StaticSubscriber)
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
- 若目标组件exported字段配置为false,则需校验`ohos.permission.START_INVISIBLE_ABILITY`权限 - 若目标组件exported字段配置为false,则需校验`ohos.permission.START_INVISIBLE_ABILITY`权限
- [组件exported配置参考](../quick-start/module-configuration-file.md#abilities标签) - [组件exported配置参考](../quick-start/module-configuration-file.md#abilities标签)
- **位于后台的应用,启动组件需校验BACKGROUND权限** - **位于后台的UIAbility应用,启动组件需校验BACKGROUND权限**
- 应用前后台判断标准:若应用进程获焦或所属的UIAbility位于前台则判定为前台应用,否则为后台应用 - 应用前后台判断标准:若应用进程获焦或所属的UIAbility位于前台则判定为前台应用,否则为后台应用
- 需校验`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - 需校验`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
...@@ -46,7 +46,9 @@ ...@@ -46,7 +46,9 @@
设备内启动组件,不同场景下的规则不同,可分为如下两种场景: 设备内启动组件,不同场景下的规则不同,可分为如下两种场景:
- 启动或连接组件:UIAbility、ServiceExtensionAbility、DataShareExtensionAbility。 - 启动UIAbility。
- 启动ServiceExtensionAbility、DataShareExtensionAbility。
- 通过startAbilityByCall接口启动UIAbility。 - 通过startAbilityByCall接口启动UIAbility。
...@@ -57,7 +59,9 @@ ...@@ -57,7 +59,9 @@
跨设备启动组件,不同场景下的规则不同,可分为如下两种场景: 跨设备启动组件,不同场景下的规则不同,可分为如下两种场景:
- 启动或连接组件:UIAbility、ServiceExtensionAbility、DataShareExtensionAbility。 - 启动UIAbility。
- 启动ServiceExtensionAbility、DataShareExtensionAbility。
- 通过startAbilityByCall接口启动UIAbility。 - 通过startAbilityByCall接口启动UIAbility。
......
...@@ -103,11 +103,8 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil ...@@ -103,11 +103,8 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil
} }
``` ```
## 相关实例 ## 相关实例
针对EnterpriseAdminExtensionAbility开发,有以下相关示例可供参考: 针对EnterpriseAdminExtensionAbility开发,有以下相关示例可供参考:
[EnterpriseAdminExtensionAbility:EnterpriseAdminExtensionAbility的创建与使用(ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility) - [企业设备管理扩展(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility)
...@@ -616,6 +616,8 @@ onUpdateForm(formId) { ...@@ -616,6 +616,8 @@ onUpdateForm(formId) {
针对卡片开发,有以下相关实例可供参考: 针对卡片开发,有以下相关实例可供参考:
- [JS多设备自适应服务卡片(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/AdaptiveServiceWidget)
- [电影卡片(JS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Card/MovieCard) - [电影卡片(JS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Card/MovieCard)
- [计步器卡片(JS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Card/StepsCardJS) - [计步器卡片(JS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Card/StepsCardJS)
\ No newline at end of file
...@@ -126,4 +126,8 @@ ...@@ -126,4 +126,8 @@
}) })
``` ```
## 相关实例
针对任务管理开发,有以下相关实例可供参考:
- [任务管理(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/MissionManager)
...@@ -60,11 +60,12 @@ ArkTS卡片与JS卡片具备不同的实现原理及特征,在场景能力上 ...@@ -60,11 +60,12 @@ ArkTS卡片与JS卡片具备不同的实现原理及特征,在场景能力上
针对Stage模型卡片提供方的开发,有以下相关实例可供参考: 针对Stage模型卡片提供方的开发,有以下相关实例可供参考:
- [ArkTS音乐卡片(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/ArkTSCard/MusicControl)
- [基于Stage模型的JS卡片(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormExtAbility) - [Stage模型卡片(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormExtAbility)
- [基于Stage模型的JS卡片(成语接龙小游戏)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormGame) - [Stage模型卡片JS与C++通信(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormGame)
- [基于Stage模型的ArkTS卡片(Canvas绘制实现的五子棋游戏卡片)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/ArkTSCard/CanvasGame) - [ArkTS卡片Canvas小游戏(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/ArkTSCard/CanvasGame)
- [基于Stage模型的ArkTS卡片(逻辑代码执行实现的计算器卡片)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/ArkTSCard/Calculator) - [ArkTS卡片计算器(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/ArkTSCard/Calculator)
...@@ -453,5 +453,8 @@ ServiceExtensionAbility服务组件在[onConnect()](../reference/apis/js-apis-ap ...@@ -453,5 +453,8 @@ ServiceExtensionAbility服务组件在[onConnect()](../reference/apis/js-apis-ap
针对ServiceExtensionAbility开发,有以下相关实例可供参考: 针对ServiceExtensionAbility开发,有以下相关实例可供参考:
- [`AbilityConnectServiceExtension`:Ability与ServiceExtensionAbility通信(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/IDL/AbilityConnectServiceExtension) - [跨任务链返回(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack)
- [`StageModel`:Stage模型(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/StageModel)
- [Ability与ServiceExtensionAbility通信(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/IDL/AbilityConnectServiceExtension)
- [Stage模型(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/StageModel)
...@@ -41,3 +41,9 @@ ...@@ -41,3 +41,9 @@
| 了解线程模型 | 本章节介绍了Stage模型的线程模型以及几种常用的线程间通信方式。 | -&nbsp;[Emitter](itc-with-emitter.md)<br/>-&nbsp;[Worker](itc-with-worker.md) | | 了解线程模型 | 本章节介绍了Stage模型的线程模型以及几种常用的线程间通信方式。 | -&nbsp;[Emitter](itc-with-emitter.md)<br/>-&nbsp;[Worker](itc-with-worker.md) |
| 任务管理 | 本章节介绍了Stage模型中任务管理的基本概念和典型场景。 | -&nbsp;[任务管理场景介绍](mission-management-overview.md)<br/>-&nbsp;[任务管理与启动模式](mission-management-launch-type.md)<br/>-&nbsp;[页面栈和任务链](page-mission-stack.md) | | 任务管理 | 本章节介绍了Stage模型中任务管理的基本概念和典型场景。 | -&nbsp;[任务管理场景介绍](mission-management-overview.md)<br/>-&nbsp;[任务管理与启动模式](mission-management-launch-type.md)<br/>-&nbsp;[页面栈和任务链](page-mission-stack.md) |
| 应用配置文件 | 本章节介绍Stage模型中应用配置文件的开发要求。 | [Stage模型应用配置文件](config-file-stage.md) | | 应用配置文件 | 本章节介绍Stage模型中应用配置文件的开发要求。 | [Stage模型应用配置文件](config-file-stage.md) |
## 相关实例
针对Stage模型开发,有以下相关实例可供参考:
- [Stage模型(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/StageModel)
\ No newline at end of file
...@@ -151,3 +151,9 @@ specified启动模式为指定实例模式,针对一些特殊场景使用( ...@@ -151,3 +151,9 @@ specified启动模式为指定实例模式,针对一些特殊场景使用(
2. 在最近任务列表中关闭`文件A`的任务进程,此时`UIAbility实例1`被销毁,回到桌面,再次打开`文件A`,此时对应启动一个新的UIAbility实例,例如启动`UIAbility实例2` 2. 在最近任务列表中关闭`文件A`的任务进程,此时`UIAbility实例1`被销毁,回到桌面,再次打开`文件A`,此时对应启动一个新的UIAbility实例,例如启动`UIAbility实例2`
3. 回到桌面,打开`文件B`,此时对应启动一个新的UIAbility实例,例如启动`UIAbility实例3` 3. 回到桌面,打开`文件B`,此时对应启动一个新的UIAbility实例,例如启动`UIAbility实例3`
4. 回到桌面,再次打开`文件A`,此时仍然启动之前的`UIAbility实例2`,因为系统会自动匹配UIAbility实例的Key值,如果存在与之匹配的Key,则会启动与之绑定的UIAbility实例。在此例中,之前启动的`UIAbility实例2``文件A`绑定的Key是相同的,因此系统会拉回`UIAbility实例2`并让其获焦,而不会创建新的实例。 4. 回到桌面,再次打开`文件A`,此时仍然启动之前的`UIAbility实例2`,因为系统会自动匹配UIAbility实例的Key值,如果存在与之匹配的Key,则会启动与之绑定的UIAbility实例。在此例中,之前启动的`UIAbility实例2``文件A`绑定的Key是相同的,因此系统会拉回`UIAbility实例2`并让其获焦,而不会创建新的实例。
## 相关实例
针对UIAbility组件启动模式,有以下相关实例可供参考:
- [Ability的启动模式(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/AbilityStartMode)
\ No newline at end of file
...@@ -48,6 +48,6 @@ ...@@ -48,6 +48,6 @@
> - 匹配到一个满足条件的应用组件:直接启动该应用组件。 > - 匹配到一个满足条件的应用组件:直接启动该应用组件。
> - 匹配到多个满足条件的应用组件(UIAbility):弹出选择框让用户选择。 > - 匹配到多个满足条件的应用组件(UIAbility):弹出选择框让用户选择。
> >
> - 调用方传入的want参数中不带有abilityName和bundleName,则不允许通过隐式Want启动所有应用的ServiceExtensionAbility。 > - 对于启动ServiceExtensionAbility的场景:
> > - 调用方传入的want参数中带有abilityName,则不允许通过隐式Want启动ServiceExtensionAbility。
> - 调用方传入的want参数中带有bundleName,则允许使用startServiceExtensionAbility()方法隐式Want启动ServiceExtensionAbility,默认返回优先级最高的ServiceExtensionAbility,如果优先级相同,返回第一个。 > - 调用方传入的want参数中带有bundleName,则允许使用startServiceExtensionAbility()方法隐式Want启动ServiceExtensionAbility,默认返回优先级最高的ServiceExtensionAbility,如果优先级相同,返回第一个。
...@@ -116,4 +116,4 @@ struct Index { ...@@ -116,4 +116,4 @@ struct Index {
针对WindowExtensionAbility开发,有以下相关实例可供参考: 针对WindowExtensionAbility开发,有以下相关实例可供参考:
- [`WindowExtAbility`:WindowExtAbility的创建与使用(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/WindowManagement/WindowExtAbility) - [窗口扩展应用(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/WindowManagement/WindowExtAbility)
...@@ -36,4 +36,4 @@ ArkTS语言基础类库是OpenHarmony系统上为应用开发者提供的常用 ...@@ -36,4 +36,4 @@ ArkTS语言基础类库是OpenHarmony系统上为应用开发者提供的常用
针对语言基础类库的开发,有以下相关实例可供参考: 针对语言基础类库的开发,有以下相关实例可供参考:
- [LanguageBaseClassLibrary:语言基础类库](https://gitee.com/openharmony/applications_app_samples/tree/master/code/LaunguageBaseClassLibrary/LanguageBaseClassLibrary) - [语言基础类库(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/LaunguageBaseClassLibrary/LanguageBaseClassLibrary)
...@@ -57,4 +57,4 @@ ArkTS提供了TaskPool和Worker两种并发能力供开发者选择,其具体 ...@@ -57,4 +57,4 @@ ArkTS提供了TaskPool和Worker两种并发能力供开发者选择,其具体
针对多线程开发,有以下相关实例可供参考: 针对多线程开发,有以下相关实例可供参考:
- [ConcurrentModule:多线程任务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/LaunguageBaseClassLibrary/ConcurrentModule) - [多线程任务(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/LaunguageBaseClassLibrary/ConcurrentModule)
...@@ -52,7 +52,8 @@ httpRequest.on('headersReceive', (header) => { ...@@ -52,7 +52,8 @@ httpRequest.on('headersReceive', (header) => {
console.info('header: ' + JSON.stringify(header)); console.info('header: ' + JSON.stringify(header));
}); });
httpRequest.request( httpRequest.request(
// 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定"EXAMPLE_URL", // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
"EXAMPLE_URL",
{ {
method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET
// 开发者根据自身业务需要添加header字段 // 开发者根据自身业务需要添加header字段
...@@ -81,7 +82,7 @@ httpRequest.request( ...@@ -81,7 +82,7 @@ httpRequest.request(
// 当该请求使用完毕时,调用destroy方法主动销毁 // 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy(); httpRequest.destroy();
} else { } else {
console.info('error:' + JSON.stringify(err)); console.error('error:' + JSON.stringify(err));
// 取消订阅HTTP响应头事件 // 取消订阅HTTP响应头事件
httpRequest.off('headersReceive'); httpRequest.off('headersReceive');
// 当该请求使用完毕时,调用destroy方法主动销毁 // 当该请求使用完毕时,调用destroy方法主动销毁
...@@ -146,7 +147,7 @@ httpRequest.requestInStream( ...@@ -146,7 +147,7 @@ httpRequest.requestInStream(
readTimeout: 60000, // 可选,默认为60000ms。若传输的数据较大,需要较长的时间,建议增大该参数以保证数据传输正常终止 readTimeout: 60000, // 可选,默认为60000ms。若传输的数据较大,需要较长的时间,建议增大该参数以保证数据传输正常终止
usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定
}, (err, data) => { }, (err, data) => {
console.info('error:' + JSON.stringify(err)); console.error('error:' + JSON.stringify(err));
console.info('ResponseCode :' + JSON.stringify(data)); console.info('ResponseCode :' + JSON.stringify(data));
// 取消订阅HTTP响应头事件 // 取消订阅HTTP响应头事件
httpRequest.off('headersReceive'); httpRequest.off('headersReceive');
...@@ -166,5 +167,8 @@ httpRequest.requestInStream( ...@@ -166,5 +167,8 @@ httpRequest.requestInStream(
针对HTTP数据请求,有以下相关实例可供参考: 针对HTTP数据请求,有以下相关实例可供参考:
- [`Http:`数据请求(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http) - [上传和下载(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Connectivity/Upload)
- [Http(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http)
- [新闻数据加载(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/NewsDataArkTS) - [新闻数据加载(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/NewsDataArkTS)
\ No newline at end of file
...@@ -355,3 +355,8 @@ IPC/RPC的主要工作是让运行在不同进程的Proxy和Stub互相通信, ...@@ -355,3 +355,8 @@ IPC/RPC的主要工作是让运行在不同进程的Proxy和Stub互相通信,
globalThis.context.disconnectServiceExtensionAbility(connectId); globalThis.context.disconnectServiceExtensionAbility(connectId);
``` ```
## 相关实例
针对IPC与RPC通信开发,有以下相关实例可供参考:
- [RPC通信(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/RPC)
...@@ -409,4 +409,4 @@ tlsTwoWay.close((err) => { ...@@ -409,4 +409,4 @@ tlsTwoWay.close((err) => {
针对Socket连接开发,有以下相关实例可供参考: 针对Socket连接开发,有以下相关实例可供参考:
- [`Socket`:Socket 连接(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Socket) - [网络管理-Socket连接(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Socket)
\ No newline at end of file \ No newline at end of file
...@@ -85,4 +85,4 @@ ws.connect(defaultIpAddress, (err, value) => { ...@@ -85,4 +85,4 @@ ws.connect(defaultIpAddress, (err, value) => {
针对WebSocket连接的开发,有以下相关实例可供参考: 针对WebSocket连接的开发,有以下相关实例可供参考:
- [`WebSocket`:WebSocket(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/WebSocket) - [WebSocket(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/WebSocket)
\ No newline at end of file \ No newline at end of file
...@@ -226,7 +226,11 @@ ...@@ -226,7 +226,11 @@
针对用户首选项开发,有以下相关实例可供参考: 针对用户首选项开发,有以下相关实例可供参考:
- [`Preferences`:首选项(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DataManagement/Preferences) - [游戏2048(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Game/Game2048)
- [图案密码锁(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Tools/PatternLock)
- [首选项(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DataManagement/Preferences)
- [首选项(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Data/Preferences) - [首选项(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Data/Preferences)
......
...@@ -304,4 +304,12 @@ ...@@ -304,4 +304,12 @@
localObject.setSessionId(() => { localObject.setSessionId(() => {
console.info('leave all lession.'); console.info('leave all lession.');
}); });
``` ```
\ No newline at end of file
## 相关实例
针对分布式数据对象开发,有以下相关实例可供参考:
- [分布式组网认证(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedAuthentication)
- [分布式对象(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedNote)
\ No newline at end of file
...@@ -281,4 +281,18 @@ ...@@ -281,4 +281,18 @@
针对键值型数据库开发,有以下相关实例可供参考: 针对键值型数据库开发,有以下相关实例可供参考:
- [分布式组网认证(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedAuthentication)
- [分布式数据管理(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/Kvstore)
- [分布式音乐播放(JS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer)
- [分布式音乐播放(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer)
- [分布式计算器(JS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributeCalc)
- [分布式计算器(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc)
- [分布式五子棋(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Game/DistributedDataGobang)
- [分布式手写板(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDraw) - [分布式手写板(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDraw)
\ No newline at end of file
...@@ -171,3 +171,13 @@ ...@@ -171,3 +171,13 @@
) )
}) })
``` ```
## 相关实例
针对关系型数据库开发,有以下相关实例可供参考:
- [分布式组网认证(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedAuthentication)
-[分布式关系型数据库(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedRdb)
- [分布式帐号(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedAccount)
\ No newline at end of file
...@@ -243,4 +243,4 @@ ...@@ -243,4 +243,4 @@
针对数据共享开发,有以下相关实例可供参考: 针对数据共享开发,有以下相关实例可供参考:
- [`CrossAppDataShare`:系统应用跨应用数据共享(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/DataManagement/CrossAppDataShare) - [系统应用跨应用数据共享(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/DataManagement/CrossAppDataShare)
\ No newline at end of file \ No newline at end of file
...@@ -37,3 +37,9 @@ ...@@ -37,3 +37,9 @@
## 跨设备同步访问控制机制 ## 跨设备同步访问控制机制
数据跨设备同步时,数据管理基于设备等级和数据安全标签进行访问控制,具体可见[跨设备同步访问控制机制](access-control-by-device-and-data-level.md#跨设备同步访问控制机制) 数据跨设备同步时,数据管理基于设备等级和数据安全标签进行访问控制,具体可见[跨设备同步访问控制机制](access-control-by-device-and-data-level.md#跨设备同步访问控制机制)
## 相关实例
针对分布式开发,有以下相关实例可供参考:
- [分布式组网认证(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedAuthentication)
\ No newline at end of file
...@@ -538,5 +538,8 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics'; ...@@ -538,5 +538,8 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics';
针对设备使用信息统计,有以下相关实例可供参考: 针对设备使用信息统计,有以下相关实例可供参考:
- [`DeviceUsageStatistics`:设备使用信息统计(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics) - [存储空间统计(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/DeviceManagement/StorageStatistic)
- [设备使用信息统计(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics)
...@@ -406,4 +406,10 @@ ...@@ -406,4 +406,10 @@
}); });
``` ```
5. 当设备进入或者退出该围栏时,系统会自动触发WantAgent的动作。 5. 当设备进入或者退出该围栏时,系统会自动触发WantAgent的动作。
\ No newline at end of file
## 相关实例
针对位置开发,有以下相关实例可供参考:
- [位置服务(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceManagement/Location)
\ No newline at end of file
...@@ -270,5 +270,6 @@ async function playCustomHaptic(fileName) { ...@@ -270,5 +270,6 @@ async function playCustomHaptic(fileName) {
针对振动开发,有以下相关实例可供参考: 针对振动开发,有以下相关实例可供参考:
- [`Vibrator`:振动(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceManagement/Vibrator/BasicVibration) - [振动(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceManagement/Vibrator/BasicVibration)
- [`CustomHaptic`:自定义振动(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceManagement/Vibrator/CustomHaptic)
- [自定义振动(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceManagement/Vibrator/CustomHaptic)
...@@ -193,3 +193,9 @@ APP_LIFECYCLE_TIMEOUT: ...@@ -193,3 +193,9 @@ APP_LIFECYCLE_TIMEOUT:
![appfreeze_20230310105874](figures/appfreeze_20230310105874.png) ![appfreeze_20230310105874](figures/appfreeze_20230310105874.png)
其他的日志信息可以参考[通用日志信息](#日志主干通用信息)进行分析。需要特别说明的是,一般情况下生命周期切换大概率主线程也会卡死。可以结合两个日志的三个堆栈、两个BinderCatcher信息,进行对比查看。 其他的日志信息可以参考[通用日志信息](#日志主干通用信息)进行分析。需要特别说明的是,一般情况下生命周期切换大概率主线程也会卡死。可以结合两个日志的三个堆栈、两个BinderCatcher信息,进行对比查看。
## 相关实例
针对故障日志获取,有以下相关实力可供参考:
- [故障日志获取(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DFX/FaultLogger)
\ No newline at end of file
...@@ -105,3 +105,9 @@ Thread name:crasher <- 异常线程名 ...@@ -105,3 +105,9 @@ Thread name:crasher <- 异常线程名
范例中的崩溃故障是由赋值给一块不可写的区域导致的,代码行为dfx_crasher.c文件的57行,修改后可以避免发生此崩溃。\ 范例中的崩溃故障是由赋值给一块不可写的区域导致的,代码行为dfx_crasher.c文件的57行,修改后可以避免发生此崩溃。\
另外,使用addr2line后,如果得出的行号看起来不是很正确,可以考虑对地址进行微调(如减1),或者考虑关闭一些编译优化,已知使用LTO的二进制可能无法正确获得行号。 另外,使用addr2line后,如果得出的行号看起来不是很正确,可以考虑对地址进行微调(如减1),或者考虑关闭一些编译优化,已知使用LTO的二进制可能无法正确获得行号。
## 相关实例
针对故障日志获取,有以下相关实力可供参考:
- [故障日志获取(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DFX/FaultLogger)
\ No newline at end of file
...@@ -151,4 +151,6 @@ HiAppEvent是在系统层面为应用开发者提供的一种事件打点机制 ...@@ -151,4 +151,6 @@ HiAppEvent是在系统层面为应用开发者提供的一种事件打点机制
针对应用事件开发,有以下相关实例可供参考: 针对应用事件开发,有以下相关实例可供参考:
- [`DotTest`:测试打点(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DFX/DotTest) - [测试打点(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DFX/DotTest)
\ No newline at end of file
- [日志打印(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DFX/Logger)
\ No newline at end of file
...@@ -21,42 +21,6 @@ try { ...@@ -21,42 +21,6 @@ try {
} }
``` ```
## 如何隐藏状态栏实现沉浸式效果
适用于:OpenHarmony 3.2 Beta5,API 9
**解决措施**
1. 可以在onWindowStageCreate方法获取windowClass对象。
```
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
windowStage.getMainWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the main window.')
return;
}
// 获取到窗口对象
globalThis.windowClass = data;
})
}
```
2. 设置窗口全屏,隐藏状态栏。
```
globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) {
console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data));
});
```
## 如何获取窗口的宽高信息 ## 如何获取窗口的宽高信息
适用于:OpenHarmony 3.2 Beta5,API 9 Stage模型 适用于:OpenHarmony 3.2 Beta5,API 9 Stage模型
......
...@@ -78,3 +78,9 @@ BackupExtensionAbility,是[Stage模型](../../application-dev/application-mode ...@@ -78,3 +78,9 @@ BackupExtensionAbility,是[Stage模型](../../application-dev/application-mode
] ]
} }
``` ```
## 相关实例
针对应用接入数据的备份与恢复,有以下相关实例可供参考:
- [应用接入数据备份恢复(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/FileBackupExtension)
\ No newline at end of file
...@@ -23,3 +23,9 @@ ...@@ -23,3 +23,9 @@
**图1** 文件分类模型示意图 **图1** 文件分类模型示意图
![File classification model](figures/file-classification-model.png) ![File classification model](figures/file-classification-model.png)
## 相关实例
针对文件管理开发,有以下相关实例可供参考:
- [文件管理(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/FileManager)
\ No newline at end of file
...@@ -731,4 +731,12 @@ try { ...@@ -731,4 +731,12 @@ try {
```js ```js
let order = I18n.I18NUtil.getDateOrder("zh-CN"); // order = "y-L-d",表示中文中年月日的顺序为年-月-日。 let order = I18n.I18NUtil.getDateOrder("zh-CN"); // order = "y-L-d",表示中文中年月日的顺序为年-月-日。
``` ```
\ No newline at end of file
## 相关实例
针对I18n开发,有以下相关实例可供参考:
- [时区和语言设置(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Internationalnation/International)
- [国际化(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/International/International)
\ No newline at end of file
...@@ -272,7 +272,7 @@ export default struct Home { ...@@ -272,7 +272,7 @@ export default struct Home {
针对应用市场应用开发,有以下相关实例可以参考: 针对应用市场应用开发,有以下相关实例可以参考:
应用市场开发:[一多应用市场首页应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/AppMarket) - 应用市场开发:[典型页面场景:应用市场首页(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/AppMarket)
......
...@@ -247,5 +247,5 @@ struct Index { ...@@ -247,5 +247,5 @@ struct Index {
针对音乐专辑应用,有以下相关实例可供参考: 针对音乐专辑应用,有以下相关实例可供参考:
音乐专辑应用:[音乐专辑页应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/MusicAlbum) - [典型页面场景:音乐专辑页(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/MusicAlbum)
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
| [应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/AppMarket) | 声明式开发范式 | 本章配套的示例代码,以应用市场首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 | | [应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/AppMarket) | 声明式开发范式 | 本章配套的示例代码,以应用市场首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [音乐专辑页](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/MusicAlbum) | 声明式开发范式 | 本章配套的示例代码,以音乐专辑页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 | | [音乐专辑页](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/MusicAlbum) | 声明式开发范式 | 本章配套的示例代码,以音乐专辑页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [设置应用页面](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Settings) | 声明式开发范式 | 本章配套的示例代码,以设置应用页面为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 | | [设置应用页面](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Settings) | 声明式开发范式 | 本章配套的示例代码,以设置应用页面为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [分栏控件](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/MultiColumns) | 声明式开发范式 | 本示例分别展示了多场景下,一多分栏控件的响应式变化效果。 |
| [音乐专辑页](https://gitee.com/openharmony/codelabs/tree/master/ExcellentCase/MultiDeviceMusic) | 声明式开发范式 | 基于自适应和响应式布局,实现一次开发、多端部署音乐专辑页面。 | | [音乐专辑页](https://gitee.com/openharmony/codelabs/tree/master/ExcellentCase/MultiDeviceMusic) | 声明式开发范式 | 基于自适应和响应式布局,实现一次开发、多端部署音乐专辑页面。 |
| [视频应用](https://gitee.com/openharmony/codelabs/tree/master/ExcellentCase/Multi_device_V2) | 声明式开发范式 | 基于自适应布局和响应式布局能力,实现了常见的视频播放应用的主界面。 | | [视频应用](https://gitee.com/openharmony/codelabs/tree/master/ExcellentCase/Multi_device_V2) | 声明式开发范式 | 基于自适应布局和响应式布局能力,实现了常见的视频播放应用的主界面。 |
...@@ -168,4 +168,4 @@ Navigation组件支持自动切换单栏和双栏的显示效果,同时可以 ...@@ -168,4 +168,4 @@ Navigation组件支持自动切换单栏和双栏的显示效果,同时可以
针对“设置”应用页面,有以下相关实例可以参考: 针对“设置”应用页面,有以下相关实例可以参考:
设置:[设置应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Settings) - [典型页面场景:设置应用页面(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Settings)
...@@ -257,3 +257,9 @@ export default class VoiceCallDemoForAudioCapturer { ...@@ -257,3 +257,9 @@ export default class VoiceCallDemoForAudioCapturer {
} }
} }
``` ```
## 相关实例
针对音频通话开发,有以下相关实例可供参考:
- [音频通话示例(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/VoiceCallDemo)
\ No newline at end of file
...@@ -63,3 +63,11 @@ audio模块下的接口支持PCM编码,包括AudioRenderer、AudioCapturer、T ...@@ -63,3 +63,11 @@ audio模块下的接口支持PCM编码,包括AudioRenderer、AudioCapturer、T
小尾数指的是小端模式,即数据的高字节保存在内存的高地址中,而数据的低字节保存在内存的低地址中。这种存储模式将地址的高低和数据的位权有效结合起来,高地址部分权值高,低地址部分权值低。 小尾数指的是小端模式,即数据的高字节保存在内存的高地址中,而数据的低字节保存在内存的低地址中。这种存储模式将地址的高低和数据的位权有效结合起来,高地址部分权值高,低地址部分权值低。
media模块下的接口支持的音视频格式将在[AVPlayer和AVRecorder](avplayer-avrecorder-overview.md)的介绍中承载。 media模块下的接口支持的音视频格式将在[AVPlayer和AVRecorder](avplayer-avrecorder-overview.md)的介绍中承载。
## 相关实例
针对音视频开发,有以下相关实例可供参考:
- [音视频录制(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/AVRecorder)
- [音频管理(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/Audio)
\ No newline at end of file
...@@ -25,3 +25,9 @@ ...@@ -25,3 +25,9 @@
相机应用通过控制相机,实现图像显示(预览)、照片保存(拍照)、视频录制(录像)等基础操作。在实现基本操作过程中,相机服务会控制相机设备采集和输出数据,采集的图像数据在相机底层的设备硬件接口(HDI,Hardware Device Interfaces),直接通过BufferQueue传递到具体的功能模块进行处理。BufferQueue在应用开发中无需关注,用于将底层处理的数据及时送到上层进行图像显示。 相机应用通过控制相机,实现图像显示(预览)、照片保存(拍照)、视频录制(录像)等基础操作。在实现基本操作过程中,相机服务会控制相机设备采集和输出数据,采集的图像数据在相机底层的设备硬件接口(HDI,Hardware Device Interfaces),直接通过BufferQueue传递到具体的功能模块进行处理。BufferQueue在应用开发中无需关注,用于将底层处理的数据及时送到上层进行图像显示。
以视频录制为例进行说明,相机应用在录制视频过程中,媒体录制服务先创建一个视频Surface用于传递数据,并提供给相机服务,相机服务可控制相机设备采集视频数据,生成视频流。采集的数据通过底层相机HDI处理后,通过Surface将视频流传递给媒体录制服务,媒体录制服务对视频数据进行处理后,保存为视频文件,完成视频录制。 以视频录制为例进行说明,相机应用在录制视频过程中,媒体录制服务先创建一个视频Surface用于传递数据,并提供给相机服务,相机服务可控制相机设备采集视频数据,生成视频流。采集的数据通过底层相机HDI处理后,通过Surface将视频流传递给媒体录制服务,媒体录制服务对视频数据进行处理后,保存为视频文件,完成视频录制。
## 相关实例
针对相机开发,有以下相关实例可供参考:
- [相机和媒体库(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Media/Camera)
...@@ -36,3 +36,13 @@ ...@@ -36,3 +36,13 @@
5. [图片编码](image-encoding.md):使用图片打包器类ImagePacker,将PixelMap或ImageSource进行压缩编码,生成一张新的图片。 5. [图片编码](image-encoding.md):使用图片打包器类ImagePacker,将PixelMap或ImageSource进行压缩编码,生成一张新的图片。
除上述基本图片开发能力外,OpenHarmony还提供常用[图片工具](image-tool.md),供开发者选择使用。 除上述基本图片开发能力外,OpenHarmony还提供常用[图片工具](image-tool.md),供开发者选择使用。
## 相关实例
针对图片开发,有以下相关实例可供参考:
- [图片显示及处理(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/Image)
- [图片显示(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/ImageShow)
- [图片裁剪与分割(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/GamePuzzle)
\ No newline at end of file
...@@ -17,3 +17,13 @@ ...@@ -17,3 +17,13 @@
- 相机(camera):提供精确控制相机镜头,采集视觉信息的接口与服务。 - 相机(camera):提供精确控制相机镜头,采集视觉信息的接口与服务。
- 图片(image):提供图片编解码、图片处理接口与服务。 - 图片(image):提供图片编解码、图片处理接口与服务。
## 相关实例
针对媒体开发,有以下相关实例可供参考:
- [媒体管理合集(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/MediaCollections)
- [相机和媒体库(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Media/MultiMedia)
- [二维码扫描(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/QRCodeScan)
\ No newline at end of file
...@@ -331,3 +331,9 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频 ...@@ -331,3 +331,9 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
}); });
} }
``` ```
## 相关实例
针对媒体会话控制方开发,有以下相关实例可供参考:
- [媒体会话——控制方(仅对系统应用开放)(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/AVSession/MediaController)
\ No newline at end of file
...@@ -357,3 +357,9 @@ ...@@ -357,3 +357,9 @@
}); });
} }
``` ```
## 相关实例
针对媒体会话提供方开发,有以下相关实例可供参考:
- [媒体会话——提供方(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/AVSession/MediaProvider)
\ No newline at end of file
...@@ -264,4 +264,6 @@ export class AVPlayerDemo { ...@@ -264,4 +264,6 @@ export class AVPlayerDemo {
针对视频播放,有以下相关实例可供参考: 针对视频播放,有以下相关实例可供参考:
- [`VideoPlayer`:视频播放器(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoPlayer) - [视频播放(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/VideoPlay)
\ No newline at end of file
- [视频播放器(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoPlayer)
\ No newline at end of file
...@@ -380,5 +380,7 @@ ...@@ -380,5 +380,7 @@
``` ```
## 相关实例 ## 相关实例
- [`NdkRawfile`:获取Rawfile资源](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Native/NdkRawfile)
针对资源管理Rawfile开发,有以下相关实例可供参考:
- [获取Rawfile资源(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Native/NdkRawfile)
...@@ -899,4 +899,4 @@ XComponent({ id: 'xcomponentId1', type: 'surface', libraryname: 'nativerender' } ...@@ -899,4 +899,4 @@ XComponent({ id: 'xcomponentId1', type: 'surface', libraryname: 'nativerender' }
针对Native XComponent的使用,有以下相关实例可供参考: 针对Native XComponent的使用,有以下相关实例可供参考:
- [使用Native XComponent接口绘制图形](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Native/NdkXComponent) - [Native XComponent(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Native/NdkXComponent)
...@@ -31,4 +31,12 @@ OpenHarmony通过ANS(Advanced Notification Service,通知系统服务)对 ...@@ -31,4 +31,12 @@ OpenHarmony通过ANS(Advanced Notification Service,通知系统服务)对
基于通知的开发,有以下相关实例可供参考: 基于通知的开发,有以下相关实例可供参考:
- [`CustomNotification`:自定义通知(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomNotification) - [公共事件的订阅和发布(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomCommonEvent)
\ No newline at end of file
- [自定义通知推送(ArkTS)(Full SDK)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomNotificationPush)
- [自定义通知角标(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomNotificationBadge)
- [自定义通知(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomNotification)
- [自定义Emitter(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomEmitter)
\ No newline at end of file
...@@ -192,9 +192,85 @@ struct CompA { ...@@ -192,9 +192,85 @@ struct CompA {
} }
``` ```
### 以持久化方式订阅某个事件并接收事件回调 ### 不建议借助@StorageLink的双向同步机制实现事件通知
推荐使用持久化方式订阅某个事件并接收事件回调,可以减少开销,增强代码的可读性。 不建议开发者使用@StorageLink和AppStorage的双向同步的机制来实现事件通知,AppStorage是和UI相关的数据存储,改变会带来UI的刷新,相对于一般的事件通知,UI刷新的成本较大。
TapImage中的点击事件,会触发AppStorage中tapIndex对应属性的改变。因为@StorageLink是双向同步,修改会同步会AppStorage中,所以,所有绑定AppStorage的tapIndex可见自定义组件都会被通知UI刷新。UI刷新带来的成本是巨大的,因此不建议开发者使用此方式来实现基本的事件通知功能。
```ts
// xxx.ets
class ViewData {
title: string;
uri: Resource;
color: Color = Color.Black;
constructor(title: string, uri: Resource) {
this.title = title;
this.uri = uri
}
}
@Entry
@Component
struct Gallery2 {
dataList: Array<ViewData> = [new ViewData('flower', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon')), new ViewData('OMG', $r('app.media.icon'))]
scroller: Scroller = new Scroller()
build() {
Column() {
Grid(this.scroller) {
ForEach(this.dataList, (item: ViewData, index?: number) => {
GridItem() {
TapImage({
uri: item.uri,
index: index
})
}.aspectRatio(1)
}, (item: ViewData, index?: number) => {
return JSON.stringify(item) + index;
})
}.columnsTemplate('1fr 1fr')
}
}
}
@Component
export struct TapImage {
@StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1;
@State tapColor: Color = Color.Black;
private index: number;
private uri: Resource;
// 判断是否被选中
onTapIndexChange() {
if (this.tapIndex >= 0 && this.index === this.tapIndex) {
console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, red`)
this.tapColor = Color.Red;
} else {
console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, black`)
this.tapColor = Color.Black;
}
}
build() {
Column() {
Image(this.uri)
.objectFit(ImageFit.Cover)
.onClick(() => {
this.tapIndex = this.index;
})
.border({ width: 5, style: BorderStyle.Dotted, color: this.tapColor })
}
}
}
```
开发者可以使用emit订阅某个事件并接收事件回调,可以减少开销,增强代码的可读性。
```ts ```ts
...@@ -293,10 +369,9 @@ export struct TapImage { ...@@ -293,10 +369,9 @@ export struct TapImage {
} }
``` ```
以下示例为消息机制方式订阅事件,会导致回调监听的节点数较多,非常耗时,不推荐以此来实现应用代码。 以上通知事件逻辑简单,也可以简化成三元表达式。
```ts ```
// xxx.ets // xxx.ets
class ViewData { class ViewData {
title: string; title: string;
...@@ -337,22 +412,11 @@ struct Gallery2 { ...@@ -337,22 +412,11 @@ struct Gallery2 {
@Component @Component
export struct TapImage { export struct TapImage {
@StorageLink('tapIndex') @Watch('onTapIndexChange') tapIndex: number = -1; @StorageLink('tapIndex') tapIndex: number = -1;
@State tapColor: Color = Color.Black; @State tapColor: Color = Color.Black;
private index: number; private index: number;
private uri: Resource; private uri: Resource;
// 判断是否被选中
onTapIndexChange() {
if (this.tapIndex >= 0 && this.index === this.tapIndex) {
console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, red`)
this.tapColor = Color.Red;
} else {
console.info(`tapindex: ${this.tapIndex}, index: ${this.index}, black`)
this.tapColor = Color.Black;
}
}
build() { build() {
Column() { Column() {
Image(this.uri) Image(this.uri)
...@@ -360,14 +424,18 @@ export struct TapImage { ...@@ -360,14 +424,18 @@ export struct TapImage {
.onClick(() => { .onClick(() => {
this.tapIndex = this.index; this.tapIndex = this.index;
}) })
.border({ width: 5, style: BorderStyle.Dotted, color: this.tapColor }) .border({
width: 5,
style: BorderStyle.Dotted,
color: (this.tapIndex >= 0 && this.index === this.tapIndex) ? Color.Red : Color.Black
})
} }
} }
} }
``` ```
## 限制条件 ## 限制条件
AppStorage与[PersistentStorage](arkts-persiststorage.md)以及[Environment](arkts-environment.md)配合使用时,需要注意以下几点: AppStorage与[PersistentStorage](arkts-persiststorage.md)以及[Environment](arkts-environment.md)配合使用时,需要注意以下几点:
......
...@@ -70,8 +70,6 @@ struct ParentComponent { ...@@ -70,8 +70,6 @@ struct ParentComponent {
- [自定义组件通用样式](#自定义组件通用样式) - [自定义组件通用样式](#自定义组件通用样式)
- [自定义属性方法](#自定义属性方法)
## 自定义组件的基本结构 ## 自定义组件的基本结构
...@@ -347,68 +345,4 @@ struct MyComponent { ...@@ -347,68 +345,4 @@ struct MyComponent {
> >
> ArkUI给自定义组件设置样式时,相当于给MyComponent2套了一个不可见的容器组件,而这些样式是设置在容器组件上的,而非直接设置给MyComponent2的Button组件。通过渲染结果我们可以很清楚的看到,背景颜色红色并没有直接生效在Button上,而是生效在Button所处的开发者不可见的容器组件上。 > ArkUI给自定义组件设置样式时,相当于给MyComponent2套了一个不可见的容器组件,而这些样式是设置在容器组件上的,而非直接设置给MyComponent2的Button组件。通过渲染结果我们可以很清楚的看到,背景颜色红色并没有直接生效在Button上,而是生效在Button所处的开发者不可见的容器组件上。
## 自定义属性方法
自定义组件不支持提供自定义属性方法,可以借助类似Controller控制器能力,提供自定义接口。
```ts
// 自定义controller
export class MyComponentController {
item: MyComponent = null;
setItem(item: MyComponent) {
this.item = item;
}
changeText(value: string) {
this.item.value = value;
}
}
// 自定义组件
@Component
export default struct MyComponent {
public controller: MyComponentController = null;
@State value: string = 'Hello World';
build() {
Column() {
Text(this.value)
.fontSize(50)
}
}
aboutToAppear() {
if (this.controller)
this.controller.setItem(this); // 绑定controller
}
}
// 使用处逻辑
@Entry
@Component
struct StyleExample {
controller = new MyComponentController();
build() {
Column() {
MyComponent({ controller: this.controller })
}
.onClick(() => {
this.controller.changeText('Text');
})
}
}
```
在上面的示例中:
1. 通过子组件MyComponent的aboutToAppear方法,把当前的this指针传递给MyComponentController的item成员变量。
2. 在StyleExample父组件中持有controller实例,调用controller的changeText方法,即相当于通过controller持有的MyComponent子组件的this指针,改变MyComponent的状态变量value的值。
通过controller的封装,MyComponent对外暴露了changeText的接口,所有持有controller的实例都可以通过调用changeText接口,改变MyComponent的状态变量value的值。
<!--no_check--> <!--no_check-->
...@@ -132,4 +132,6 @@ $$运算符:给内置组件提供TS变量的引用,使得TS变量和内置 ...@@ -132,4 +132,6 @@ $$运算符:给内置组件提供TS变量的引用,使得TS变量和内置
针对页面状态管理,有以下相关实例可供参考: 针对页面状态管理,有以下相关实例可供参考:
- [状态管理(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentCollection/StateManagement)
- [目标管理(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TargetManagement) - [目标管理(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TargetManagement)
\ No newline at end of file
...@@ -5,4 +5,10 @@ ...@@ -5,4 +5,10 @@
- 方便开发者将多HAP合理地组合并部署到不同的设备上。例如应用程序包含一个Entry包和两个Featrue包(Feature1和Feature2)。其中Entry包可以部署到设备A和设备B,Feature1只能部署到设备A,Feature2包只部署到设备B上,那么开发者就可以方便的组合Entry和Feature1部署到设备A上,组合Entry和Feature2部署到设备B上。 - 方便开发者将多HAP合理地组合并部署到不同的设备上。例如应用程序包含一个Entry包和两个Featrue包(Feature1和Feature2)。其中Entry包可以部署到设备A和设备B,Feature1只能部署到设备A,Feature2包只部署到设备B上,那么开发者就可以方便的组合Entry和Feature1部署到设备A上,组合Entry和Feature2部署到设备B上。
- 方便开发者按需加载所需模块,减少包大小。开发者可以将一个应用的某些HAP配置成按需加载。应用在启动阶段初始用不到的特性,可以配置暂不加载,当用户用到这些特性的时候,可由应用自动下载这些特性HAP,一定程度上减少应用包的大小。 - 方便开发者按需加载所需模块,减少包大小。开发者可以将一个应用的某些HAP配置成按需加载。应用在启动阶段初始用不到的特性,可以配置暂不加载,当用户用到这些特性的时候,可由应用自动下载这些特性HAP,一定程度上减少应用包的大小。
\ No newline at end of file
## 相关实例
针对多HAP开发,有以下相关实例可供参考:
- [多HAP(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Project/ApplicationHap/MultiHap)
\ No newline at end of file
...@@ -317,4 +317,4 @@ Image($r('sys.media.ohos_app_icon')) ...@@ -317,4 +317,4 @@ Image($r('sys.media.ohos_app_icon'))
针对访问应用资源,有以下相关实例可供参考: 针对访问应用资源,有以下相关实例可供参考:
- [`ResourceManager`:资源管理器(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/blob/master/code/BasicFeature/Resource/ResourceManager/README_zh.md) - [资源管理(ArkTS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Resource/ResourceManager)
...@@ -301,6 +301,7 @@ ...@@ -301,6 +301,7 @@
- AI - AI
- [@ohos.ai.mindSporeLite (推理能力)](js-apis-mindSporeLite.md) - [@ohos.ai.mindSporeLite (推理能力)](js-apis-mindSporeLite.md)
- [@ohos.ai.intelligentVoice (智能语音)](js-apis-intelligentVoice.md)
- 电话服务 - 电话服务
- [@ohos.contact (联系人)](js-apis-contact.md) - [@ohos.contact (联系人)](js-apis-contact.md)
......
# @ohos.WallpaperExtensionAbility (WallpaperExtensionAbility) # @ohos.WallpaperExtensionAbility (WallpaperExtensionAbility)
通过本模块接口,开发者可自行开发壁纸应用,并管理壁纸应用生命周期 WallpaperExtensionAbility为壁纸拓展模块,提供应用生命周期回调和监听壁纸变化的能力
> **说明:** > **说明:**
> >
> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> >
> 本模块接口仅可在FA模型下使用。 > 本模块接口仅可在Stage模型下使用。
> >
> 本模块接口均为系统接口。 > 本模块接口均为系统接口。
......
...@@ -4528,7 +4528,7 @@ aVCastController.on('playPrevious', () => { ...@@ -4528,7 +4528,7 @@ aVCastController.on('playPrevious', () => {
off(type: 'playPrevious'): void off(type: 'playPrevious'): void
取消设置播放一首资源的监听事件。 取消设置播放一首资源的监听事件。
**系统能力:** SystemCapability.Multimedia.AVSession.AVCast **系统能力:** SystemCapability.Multimedia.AVSession.AVCast
......
...@@ -1545,4 +1545,167 @@ bundleManager.uninstall(wantTemp, 'bundleName', 100, true).then(() => { ...@@ -1545,4 +1545,167 @@ bundleManager.uninstall(wantTemp, 'bundleName', 100, true).then(() => {
}).catch((err) => { }).catch((err) => {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`); console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}); });
``` ```
\ No newline at end of file
## bundleManager.install
install(admin: Want, hapFilePaths: Array\<string>, callback: AsyncCallback\<void>): void
指定设备管理应用安装指定路径下的应用包。使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理应用。 |
| hapFilePaths | Array\<string> | 是 | 待安装应用包路径数组。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**
以下错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
| 9201002 | the application install failed. |
**示例:**
```js
let wantTemp = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let hapFilePaths = ['/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap']
bundleManager.install(wantTemp, hapFilePaths, (err) => {
if (err) {
console.error(`Failed to install bundles. Code is ${err.code}, message is ${err.message}`);
}
console.info('Succeeded in installing bundles');
});
```
## bundleManager.install
install(admin: Want, hapFilePaths: Array\<string>, installParam: InstallParam, callback: AsyncCallback\<void>): void
指定设备管理应用安装指定路径下的指定安装参数的应用包,。使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理应用。 |
| hapFilePaths | Array\<string> | 是 | 待安装应用包路径数组。 |
| installParam | [InstallParam](#installparam) | 是 | 应用包安装参数。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**
以下错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
| 9201002 | the application install failed. |
**示例:**
```js
let wantTemp = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let hapFilePaths = ['/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap']
let installParam = {
userId: 100,
installFlag: 1,
};
bundleManager.install(wantTemp, hapFilePaths, installParam, (err) => {
if (err) {
console.error(`Failed to install bundles. Code is ${err.code}, message is ${err.message}`);
}
console.info('Succeeded in installing bundles');
});
```
## bundleManager.install
install(admin: Want, hapFilePaths: Array\<string>, installParam?: InstallParam): Promise\<void>
指定设备管理应用安装指定路径下的应用包。使用promise异步回调。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理应用。 |
| hapFilePaths | Array\<string> | 是 | 待安装应用包路径数组。 |
| installParam | [InstallParam](#installparam) | 否 | 应用包安装参数。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。当包安装失败时,抛出错误对象。 |
**错误码**
以下错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```js
let wantTemp = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let hapFilePaths = ['/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap']
bundleManager.install(wantTemp, hapFilePaths).then(() => {
console.info('Succeeded in installing bundles');
}).catch((err) => {
console.error(`Failed to install bundles. Code is ${err.code}, message is ${err.message}`);
});
```
## InstallParam
应用包安装需指定的参数信息。
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统接口:** 此接口为系统接口。
| 名称 | 类型 | 必填 | 说明 |
| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
| userId | number | 否 | 指示用户id,默认值:调用方所在用户,取值范围:大于等于0。
| installFlag | number | 否 | 安装标志。枚举值:0:应用初次安装,1:应用覆盖安装,2:应用免安装,默认值为应用初次安装。 |
\ No newline at end of file
...@@ -248,7 +248,7 @@ listFile(filter?: Filter) : FileIterator ...@@ -248,7 +248,7 @@ listFile(filter?: Filter) : FileIterator
try { try {
let fileIterator = fileInfoDir.listFile(); let fileIterator = fileInfoDir.listFile();
// 含过滤器实现的listFile // 含过滤器实现的listFile
// let fileIterator = rootInfo.listFile(filter); // let fileIterator = fileInfoDir.listFile(filter);
if (!fileIterator) { if (!fileIterator) {
console.error("listFile interface returns an undefined object"); console.error("listFile interface returns an undefined object");
return; return;
...@@ -304,7 +304,7 @@ scanFile(filter?: Filter) : FileIterator; ...@@ -304,7 +304,7 @@ scanFile(filter?: Filter) : FileIterator;
try { try {
let fileIterator = fileInfoDir.scanFile(); let fileIterator = fileInfoDir.scanFile();
// 含过滤器实现的scanFile // 含过滤器实现的scanFile
// let fileIterator = rootInfo.scanFile(filter); // let fileIterator = fileInfoDir.scanFile(filter);
if (!fileIterator) { if (!fileIterator) {
console.error("scanFile interface returns an undefined object"); console.error("scanFile interface returns an undefined object");
return; return;
......
...@@ -285,7 +285,7 @@ getWindowRootElement(windowId?: number): Promise\<AccessibilityElement>; ...@@ -285,7 +285,7 @@ getWindowRootElement(windowId?: number): Promise\<AccessibilityElement>;
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------- | ---------------------- | | ----------------------------------- | ---------------------- |
| Promise&lt;AccessibilityElement&gt; | Promise对象,返回指定屏幕的所有窗口。 | | Promise&lt;AccessibilityElement&gt; | Promise对象,返回指定窗口的根节点元素。 |
**错误码:** **错误码:**
...@@ -355,7 +355,7 @@ try { ...@@ -355,7 +355,7 @@ try {
getWindowRootElement(windowId: number, callback: AsyncCallback\<AccessibilityElement>): void; getWindowRootElement(windowId: number, callback: AsyncCallback\<AccessibilityElement>): void;
获取指定屏幕中的所有窗口, 使用callback异步回调。 获取指定窗口的根节点元素, 使用callback异步回调。
**系统能力:** SystemCapability.BarrierFree.Accessibility.Core **系统能力:** SystemCapability.BarrierFree.Accessibility.Core
......
...@@ -37,6 +37,7 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void; ...@@ -37,6 +37,7 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
- 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限
- 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限
- 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)
- 跨任务链启动时,如果需要跨任务链进行返回,需要参考[Want](js-apis-app-ability-want.md)中的parameter参数用法。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core **系统能力**:SystemCapability.Ability.AbilityRuntime.Core
...@@ -44,7 +45,7 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void; ...@@ -44,7 +45,7 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-want.md) | 是 | 启动Ability的want信息。 | | want | [Want](js-apis-app-ability-want.md) | 是 | 启动Ability的want信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动结果。 | | callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动结果。 |
**错误码:** **错误码:**
......
...@@ -443,6 +443,90 @@ notificationSubscribe.remove(hashCode, reason).then(() => { ...@@ -443,6 +443,90 @@ notificationSubscribe.remove(hashCode, reason).then(() => {
console.info("remove success"); console.info("remove success");
}); });
``` ```
## NotificationSubscribe.remove
remove(hashCodes: Array\<string\>, reason: RemoveReason, callback: AsyncCallback\<void\>): void
批量删除指定通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
|-----------|-------------------------------| ---- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| hashCodes | Array\<string\> | 是 | 通知唯一ID数组集合。可以通过[onConsume](js-apis-inner-notification-notificationSubscriber.md#onConsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象中的hashCode。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 |
**错误码:**
错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)
| 错误码ID | 错误信息 |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
**示例:**
```js
let hashCodes = ['hashCode1', 'hashCode2'];
function removeCallback(err) {
if (err) {
console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("remove success");
}
}
let reason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE;
notificationSubscribe.remove(hashCodes, reason, removeCallback);
```
## NotificationSubscribe.remove
remove(hashCodes: Array\<string\>, reason: RemoveReason): Promise\<void\>
批量删除指定通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
|-----------|-------------------------------| ---- |-------------|
| hashCodes | Array\<string\> | 是 | 通知唯一ID数组集合。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
**错误码:**
错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)
| 错误码ID | 错误信息 |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
**示例:**
```js
let hashCodes = ['hashCode1','hashCode2'];
let reason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
notificationSubscribe.remove(hashCodes, reason).then(() => {
console.info("remove success");
});
```
## NotificationSubscribe.removeAll ## NotificationSubscribe.removeAll
......
...@@ -282,6 +282,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) =&gt; vo ...@@ -282,6 +282,10 @@ on(type: 'progress', callback:(uploadedSize: number, totalSize: number) =&gt; vo
订阅上传任务进度监听,同步方法,使用callback形式返回结果。 订阅上传任务进度监听,同步方法,使用callback形式返回结果。
> **说明:**
>
> 当应用处于后台时,为满足功耗性能要求,不支持调用此接口进行回调。
**需要权限**:ohos.permission.INTERNET **需要权限**:ohos.permission.INTERNET
**系统能力**: SystemCapability.MiscServices.Upload **系统能力**: SystemCapability.MiscServices.Upload
...@@ -839,6 +843,10 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo ...@@ -839,6 +843,10 @@ on(type: 'progress', callback:(receivedSize: number, totalSize: number) =&gt; vo
订阅下载任务进度监听,同步方法,使用callback形式返回结果。 订阅下载任务进度监听,同步方法,使用callback形式返回结果。
> **说明:**
>
> 当应用处于后台时,为满足功耗性能要求,不支持调用此接口进行回调。
**需要权限**:ohos.permission.INTERNET **需要权限**:ohos.permission.INTERNET
**系统能力**: SystemCapability.MiscServices.Download **系统能力**: SystemCapability.MiscServices.Download
......
...@@ -40,16 +40,34 @@ setDarkMode(mode: DarkMode, callback: AsyncCallback\<void>): void ...@@ -40,16 +40,34 @@ setDarkMode(mode: DarkMode, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.ArkUI.UiAppearance **系统能力:** SystemCapability.ArkUI.UiAppearance
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -- | -- | -- | -- | | -- | -- | -- | -- |
| mode | [DarkMode](#darkmode) | 是 | 指定系统的深色模式配置 | | mode | [DarkMode](#darkmode) | 是 | 指定系统的深色模式配置 |
| callback | AsyncCallback\<void>| 是 | 配置深色模式的异步回调 | | callback | AsyncCallback\<void>| 是 | 配置深色模式的异步回调 |
**错误码:**
错误码详细介绍请参考[errcode-uiappearance](../errorcodes/errorcode-uiappearance.md)
| 错误码ID | 错误码信息 |
| -- | -- |
| 500001 | Internal error. |
**示例:** **示例:**
```ts ```ts
uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { try {
console.info(`${err}`); uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (error) => {
}) if (error) {
console.error('Set dark-mode failed, ' + error.message);
} else {
console.info('Set dark-mode successfully.');
}
})
} catch (error) {
console.error('Set dark-mode failed, ' + error.message);
}
``` ```
...@@ -64,6 +82,7 @@ setDarkMode(mode: DarkMode): Promise\<void>; ...@@ -64,6 +82,7 @@ setDarkMode(mode: DarkMode): Promise\<void>;
**系统能力:** SystemCapability.ArkUI.UiAppearance **系统能力:** SystemCapability.ArkUI.UiAppearance
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -- | -- | -- | -- | | -- | -- | -- | -- |
| mode | [DarkMode](#darkmode) | 是 | 指定系统深色模式配置 | | mode | [DarkMode](#darkmode) | 是 | 指定系统深色模式配置 |
...@@ -74,13 +93,26 @@ setDarkMode(mode: DarkMode): Promise\<void>; ...@@ -74,13 +93,26 @@ setDarkMode(mode: DarkMode): Promise\<void>;
| ------ | ------------------------------ | | ------ | ------------------------------ |
| Promise\<void> | Promise对象。无返回结果的Promise对象。| | Promise\<void> | Promise对象。无返回结果的Promise对象。|
**错误码:**
错误码详细介绍请参考[errcode-uiappearance](../errorcodes/errorcode-uiappearance.md)
| 错误码ID | 错误码信息 |
| -- | -- |
| 500001 | Internal error. |
**示例:** **示例:**
```ts ```ts
uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { try {
console.log('Set dark-mode successfully.'); uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => {
}).catch((err) => { console.info('Set dark-mode successfully.');
console.log(`Set dark-mode failed, ${err}`); }).catch((error) => {
}); console.error('Set dark-mode failed, ' + error.message);
});
} catch (error) {
console.error('Set dark-mode failed, ' + error.message);
}
``` ```
...@@ -95,12 +127,26 @@ getDarkMode(): DarkMode; ...@@ -95,12 +127,26 @@ getDarkMode(): DarkMode;
**系统能力:** SystemCapability.ArkUI.UiAppearance **系统能力:** SystemCapability.ArkUI.UiAppearance
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -- | -- | | -- | -- |
|[DarkMode](#darkmode) | 系统当前的深色模式配置 | |[DarkMode](#darkmode) | 系统当前的深色模式配置 |
**错误码:**
错误码详细介绍请参考[errcode-uiappearance](../errorcodes/errorcode-uiappearance.md)
| 错误码ID | 错误码信息 |
| -- | -- |
| 500001 | Internal error. |
**示例:** **示例:**
```ts ```ts
let darkMode = uiAppearance.getDarkMode(); try {
console.log(`Get dark-mode ${darkMode}`); let darkMode = uiAppearance.getDarkMode();
console.info('Get dark-mode ' + mode);
} catch (error) {
console.error('Get dark-mode failed, ' + error.message);
}
``` ```
\ No newline at end of file
...@@ -330,7 +330,7 @@ constructor(name: string, param: unknown) ...@@ -330,7 +330,7 @@ constructor(name: string, param: unknown)
| 名称 | 描述 | | 名称 | 描述 |
| ----- | ---------------------------------------- | | ----- | ---------------------------------------- |
| Stack | 导航栏与内容区独立显示,相当于两个页面。 | | Stack | 导航栏与内容区独立显示,相当于两个页面。 |
| Split | 导航栏与内容区分两栏显示。 | | Split | 导航栏与内容区分两栏显示。<br/>以下navBarWidthRange的值用[minNavBarWidth,maxNavBarWidth]表示<br/>1.当navBarWidth属性的值,在navBarWidthRange属性的值范围以外时,navBarWidth按如下规则显示:<br/>navBarWidth < minNavBarWidth时navBarWidth修正为minNavBarWidth;<br/>navBarWidth > maxNavBarWidth,且组件宽度 - minContentWidth大于maxNavBarWidth时,navBarWidth修正为maxNavBarWidth;<br/>navBarWidth > maxNavBarWidth,且组件宽度 - minContentWidth小于minNavBarWidth时,navBarWidth修正为minNavBarWidth;<br/>navBarWidth > maxNavBarWidth,且组件宽度 - minContentWidth在navBarWidthRange范围内,navBarWidth修正为组件宽度 - minContentWidth。<br/>2.缩小组件尺寸时,先缩小内容区的尺寸至minContentWidth,然后再缩小导航栏的尺寸至minNavBarWidth。若继续缩小,先缩小内容区,内容区消失后再缩小导航栏。<br/>3.设置导航栏为固定尺寸时,若持续缩小组件尺寸,导航栏最后压缩显示。<br/>4.当navBarWidth值与minContentWidth的值相加大于组件尺寸时,会优先显示导航栏。 |
| Auto | API version 9之前:窗口宽度>=520vp时,采用Split模式显示;窗口宽度<520vp时采用Stack模式显示。<br/>API version 10及以上:窗口宽度>=600vp时,采用Split模式显示;窗口宽度<600vp时,采用Stack模式显示,600vp等于minNavBarWidth(240vp) + minContentWidth (360vp)。 | | Auto | API version 9之前:窗口宽度>=520vp时,采用Split模式显示;窗口宽度<520vp时采用Stack模式显示。<br/>API version 10及以上:窗口宽度>=600vp时,采用Split模式显示;窗口宽度<600vp时,采用Stack模式显示,600vp等于minNavBarWidth(240vp) + minContentWidth (360vp)。 |
## TitleHeight枚举说明 ## TitleHeight枚举说明
......
...@@ -97,6 +97,7 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) ...@@ -97,6 +97,7 @@ Progress(options: {value: number, total?: number, type?: ProgressType})
| 名称 | 参数类型 | 必填 | 描述 | | 名称 | 参数类型 | 必填 | 描述 |
| ------------- | ---------------------------- | ---- | ------------------------------------------------------------------------------------------ | | ------------- | ---------------------------- | ---- | ------------------------------------------------------------------------------------------ |
| strokeWidth | [Length](ts-types.md#length) | 否 | 设置进度条宽度(不支持百分比设置)。<br/>默认值:4.0vp | | strokeWidth | [Length](ts-types.md#length) | 否 | 设置进度条宽度(不支持百分比设置)。<br/>默认值:4.0vp |
| strokeRadius | [PX](ts-types.md#px10) \| [VP](ts-types.md#vp10) \| [LPX](ts-types.md#lpx10) \| [Resource](ts-types.md#resource)| 否 | 设置线性进度条圆角半径。<br/>取值范围[0, strokeWidth / 2]。默认值:strokeWidth / 2。 |
| enableScanEffect | boolean | 否 | 进度条扫光效果的开关。<br/>默认值: false | | enableScanEffect | boolean | 否 | 进度条扫光效果的开关。<br/>默认值: false |
| enableSmoothEffect | boolean | 否 | 进度平滑动效的开关。开启平滑动效后设置进度,进度会从当前值渐变至设定值,否则进度从当前值突变至设定值。<br/>默认值:true | | enableSmoothEffect | boolean | 否 | 进度平滑动效的开关。开启平滑动效后设置进度,进度会从当前值渐变至设定值,否则进度从当前值突变至设定值。<br/>默认值:true |
......
...@@ -51,7 +51,7 @@ SideBarContainer( type?: SideBarContainerType ) ...@@ -51,7 +51,7 @@ SideBarContainer( type?: SideBarContainerType )
| autoHide<sup>9+</sup> | boolean | 设置当侧边栏拖拽到小于最小宽度后,是否自动隐藏。<br/>默认值:true<br>**说明:** <br>受minSideBarWidth属性方法影响,minSideBarWidth属性方法未设置值使用默认值。<br/>拖拽过程中判断是否要自动隐藏。小于最小宽度时需要阻尼效果触发隐藏(越界一段距离) | | autoHide<sup>9+</sup> | boolean | 设置当侧边栏拖拽到小于最小宽度后,是否自动隐藏。<br/>默认值:true<br>**说明:** <br>受minSideBarWidth属性方法影响,minSideBarWidth属性方法未设置值使用默认值。<br/>拖拽过程中判断是否要自动隐藏。小于最小宽度时需要阻尼效果触发隐藏(越界一段距离) |
| sideBarPosition<sup>9+</sup> | [SideBarPosition](#sidebarposition9枚举说明) | 设置侧边栏显示位置。<br/>默认值:SideBarPosition.Start | | sideBarPosition<sup>9+</sup> | [SideBarPosition](#sidebarposition9枚举说明) | 设置侧边栏显示位置。<br/>默认值:SideBarPosition.Start |
| divider<sup>10+</sup> | [DividerStyle](#dividerstyle10对象说明) \| null | 设置分割线的样式。<br/>- 默认为DividerStyle:显示分割线。<br/>- null:不显示分割线。 | | divider<sup>10+</sup> | [DividerStyle](#dividerstyle10对象说明) \| null | 设置分割线的样式。<br/>- 默认为DividerStyle:显示分割线。<br/>- null:不显示分割线。 |
| minContentWidth<sup>10+</sup> | [Dimension](ts-types.md#dimension10) | SideBarContainer组件内容区的最小宽度。<br/>默认值:360vp<br/>单位:vp<br/>**说明:** <br/>设置为小于0的值时按默认值显示,未设置时为0vp。<br/>Embed场景下,增大组件尺寸时仅增大内容区的尺寸,缩小组件尺寸时,先缩小内容区的尺寸至minContentWidth,然后再缩小侧边栏的尺寸,当缩小侧边栏的尺寸至minSideBarWidth后,继续缩小组件尺寸时,会保持侧边栏最小尺寸,继续缩小内容区尺寸,并采用截断方式显示内容区,内容区尺寸可以缩小至0vp<br/>minContentWidth优先于侧边栏的maxSideBarWidth与sideBarWidth属性,minContentWidth未设置时默认值优先级低于设置的minSideBarWidth与maxSideBarWidth属性。 | | minContentWidth<sup>10+</sup> | [Dimension](ts-types.md#dimension10) | SideBarContainer组件内容区的最小宽度。<br/>默认值:360vp<br/>单位:vp<br/>**说明:** <br/>设置为小于0的值时按默认值显示,未设置时为0vp。<br/>Embed场景下,增大组件尺寸时仅增大内容区的尺寸<br/>缩小组件尺寸时,先缩小内容区的尺寸至minContentWidth。继续缩小组件尺寸时,保持内容区宽度minContentWidth不变,优先缩小侧边栏的尺寸。<br/>当缩小侧边栏的尺寸至minSideBarWidth后,继续缩小组件尺寸时,<br/>- 如果autoHide属性为false,则会保持侧边栏宽度minSideBarWidth和内容区宽度minContentWidth不变,但内容区会被截断显示;<br/>- 如果autoHide属性为true,则会优先隐藏侧边栏,然后继续缩小至内容区宽度minContentWidth后,内容区宽度保持不变,但内容区会被截断显示<br/>minContentWidth优先于侧边栏的maxSideBarWidth与sideBarWidth属性,minContentWidth未设置时默认值优先级低于设置的minSideBarWidth与maxSideBarWidth属性。 |
## ButtonStyle对象说明 ## ButtonStyle对象说明
......
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
> **说明:** > **说明:**
> >
> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
>
> 不支持横竖屏切换。 > 不支持横竖屏切换。
>
> 不支持路由跳转。
## 属性 ## 属性
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> >
> 不支持横竖屏切换。 > 不支持横竖屏切换。
>
> 不支持路由跳转。
## 属性 ## 属性
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
- [元能力子系统错误码](errorcode-ability.md) - [元能力子系统错误码](errorcode-ability.md)
- [DistributedSchedule错误码](errorcode-DistributedSchedule.md) - [DistributedSchedule错误码](errorcode-DistributedSchedule.md)
- [卡片错误码](errorcode-form.md) - [卡片错误码](errorcode-form.md)
- AI业务
- [智能语音错误码](errorcode-intelligentVoice.md)
- 包管理 - 包管理
- [包管理子系统通用错误码](errorcode-bundle.md) - [包管理子系统通用错误码](errorcode-bundle.md)
- [zlib子系统错误码](errorcode-zlib.md) - [zlib子系统错误码](errorcode-zlib.md)
......
...@@ -644,4 +644,44 @@ Failed to install the HAP because the code signature verification is failed. ...@@ -644,4 +644,44 @@ Failed to install the HAP because the code signature verification is failed.
**处理步骤**<br/> **处理步骤**<br/>
1. 检查代码签名文件对应的module是否包含在安装包路径之中。 1. 检查代码签名文件对应的module是否包含在安装包路径之中。
2. 检查提供的代码签名文件的路径是否合法。 2. 检查提供的代码签名文件的路径是否合法。
3. 使用和安装包匹配的代码签名文件。 3. 使用和安装包匹配的代码签名文件。
\ No newline at end of file
## 17700049 应用自升级时安装的应用与调用方包名不同
**错误信息**<br/>
Failed to install the HAP because the bundleName is different from the bundleName of the caller application.
**错误描述**<br/>
企业mdm应用自升级时,安装的应用与调用方包名不同。
**可能原因**<br/>
1. 要安装的hap或hsp不属于当前应用。
**处理步骤**<br/>
1. 检查要安装的hap或hsp是否属于当前应用。
## 17700050 企业设备校验失败
**错误信息**<br/>
Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device.
**错误描述**<br/>
安装应用时,企业normal应用或企业mdm应用无法在非企业设备上安装。
**可能原因**<br/>
1. 安装设备不是企业设备。
**处理步骤**<br/>
1. 检查安装设备是否为企业设备。
2. 检查设备参数const.bms.allowenterprisebundle是否为true
## 17700051 应用自升级时安装的应用与调用方包名不同
**错误信息**<br/>
Failed to install the HAP because the distribution type of caller application is not enterprise_mdm.
**错误描述**<br/>
企业mdm应用自升级时,调用方的分发类型不是企业mdm。
**可能原因**<br/>
1. 调用方的分发类型不是企业mdm。
**处理步骤**<br/>
1. 检查应用的签名文件是否正确配置。
# IntelligentVoice错误码
> **说明:**
>
> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。
## 22700101 内存不足
**错误信息**
No memory.
**错误描述**
调用接口时,分配内存失败或者出现空指针。
**可能原因**
1. 系统内存压力大,没有足够的内存用来映射。
2. 对于失效的实例,没有及时销毁释放内存。
**处理步骤**
1. 停止当前操作,或者暂停其他的应用,以保证当前业务有可用内存。
2. 主动清空失效的实例,释放内存后再重新创建实例,仍然失败,则停止相关操作。
## 22700102 无效入参
**错误信息**
Input parameter value error.
**错误描述**
调用接口时,传入的参数无效。
**可能原因**
参数无效,比如值不在边界范围内,没有使用指定的枚举范围等。
**处理步骤**
根据接口文档,传入正确的入参。
## 22700103 初始化失败
**错误信息**
Init failed.
**错误描述**
调用引擎的初始化接口时,返回初始化失败。
**可能原因**
1. 重复初始化。
2. 没有注册初始化所需要的资源。
**处理步骤**
1. 不要重复初始化。
2. 确认注册初始化需要的资源(声学模型文件等)已经完备。
## 22700104 确认注册结果失败
**错误信息**
Commit enroll failed.
**错误描述**
调用注册引擎的确认注册结果接口[commit()](../apis/js-apis-intelligentVoice.md#commit)时,返回失败。
**可能原因**
没有完成指定次数的注册流程。
**处理步骤**
根据界面上要求的注册次数注册完成后再确认注册结果。
# 用户界面外观服务错误码
> **说明:**
>
> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。
## 500001 内部错误
**错误信息**
Internal error.
**错误描述**
当出现了开发者解决不了的内部异常错误,如参数持久化错误,获取服务失败,配置深浅色模式失败等,系统会产生此错误码。
**可能原因**
参数持久化错误,获取服务失败,配置深浅色模式失败等。
**处理步骤**
NA
...@@ -367,6 +367,6 @@ user_grant权限可以通过预授权方式请求权限。预授权方式需要 ...@@ -367,6 +367,6 @@ user_grant权限可以通过预授权方式请求权限。预授权方式需要
针对访问控制,有以下相关实例可供参考: 针对访问控制,有以下相关实例可供参考:
- [AbilityAccessCtrl:访问权限控制(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Security/AbilityAccessCtrl) - [访问权限控制(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Security/AbilityAccessCtrl)
- [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Security/AccessPermission) - [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Security/AccessPermission)
...@@ -573,3 +573,9 @@ function crlEntrySample() { ...@@ -573,3 +573,9 @@ function crlEntrySample() {
}); });
} }
``` ```
## 相关实例
针对证书开发,有以下相关实例可供参考:
- [证书算法库框架(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Security/CertificateFramework)
\ No newline at end of file
...@@ -2571,4 +2571,10 @@ function doRandBySync() { ...@@ -2571,4 +2571,10 @@ function doRandBySync() {
针对加解密算法开发,有以下相关实例可供参考: 针对加解密算法开发,有以下相关实例可供参考:
- [支付(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Security/PaySecurely)
- [通用密钥库系统(cryptoFramework)(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Security/CryptoFramework)
- [加解密(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Security/Cipher)
- [字符串加解密(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Security/StringCipherArkTS) - [字符串加解密(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Security/StringCipherArkTS)
...@@ -86,3 +86,7 @@ ...@@ -86,3 +86,7 @@
## 读取已安装应用列表 ## 读取已安装应用列表
- ohos.permission.GET_INSTALLED_BUNDLE_LIST - ohos.permission.GET_INSTALLED_BUNDLE_LIST
## 蓝牙
- ohos.permission.ACCESS_BLUETOOTH
...@@ -194,4 +194,8 @@ ...@@ -194,4 +194,8 @@
基于代理提醒,有以下相关实例可供参考: 基于代理提醒,有以下相关实例可供参考:
- [后台代理提醒(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/ReminderAgentManager)
- [翻页闹钟(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Tools/FlipClock)
- [闹钟(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock) - [闹钟(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock)
\ No newline at end of file
...@@ -475,4 +475,4 @@ ...@@ -475,4 +475,4 @@
针对长时任务开发,有以下相关实例可供参考: 针对长时任务开发,有以下相关实例可供参考:
- [ContinuousTask:长时任务(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/ContinuousTask) - [长时任务(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/ContinuousTask)
\ No newline at end of file \ No newline at end of file
...@@ -97,4 +97,4 @@ ...@@ -97,4 +97,4 @@
针对短时任务开发,有以下相关实例可供参考: 针对短时任务开发,有以下相关实例可供参考:
- [短时任务(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/TransientTask) - [短时任务(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/TransientTask)
\ No newline at end of file \ No newline at end of file
...@@ -210,4 +210,4 @@ WorkInfo参数用于设置应用条件,参数设置时需遵循以下规则: ...@@ -210,4 +210,4 @@ WorkInfo参数用于设置应用条件,参数设置时需遵循以下规则:
针对延迟任务调度的开发,有以下相关示例可供参考: 针对延迟任务调度的开发,有以下相关示例可供参考:
- [WorkScheduler的创建与使用(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) - [延迟任务调度(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler)
\ No newline at end of file \ No newline at end of file
...@@ -111,6 +111,6 @@ observer模块为开发者提供订阅和取消订阅通话业务状态的功能 ...@@ -111,6 +111,6 @@ observer模块为开发者提供订阅和取消订阅通话业务状态的功能
## 相关实例 ## 相关实例
拨打电话有以下相关实例可供参考: 针对拨打电话,有以下相关实例可供参考:
- [拨打电话](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Telephony/Call) - [拨打电话(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Telephony/Call)
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册