From 2de9cbe6cd26802c4c38803747e1aea4b53d14a7 Mon Sep 17 00:00:00 2001 From: Gloria Date: Tue, 20 Sep 2022 09:31:13 +0800 Subject: [PATCH] added faq EN against 8764 Signed-off-by: Gloria --- en/application-dev/Readme-EN.md | 1 + en/application-dev/faqs/Readme-EN.md | 11 +++- en/application-dev/faqs/faqs-ability.md | 60 +++++++++++++++++++ en/application-dev/faqs/faqs-connectivity.md | 4 +- en/application-dev/faqs/faqs-graphics.md | 13 ++++ en/application-dev/faqs/faqs-hdc-std.md | 4 +- en/application-dev/faqs/faqs-ide.md | 2 +- en/application-dev/faqs/faqs-native.md | 55 +++++++++++++++++ .../faqs/faqs-third-party-library.md | 7 +++ 9 files changed, 147 insertions(+), 10 deletions(-) create mode 100644 en/application-dev/faqs/faqs-ability.md create mode 100644 en/application-dev/faqs/faqs-graphics.md create mode 100644 en/application-dev/faqs/faqs-native.md create mode 100644 en/application-dev/faqs/faqs-third-party-library.md diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md index 468563207a..61e5d5f39e 100644 --- a/en/application-dev/Readme-EN.md +++ b/en/application-dev/Readme-EN.md @@ -47,5 +47,6 @@ - Native APIs - [Standard Libraries](reference/native-lib/third_party_libc/musl.md) - [Node_API](reference/native-lib/third_party_napi/napi.md) +- [FAQs](faqs/Readme-EN.md) - Contribution - [How to Contribute](../contribute/documentation-contribution.md) diff --git a/en/application-dev/faqs/Readme-EN.md b/en/application-dev/faqs/Readme-EN.md index 4ed1b05a84..b1dee7fdef 100644 --- a/en/application-dev/faqs/Readme-EN.md +++ b/en/application-dev/faqs/Readme-EN.md @@ -1,5 +1,10 @@ # FAQs -- [FAQs About Network and Connection Development](faqs-connectivity.md) -- [FAQs About hdc_std Command Usage](faqs-ide.md) -- [FAQs About IDE Usage](faqs-hdc-std.md) \ No newline at end of file +- [Ability Framework Development](faqs-ability.md) +- [Graphics and Image Development](faqs-graphics.md) +- [Network and Connection Development](faqs-connectivity.md) +- [Native API Usage](faqs-native.md) +- [Usage of Third- and Fourth-Party Libraries](faqs-third-party-library.md) +- [IDE Usage](faqs-ide.md) +- [hdc_std Command Usage](faqs-hdc-std.md) + diff --git a/en/application-dev/faqs/faqs-ability.md b/en/application-dev/faqs/faqs-ability.md new file mode 100644 index 0000000000..0cabbba718 --- /dev/null +++ b/en/application-dev/faqs/faqs-ability.md @@ -0,0 +1,60 @@ +# Ability Framework Development + +## Is a guide similar to the Data ability development in the FA model available for the stage model? + +Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 + +A guide is available for the **DataShareExtensionAbility** class in the stage model, which provides APIs for sharing data with other applications and managing the data. + +Reference: [DataShare Development](../database/database-datashare-guidelines.md) + +## What should I do if the UI does not respond when an ability is started? + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +1. If the ability is started using **startAbility**, check whether the **abilityName** field in **want** uses the bundle name as the prefix. If yes, delete the bundle name. + +2. Make sure the ability's home page file configured by **onWindowStageCreate** in the **MainAbility.ts** file is defined in the **main_pages.json** file. + +3. You are advised to use the SDK and OpenHarmony SDK versions released on the same day. + +Reference: [Release Testing Version](https://gitee.com/openharmony-sig/oh-inner-release-management/blob/master/Release-Testing-Version.md) + +## How do I prevent "this" in a method from changing to "undefined" when the method is called? + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +Method 1: Add **.bind(this)** when calling the method. + +Method 2: Use the arrow function. + +## What should I do when the message "must have required property 'startWindowIcon'" is displayed? + +Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 + +Configure the **startWindowIcon** attribute under **abilities** in the **module.json5** file. + +Reference: [Application Package Structure Configuration File](../quick-start/stage-structure.md) + + Example: + +``` +{ + "module": { + // Do something. + "abilities": [{ + // Do something. + "startWindowIcon": "$media:space", + "startWindowBackground": "$color:white", + }] + } +} +``` + +## How do I obtain a notification when the device orientation changes? + +Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 + +Implement the **onConfigurationUpdated** callback in the **Ability** class. The callback is triggered when the system language, color mode, or display parameters (such as the orientation and density) change. + +Reference: [Ability Development](../ability/stage-ability.md) diff --git a/en/application-dev/faqs/faqs-connectivity.md b/en/application-dev/faqs/faqs-connectivity.md index 670b406a2b..105bbd61d8 100644 --- a/en/application-dev/faqs/faqs-connectivity.md +++ b/en/application-dev/faqs/faqs-connectivity.md @@ -1,6 +1,4 @@ -# FAQs About Network and Connection Development - - +# Network and Connection Development ## What Are the Data Formats Supported by extraData in an HTTP Request? diff --git a/en/application-dev/faqs/faqs-graphics.md b/en/application-dev/faqs/faqs-graphics.md new file mode 100644 index 0000000000..c4e151559b --- /dev/null +++ b/en/application-dev/faqs/faqs-graphics.md @@ -0,0 +1,13 @@ +# Graphics and Image Development + +## Why do the isStatusBarLightIcon and isNavigationBarLightIcon attributes not take effect when window.setSystemBarProperties() is called? + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +In effect, the **isStatusBarLightIcon** and **isNavigationBarLightIcon** attributes turn the font white when set to **true**. If **statusBarContentColor** is also set in **window.setSystemBarProperties()**, the **isStatusBarLightIcon** attribute does not take effect. Similarly, if **navigationBarContentColor** is set, the **isNavigationBarLightIcon** attribute does not take effect. + +## How do I set the style of the system bar? + +Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 + +Import the **\@ohos.window** module, and call **window.setSystemBarProperties()**. diff --git a/en/application-dev/faqs/faqs-hdc-std.md b/en/application-dev/faqs/faqs-hdc-std.md index 7ca047a801..044d4d3fa1 100644 --- a/en/application-dev/faqs/faqs-hdc-std.md +++ b/en/application-dev/faqs/faqs-hdc-std.md @@ -1,6 +1,4 @@ -# FAQs About hdc_std Command Usage - - +# hdc_std Command Usage ## Common Log Commands diff --git a/en/application-dev/faqs/faqs-ide.md b/en/application-dev/faqs/faqs-ide.md index 3cdaf27082..f69cef46d3 100644 --- a/en/application-dev/faqs/faqs-ide.md +++ b/en/application-dev/faqs/faqs-ide.md @@ -1,4 +1,4 @@ -# FAQs About IDE Usage +# IDE Usage ## What Should Do If the Error Message "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN" Is Displayed? diff --git a/en/application-dev/faqs/faqs-native.md b/en/application-dev/faqs/faqs-native.md new file mode 100644 index 0000000000..da00895e4a --- /dev/null +++ b/en/application-dev/faqs/faqs-native.md @@ -0,0 +1,55 @@ +# Native API Usage + +## When a native HAP is running, the error message "Obj is not a valid object" is displayed for the imported namespace. What should I do? + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +Check the **abiFilters** parameter value in the **build-profile.json5** file in the root directory of the module (not the root directory of the project). If the device is 32-bit, the value must be **armeabi-v7a**. If the device is 64-bit, the value must be **arm64-v8a**. + +## How do I obtain the value of version in the package.json file of a module in the C++ code developed using native APIs? + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +1. In the script file **hvigorfile.js** of Hvigor, use **subModule.getPackageJsonPath** to obtain the location of the **package.json** file in the module. + +2. Use Node.js to read the **version** field in the **package.json** file and write the value to the **buildOption.cppFlags** field in the **build-profile.json5** file. + +Example + + +``` +// Module-level hvigorfile.js +const subModule = require('@ohos/hvigor')(__filename) + +const fs = require("fs-extra") +const path = require("path") + +const packageJsonPath = subModule.getPackageJsonPath() +const buildProfilePath = path.resolve(packageJsonPath, '../build-profile.json5') +const packageJsonData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) +let buildProfileData = fs.readFileSync(buildProfilePath, 'utf8') +buildProfileData = buildProfileData.replace(/\"cppFlags\"\:(.*)\,/, `"cppFlags": "-D NWEBEX_VERSION=${packageJsonData.version}",`) +fs.writeFileSync(buildProfilePath, buildProfileData, 'utf8') + +const ohosPlugin = require('@ohos/hvigor-ohos-plugin').hapTasks(subModule) // The plug-in executes the C++ build task and reads the build-profile.json5 file. + +module.exports = { + ohos: ohosPlugin +} +``` + + +``` +// Read the hello.cpp file. +#define _NWEBEX_VERSION(v) #v +#define _NWEBEX_VER2STR(v) _NWEBEX_VERSION(v) + +static napi_value Add(napi_env env, napi_callback_info info) +{ + + napi_value fixed_version_value = nullptr; + napi_create_string_utf8(env, _NWEBEX_VER2STR(NWEBEX_VERSION), NAPI_AUTO_LENGTH, &fixed_version_value); + + return fixed_version_value; +} +``` diff --git a/en/application-dev/faqs/faqs-third-party-library.md b/en/application-dev/faqs/faqs-third-party-library.md new file mode 100644 index 0000000000..8ed5475596 --- /dev/null +++ b/en/application-dev/faqs/faqs-third-party-library.md @@ -0,0 +1,7 @@ +# Usage of Third- and Fourth-Party Libraries + +## What does the following error message mean: "Stage model module... does not support including OpenHarmony npm packages or modules in FA model. OpenHarmony build tasks will not be executed, and OpenHarmony resources will not be packed." + +Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 + +The third- and fourth-party libraries are not yet compatible with the stage model of API version 9 and cannot be used. -- GitLab