diff --git a/en/device-dev/faqs/Readme-EN.md b/en/device-dev/faqs/Readme-EN.md index e2ba8cafc87786494ae79d816bb3b719c25750c5..89e11ab7dc927320399ee948679516a8d2463c09 100644 --- a/en/device-dev/faqs/Readme-EN.md +++ b/en/device-dev/faqs/Readme-EN.md @@ -4,6 +4,8 @@ - [Environment Setup](faqs-environment-setup.md) - [Compilation and Building](faqs-building.md) - [Burning](faqs-burning.md) +- [File Management Development](faqs-file-management.md) +- [Data Management Development](faqs-data-management.md) - [Kernel](faqs-kernel.md) - [Porting](faqs-porting.md) - [Startup](faqs-startup.md) diff --git a/en/device-dev/faqs/faqs-data-management.md b/en/device-dev/faqs/faqs-data-management.md new file mode 100644 index 0000000000000000000000000000000000000000..2023eca1c5f2c5d8a36e8e08a0caa89b674ad400 --- /dev/null +++ b/en/device-dev/faqs/faqs-data-management.md @@ -0,0 +1,24 @@ +# Data Management Development + + + +## How Do I Save PixelMap Data to a Database? + +Applicable to: OpenHarmony SDK 3.2.3.5 + +You can convert a **PixelMap** into an **ArrayBuffer** and save the **ArrayBuffer** to your database. + +Reference: [readPixelsToBuffer](../reference/apis/js-apis-image.md#readpixelstobuffer7-1) + +## How Do I Obtain RDB Store Files? + +Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 + +Run the hdc_std command to copy the .db, .db-shm, and .db-wal files in **/data/app/el2/100/database/*bundleName*/entry/db/**, and then use the SQLite tool to open the files. + +Example: + + +``` + hdc_std file recv /data/app/el2/100/database/com.xxxx.xxxx/entry/db/test.db ./test.db +``` diff --git a/en/device-dev/faqs/faqs-file-management.md b/en/device-dev/faqs/faqs-file-management.md new file mode 100644 index 0000000000000000000000000000000000000000..f00d295b7b229d50348d14703c54a59a5669e187 --- /dev/null +++ b/en/device-dev/faqs/faqs-file-management.md @@ -0,0 +1,36 @@ +# File Management Development + + + +## What Should I Do If There is No Return Value or Error Captured After getAlbums Is Called? + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +The **ohos.permission.READ_MEDIA** permission is required for calling **getAlbums**, and this permission needs user authorization. For details, see [Application Permission List](../security/permission-list.md). + +1. Configure the required permission in the **module.json5** file. + + ``` + "requestPermissions": [ + { + "name": "ohos.permission.READ_MEDIA" + } + ] + ``` + +2. Add the code for user authorization before the **MainAbility.ts -> onWindowStageCreate** page is loaded. + + ``` + private requestPermissions() { + let permissionList: Array<string> = [ + "ohos.permission.READ_MEDIA" + ]; + this.context.requestPermissionsFromUser(permissionList) + .then(data => { + console.info(`request permission data result = ${data.authResults}`) + }) + .catch(err => { + console.error(`fail to request permission error:${err}`) + }) + } + ```