From ef7ddf938f3848f29a559ef41df35113ea514882 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Wed, 14 Sep 2022 16:08:49 +0800 Subject: [PATCH] update docs Signed-off-by: Annie_wang --- en/application-dev/faqs/Readme-EN.md | 6 ++++ .../faqs/faqs-data-management.md | 24 +++++++++++++ .../faqs/faqs-file-management.md | 36 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 en/application-dev/faqs/Readme-EN.md create mode 100644 en/application-dev/faqs/faqs-data-management.md create mode 100644 en/application-dev/faqs/faqs-file-management.md diff --git a/en/application-dev/faqs/Readme-EN.md b/en/application-dev/faqs/Readme-EN.md new file mode 100644 index 0000000000..9b471deb0b --- /dev/null +++ b/en/application-dev/faqs/Readme-EN.md @@ -0,0 +1,6 @@ +# FAQs + +- [File Management Development](faqs-file-management.md) + +- [Data Management Development](faqs-data-management.md) + diff --git a/en/application-dev/faqs/faqs-data-management.md b/en/application-dev/faqs/faqs-data-management.md new file mode 100644 index 0000000000..839514879b --- /dev/null +++ b/en/application-dev/faqs/faqs-data-management.md @@ -0,0 +1,24 @@ +# Device 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 a **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 from **/data/app/el2/100/database/Bundle name/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/application-dev/faqs/faqs-file-management.md b/en/application-dev/faqs/faqs-file-management.md new file mode 100644 index 0000000000..1e37400477 --- /dev/null +++ b/en/application-dev/faqs/faqs-file-management.md @@ -0,0 +1,36 @@ +# File Management Development + + + +## What 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 OpenHarmony [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 = [ + "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}`) + }) + } + ``` -- GitLab