### Ability Start Button Example Source: https://github.com/harmony-55/harmonyos_samples/blob/main/state-management/entry/src/main/resources/rawfile/AbilityGlobalDataSyncCode.ets.html This snippet shows a button configured to start a specific ability when clicked. It includes styling similar to other buttons and uses a custom function `startSpecifiedAbility` for initiating the ability. ```ArkTS Button() { Text($r('app.string.enter\_ability\_outofsync')) .fontColor(this.currentModelStatus ? $r('app.color.color\_white') : $r('app.color.button\_text\_color')) .fontSize(this.contentFontSize) .width('60%') .textAlign(TextAlign.Center) } .type(ButtonType.Capsule) .backgroundColor($r('app.color.button\_background\_color')) .padding($r('app.float.page\_padding')) .onClick(() \=> { startSpecifiedAbility('OutOfSyncAbility'); }) ``` -------------------------------- ### POST /api/wallet/environment/setup Source: https://github.com/harmony-55/harmonyos_samples/blob/main/wallet-kit-for-harmony-os_demo/readme_en.md Sets up the Wallet app's environment. This is crucial for ensuring the Wallet app is ready for use and guiding the user to install or configure it if necessary. ```APIDOC ## POST /api/wallet/environment/setup ### Description Sets up the Wallet app's environment. You should call this API to setup the Wallet app when you get the error code below from another API: Error code: 1010200002 - Wallet app not found. A dialog box will be displayed to guide the user to install the app. Error code: 1010200003 - The environment of the wallet is not ready. The Wallet app will be opened. The user needs to accept the privacy agreement of Wallet and log in with a Huawei ID. ### Method POST ### Endpoint /api/wallet/environment/setup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example (No request body) ### Response #### Success Response (200) - Returns a Promise that resolves with no value. #### Response Example (No response body on success) ### Error Handling - **1010200014** - The Wallet APIs can be called by the device owner only. - **1010200002** - Wallet app not found. - **1010200011** - Failed to initialize the environment. - **1010200013** - Operation failed because of an internal error. - **1010200017** - The Wallet app was closed by the user. ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/harmony-55/harmonyos_samples/blob/main/H5Launch/h5web/README.md Run this command to install all necessary project dependencies. ```bash npm install ``` -------------------------------- ### Install Pako and Types Source: https://github.com/harmony-55/harmonyos_samples/blob/main/pako-compression/README_EN.md Install the pako library and its type definitions using ohpm. Installing type definitions prevents import syntax errors. ```bash ohpm install pako ohpm install @types/pako --save-dev // Install @types/pako to prevent import syntax errors due to missing type declarations in the pako package. ``` -------------------------------- ### Query Asset Example (ArkTS) Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/Security/AssetStoreKit/AssetStoreArkTS/README.en.md Demonstrates how to query assets based on specific criteria. This example retrieves assets by name. ```ArkTS import asset from '@ohos.data.asset'; async function queryAsset() { let dataAbilityHelper = dataAbility.createDataAbilityHelper(ASSET_URI); let predicates = new dataAbility.DataAbilityPredicates(); predicates.equalTo("name", "asset_name"); let columns = ['name', 'data', 'description']; let result = await dataAbilityHelper.query(ASSET_URI, columns, predicates); console.info('query asset result: ' + JSON.stringify(result)); await result.close(); } ``` -------------------------------- ### Install Flask for Python Server Source: https://github.com/harmony-55/harmonyos_samples/blob/main/SmoothSwitchShortVideos/README.en.md Use pip to install the Flask framework for setting up the local video server. Ensure you have a Python environment available. ```bash pip install flask ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/harmony-55/harmonyos_samples/blob/main/fluent-news-homepage/README.en.md Commands to install required third-party libraries via CLI. ```bash ohpm install @ohos/pulltorefresh ohpm install @ohos/lottie ``` -------------------------------- ### Prefetch Data During Installation Source: https://github.com/harmony-55/harmonyos_samples/blob/main/cloud-foundation-kit_-sample-code_-arkts/README.en.md Obtain prefetched data specifically configured for application installation. Use the INSTALL_PREFETCH mode. ```typescript cloudResPrefetch.getPrefetchResult(cloudResPrefetch.PrefetchMode.INSTALL_PREFETCH) ``` -------------------------------- ### Start Video Recording Source: https://github.com/harmony-55/harmonyos_samples/blob/main/camera-data-collection/README.en.md Steps to stop the current session, add video output, and start recording. This involves removing any existing photo output before adding the video output. ```cpp SessionStop() SessionBegin() OH_CaptureSession_RemovePhotoOutput() CreatePhotoOutput() AddPhotoOutput() CreateVideoOutput() AddVideoOutput() SessionCommitConfig() SessionStart() VideoOutputRegisterCallback() ``` -------------------------------- ### Service Account Key File Example (JSON) Source: https://github.com/harmony-55/harmonyos_samples/blob/main/push-kit-service-sample-code-timeline-java/README.en.md This is an example of a service account key file used for authentication when calling Push Kit APIs. Ensure sensitive information is anonymized. ```json { "project_id": "*****", "key_id": "*****", "private_key": "-----BEGIN PRIVATE KEY-----\n**********************************==\n-----END PRIVATE KEY-----", "sub_account": "*****", "auth_uri": "https://oauth-login.cloud.huawei.com/oauth2/v3/authorize", "token_uri": "https://oauth-login.cloud.huawei.com/oauth2/v3/token", "auth_provider_cert_uri": "https://oauth-login.cloud.huawei.com/oauth2/v3/certs", "client_cert_uri": "https://oauth-login.cloud.huawei.com/oauth2/v3/x509?client_id=*****" } ``` -------------------------------- ### Configure and Start Camera Session Source: https://github.com/harmony-55/harmonyos_samples/blob/main/camera-data-collection/README.en.md Use these functions to configure the capture session by adding inputs and outputs, committing the configuration, and starting the session. Focus mode can be enabled during this process. ```cpp OH_CaptureSession_BeginConfig() OH_CaptureSession_AddInput() OH_CaptureSession_AddPreviewOutput() OH_CaptureSession_CommitConfig() OH_CaptureSession_Start() IsFocusMode() ``` -------------------------------- ### Setup Wallet Environment API Source: https://github.com/harmony-55/harmonyos_samples/blob/main/wallet-kit-for-harmony-os_demo/readme_cn.md This API is used to set up the Wallet app's environment. It's crucial for handling cases where the Wallet app is not found or its environment is not ready. The API returns a Promise that resolves with no value upon successful setup. ```APIDOC ## POST /api/wallet/environment ### Description Sets up the Wallet app's environment. This API should be called when encountering specific error codes related to the Wallet app's availability or readiness. ### Method POST ### Endpoint /api/wallet/environment ### Parameters No parameters are required for this request. ### Request Example ```json { "message": "Setting up wallet environment" } ``` ### Response #### Success Response (200) - **void** - Returns no value upon successful setup. ### Error Handling - **1010200014** - The Wallet APIs can be called by the device owner only. - **1010200002** - Wallet app not found. A dialog box will be displayed to guide the user to install the app. - **1010200011** - Failed to initialize the environment. - **1010200013** - Operation failed because of an internal error. - **1010200017** - The Wallet app was closed by the user. - **1010200003** - The environment of the wallet is not ready. The Wallet app will be opened. The user needs to accept the privacy agreement of Wallet and log in with a Huawei ID. ``` -------------------------------- ### Download Sample Project Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/PerformanceAnalysisKit/HiTrace/HitraceMeter_ArkTS/README_zh.md Git commands to initialize and sparse-checkout the specific sample directory. ```shell git init git config core.sparsecheckout true echo code/DocsSample/PerformanceAnalysisKit/HiTrace/HitraceMeter_ArkTS/ > .git/info/sparse-checkout git remote add origin https://gitcode.com/openharmony/applications_app_samples.git git pull origin master ``` -------------------------------- ### Download Sample Project Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/Security/RequestUserAuthorization/README.md Commands to initialize a sparse checkout and download the specific sample project from the repository. ```bash git init git config core.sparsecheckout true echo code/DocsSample/Security/RequsetUserAuthorization/ > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master ``` -------------------------------- ### Download Sample Code Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/CoreFile/AppFileBackup/README_zh.md Commands to initialize a git repository and sparse-checkout the specific sample directory. ```bash git init git config core.sparsecheckout true echo code/DocsSample/CoreFile/AppFileBackup > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master ``` -------------------------------- ### Define and Execute a Basic Unit Test Case Source: https://github.com/harmony-55/harmonyos_samples/blob/main/js-unit/README.en.md This example shows how to define a test case using `it()`, specify the ability to test with `Want()`, start the ability, and perform assertions. Remember to call `done()` to complete the test. ```typescript import { Want } from '@ohos.app.ability.want' import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry' import { expect } from '@ohos/hwj-quickjs' // Define a test case it('should start and verify the EntryAbility', (done) => { // Specify the ability to test const want: Want = { bundleName: 'com.samples.test.jsunit', abilityName: 'EntryAbility' }; // Start the specified ability abilityDelegatorRegistry.getAbilityDelegator.startAbility(want).then(() => { // Obtain the top-level ability object abilityDelegatorRegistry.getAbilityDelegator.getCurrentTopAbility().then((ability) => { // Add test content here // For example, check if the ability name is correct expect(ability.name).assertEqual('EntryAbility'); // Complete the test done(); }); }); }); ``` -------------------------------- ### Download HarmonyOS Sample Project with Git Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/HDRVivid/AVCodecVideo/README.en.md Use these Git commands to initialize a repository, configure sparse checkout, set the remote origin, and pull the master branch for the specified sample. ```bash git init git config core.sparsecheckout true echo HDRVivid/AVCodecVideo/ > .git/info/sparse-checkout git remote add origin https://gitee.com/harmonyos_samples/BestPracticeSnippets.git git pull origin master ``` -------------------------------- ### Install SwipePlayer Dependency Source: https://github.com/harmony-55/harmonyos_samples/blob/main/SwipePlayer/README.en.md Command to install the required third-party library for video sliding functionality. ```bash ohpm i @ hadss/swipeplayer ``` -------------------------------- ### Add Asset Example (ArkTS) Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/Security/AssetStoreKit/AssetStoreArkTS/README.en.md Demonstrates how to add a new asset using the Asset Store Kit. Ensure necessary permissions are granted before execution. ```ArkTS import asset from '@ohos.data.asset'; async function addAsset() { let dataAbilityHelper = dataAbility.createDataAbilityHelper(ASSET_URI); let assetInfo = { "name": "asset_name", "data": "asset_data", "description": "asset_description", "flags": 0 }; let result = await dataAbilityHelper.insert(ASSET_URI, assetInfo); console.info('add asset result: ' + result); } ``` -------------------------------- ### Install Hamock via OHPM Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/MultipleImage/oh_modules/@ohos/hamock/README.md Use the OpenHarmony Package Manager to install the Hamock library. ```bash ohpm install @ohos/hamock ``` -------------------------------- ### Start Decoder Threads Source: https://github.com/harmony-55/harmonyos_samples/blob/main/AVCodecVideo/README.en.md Starts the input and output threads for the decoder to begin the playback process. ```c Start(); ``` -------------------------------- ### Project Directory Structure Source: https://github.com/harmony-55/harmonyos_samples/blob/main/ability-start-mode/README.en.md Overview of the project file organization for the UIAbility launch mode sample. ```text ├──entry/src/main/ets/ │ ├──application │ │ └──MyAbilityStage.ets │ ├──common │ │ ├──Constants.ets // Constants │ │ ├──Logger.ts // Log utility │ │ └──Util.ets // Encapsulated common functions │ ├──entryability │ │ └──MainAbility.ets │ ├──model │ │ ├──DataModels.ets // Encapsulated data type │ │ ├──DataUtil.ets // Encapsulated data processing functions │ │ └──MokeData.ets // Simulation data │ ├──multitonability │ │ └──MultitonAbility.ets // Ability in multiton mode │ ├──pages │ │ ├──component │ │ │ └──FoodListItem.ets // Food list component │ │ ├──FoodDetail.ets // Food details page │ │ └──Home.ets // Home page │ ├──singletonability │ │ └──SingletonAbility.ets // Ability in singleton mode │ └──specifiedability │ └──SpecifiedAbility.ets // Ability in specified mode └──entry/src/main/resources // Static resources ``` -------------------------------- ### Get Trackable List Size Source: https://github.com/harmony-55/harmonyos_samples/blob/main/arengine_-sample-code_-clientdemo_cpp/README_EN.md Get the number of trackable objects in a given `AREngine_ARTrackableList`. This is useful for iterating through the list. ```c AREngine_ARStatus HMS_AREngine_ARTrackableList_GetSize(const AREngine_ARSession *session, const AREngine_ARTrackableList *trackableList, int32_t *outSize); ``` -------------------------------- ### Configure CMake for HarmonyOS Camera Sample Source: https://github.com/harmony-55/harmonyos_samples/blob/main/camera-data-collection/entry/src/main/cpp/CMakeLists.txt Sets up the project environment, includes header directories, and links essential HarmonyOS native libraries. ```cmake cmake_minimum_required(VERSION 3.5.0) project(CameraSample) set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) if(DEFINED PACKAGE_FIND_FILE) include(${PACKAGE_FIND_FILE}) endif() include_directories(${NATIVERENDER_ROOT_PATH} ${NATIVERENDER_ROOT_PATH}/include) add_library(entry SHARED main.cpp camera_manager.cpp) target_link_libraries(entry PUBLIC libohcamera.so libace_napi.z.so libnative_buffer.so libhilog_ndk.z.so librawfile.z.so) ``` -------------------------------- ### Get Augmented Image Extend Z Source: https://github.com/harmony-55/harmonyos_samples/blob/main/arengine_-sample-code_-clientdemo_cpp/README_EN.md Get the depth (extend along the Z-axis) of the detected augmented image. This value is in meters. ```c AREngine_ARStatus HMS_AREngine_ARAugmentedImage_GetExtendZ(const AREngine_ARSession *session, const AREngine_ARAugmentedImage *augmentedImage, float *outExtendZ); ``` -------------------------------- ### Download Project Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/Security/SecurityComponent/README.md Commands to clone the specific project sample from the Git repository. ```bash git init git config core.sparsecheckout true echo code/DocsSample/Security/SecurityComponent/ > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master ``` -------------------------------- ### Initialize and Use HandwriteComponent Source: https://github.com/harmony-55/harmonyos_samples/blob/main/pen-kit_-sample-code_-arkts/readme_cn.md Demonstrates how to import the Pen Kit module, initialize the controller, and implement the handwriting component within a component structure. ```ets import { HandwriteComponent, HandwriteController } from '@kit.Penkit'; @Entry @Component struct HandWritingComponent { controller: HandwriteController = new HandwriteController(); // 根据应用存储规则,获取到手写文件保存的路径,此处仅为实例参考 initPath: string = this.getUIContext().getHostContext()?.filesDir + '/aa'; aboutToAppear() { // 加载时设置保存动作完成后的回调。 this.controller.onLoad(this.callback); } // 手写文件内容加载完毕渲染上屏后的回调,通知接入用户,可在此处进行自定义行为 callback = () => { // 自定义行为,例如文件加载完毕后展示用户操作指导 } aboutToDisappear() { } build() { Row() { Stack({ alignContent: Alignment.TopStart }) { HandwriteComponent({ handwriteController: this.controller, onInit: () => { // 画布初始化完成时的回调。此时可以调用接口加载和显示笔记内容 this.controller?.load(this.initPath); }, onScale: (scale: number) => { // 画布缩放时的回调方法,将返回当前手写控件的缩放比例,可在此处进行自定义行为。 } }) Button("save") .onClick(async () => { //保存 const path = this.getUIContext().getHostContext()?.filesDir + '/aa'; await this.controller?.save(path); }) } .width('100%') } .height('100%') } } ``` -------------------------------- ### Get Augmented Image Extend X Source: https://github.com/harmony-55/harmonyos_samples/blob/main/arengine_-sample-code_-clientdemo_cpp/README_EN.md Get the width (extend along the X-axis) of the detected augmented image. This value is in meters. ```c AREngine_ARStatus HMS_AREngine_ARAugmentedImage_GetExtendX(const AREngine_ARSession *session, const AREngine_ARAugmentedImage *augmentedImage, float *outExtendX); ``` -------------------------------- ### Download Project via Git Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/ArkUI/Proper_Use_Layout/README_EN.md Commands to initialize a sparse checkout of the project repository. ```bash git init git config core.sparsecheckout true echo Proper_Use_Layout/ > .git/info/sparse-checkout git remote add origin https://gitee.com/harmonyos_samples/BestPracticeSnippets.git git pull origin master ``` -------------------------------- ### Get SDK API Version (JavaScript) Source: https://github.com/harmony-55/harmonyos_samples/blob/main/APILevelAdapt/README.md Use deviceInfo.sdkApiVersion and deviceInfo.distributionOSApiVersion to get the current system SDK version for compatibility checks. ```javascript import deviceInfo from '@ohos.deviceInfo' let sdkVersion = deviceInfo.sdkApiVersion; let distributionVersion = deviceInfo.distributionOSApiVersion; console.log('SDK Version: ' + sdkVersion); console.log('Distribution Version: ' + distributionVersion); ``` -------------------------------- ### Download Weather Sample Project Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/Weather/README.en.md Command sequence to initialize a sparse checkout and download the specific Weather sample project from the HarmonyOS samples repository. ```bash git init git config core.sparsecheckout true echo code/SuperFeature/MultiDeviceAppDev/Weather/ > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master ``` -------------------------------- ### Start Native Trace with HiTrace NDK Source: https://github.com/harmony-55/harmonyos_samples/blob/main/HiTraceMeterPrefTag/README.en.md Starts an asynchronous trace in native code using the HiTrace NDK. This requires linking against libhitrace_ndk.z.so. ```c #include "hitrace/hitrace_ndk.h" // ... OH_HiTrace_StartAsyncTrace("NativePerfTag", "", 1); // Your native code here OH_HiTrace_FinishAsyncTrace(1); ``` -------------------------------- ### Download Project via Git Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/AppPrivacyProtection/README.en.md Commands to initialize a sparse checkout for the specific project directory. ```bash git init git config core.sparsecheckout true echo AppPrivacyProtection/ > .git/info/sparse-checkout git remote add origin https://gitee.com/harmonyos_samples/BestPracticeSnippets.git git pull origin master ``` -------------------------------- ### Guide Users to Turn Off Minors Mode Source: https://github.com/harmony-55/harmonyos_samples/blob/main/accountkit-samplecode-clientdemo-arkts/readme_en.md Use minorsProtection.leadToTurnOffMinorsMode to guide users to disable youth mode. This offers a quick way for users to deactivate the feature. ```typescript minorsProtection.leadToTurnOffMinorsMode(); ``` -------------------------------- ### Configure Ability to Start Source: https://github.com/harmony-55/harmonyos_samples/blob/main/js-unit/README.md Configure the `Want` object to specify the unique ability to start, including `bundleName` and `abilityName`. This ensures the test targets the correct application component. ```typescript const want = { "bundleName": "com.samples.test.jsunit", "abilityName": "EntryAbility" }; ``` -------------------------------- ### CMake Project Setup Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/RationalUseOfFrontEndResources/entry/src/main/cpp/CMakeLists.txt Configures the minimum CMake version, project name, and root path. Includes conditional file inclusion and sets up include directories for the project. ```cmake cmake_minimum_required(VERSION 3.5.0) project(CppCrash) set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) if(DEFINED PACKAGE_FIND_FILE) include(${PACKAGE_FIND_FILE}) endif() include_directories(${NATIVERENDER_ROOT_PATH} ${NATIVERENDER_ROOT_PATH}/include) ``` -------------------------------- ### Get System Integrity Detection Result Source: https://github.com/harmony-55/harmonyos_samples/blob/main/DeviceSecurityKit_sampleCode_SafetyDetectDemo_ArkTS/readme_cn.md Call safetyDetect.checkSysIntegrity() to get the system integrity detection result for the current device. Ensure the device is connected to the network before running. ```typescript safetyDetect.checkSysIntegrity() ``` -------------------------------- ### Guide Users to Turn On Minors Mode Source: https://github.com/harmony-55/harmonyos_samples/blob/main/accountkit-samplecode-clientdemo-arkts/readme_en.md Use minorsProtection.leadToTurnOnMinorsMode to guide users to enable youth mode. This provides an entry point for users to quickly activate the feature. ```typescript minorsProtection.leadToTurnOnMinorsMode(); ``` -------------------------------- ### Download Project using Git Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/AppDataSecurity/README_EN.md Command to initialize a Git repository, configure sparse checkout, set the remote origin, and pull the project. ```bash git init git config core.sparsecheckout true echo AppDataSecurity/ > .git/info/sparse-checkout git remote add origin https://gitee.com/harmonyos_samples/BestPracticeSnippets.git git pull origin master ``` -------------------------------- ### Start an Ability for Testing Source: https://github.com/harmony-55/harmonyos_samples/blob/main/js-unit/README.md Initiate the specified ability using `abilityDelegatorRegistry.getAbilityDelegator().startAbility(want)`. This action is equivalent to manually running the application's ability. ```typescript abilityDelegatorRegistry.getAbilityDelegator().startAbility(want); ``` -------------------------------- ### Include Directories Setup Source: https://github.com/harmony-55/harmonyos_samples/blob/main/AudioToVideoSync/entry/src/main/cpp/CMakeLists.txt Defines the include paths for the native rendering components. Ensure these paths are correct relative to the source directory. ```cmake set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${NATIVERENDER_ROOT_PATH} ${NATIVERENDER_ROOT_PATH}/capbilities/include ${NATIVERENDER_ROOT_PATH}/common ${NATIVERENDER_ROOT_PATH}/common/dfx/err ${NATIVERENDER_ROOT_PATH}/common/dfx/log ${NATIVERENDER_ROOT_PATH}/render/include ${NATIVERENDER_ROOT_PATH}/player ) ``` -------------------------------- ### Guide Users to Turn On Youth Mode Source: https://github.com/harmony-55/harmonyos_samples/blob/main/account-kit-samplecode-clientdemo-for-atomicservice-arkts/readme_en.md Initiates the process to guide users to enable youth mode. This provides an entry point within the atomic service for users to quickly activate this feature. ```typescript minorsProtection.leadToTurnOnMinorsMode ``` -------------------------------- ### Define Sample Source Files Source: https://github.com/harmony-55/harmonyos_samples/blob/main/frame-generation-vulkan-samplecode-clientdemo-cpp/entry/src/main/cpp/CMakeLists.txt Lists all the source files for the sample application. Ensure all paths are correct relative to the CMakeLists.txt file. ```cmake set(sample_src_files asset/AassetImporter.cpp vulkan_utils/Blit.cpp vulkan_utils/Camera.cpp vulkan_utils/MainSceneRenderer.cpp vulkan_utils/UIRenderer.cpp vulkan_utils/Utils.cpp vulkan_utils/DescriptorPool.cpp vulkan_utils/CommandPool.cpp vulkan_utils/Buffer.cpp vulkan_utils/Image.cpp vulkan_utils/Device.cpp common/timer.cpp common/log.cpp begin/core.cpp begin/hellovk.cpp napi_init.cpp ) ``` -------------------------------- ### Configure Not Trusting User-Installed CA Certificates Source: https://github.com/harmony-55/harmonyos_samples/blob/main/BestPracticeSnippets/Privacy/privacy/src/main/ets/pages/Cybersecurity.md Disable trust for CA certificates manually installed by enterprise MDM systems or device administrators, as well as those installed by the current user. This enhances security by limiting the trusted certificate authorities. ```json { "network-security-config": { ... }, "trust-global-user-ca": false, "trust-current-user-ca": false } ``` -------------------------------- ### Project Structure Overview Source: https://github.com/harmony-55/harmonyos_samples/blob/main/DynamicComponent/README.md This snippet outlines the project structure for the dynamic component creation example. It details the organization of files within the entry directory, including components, pages, models, and views. ```plaintext ├───entry/src/main/ets │ ├───common │ │ └───TypeCasting.ets // 类型转换工具 │ ├───components │ │ ├───AdBuilder.ets // 广告组件的Builder │ │ ├───AdController.ets // 广告组件的Controller │ │ └───CardComponent.ets // 卡片组件 │ ├───entryability │ │ └───EntryAbility.ets // Ability的生命周期回调内容 │ ├───model │ │ ├───AdParams.ets // 广告组件参数 │ │ └───CardData.ets // 卡片参数 │ ├───pages │ │ ├───Index.ets // 应用入口 │ │ ├───MainPage.ets // 主页面 │ │ ├───TestCode.ets │ │ └───TitleBar.ets // 标题头 │ ├───segment │ │ ├───segment.ets │ │ ├───segment2.ets │ │ ├───segment3.ets │ │ ├───segment4.ets │ │ ├───segment5.ets │ │ └───segment6.ets │ └───view │ └───ImperativeView.ets // 动态生成页面案例 └───entry/src/main/resources // 应用静态资源目录 ``` -------------------------------- ### Download Project Repository Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/MindSporeLiteKit/MindSporeLiteCDemo/README_zh.md Instructions for cloning the project repository using Git, including sparse checkout configuration to download only the relevant demo directory. ```bash git init git config core.sparsecheckout true echo MindSporeLiteKit/MindSporeLiteCDemo/ > .git/info/sparse-checkout git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git git pull origin master ``` -------------------------------- ### Download Project Files Source: https://github.com/harmony-55/harmonyos_samples/blob/main/guide-snippets/CoreFile/UserFile/SelectingUserFiles/README_zh.md Use these Git commands to clone the specific project directory for the user file selection sample. ```bash git init git config core.sparsecheckout true echo code/DocsSample/CoreFile/UserFile/SelectingUserFiles > .git/info/sparse-checkout git remote add origin https://gitee.com/openharmony/applications_app_samples.git git pull origin master ``` -------------------------------- ### Install Git LFS Filter on Windows Command Prompt Source: https://github.com/harmony-55/harmonyos_samples/blob/main/xengine-samplecode-vulkan-temporal-upscale-demo-cpp/entry/src/main/cpp/3rdParty/ktx/README.md Installs the Git LFS smudge & clean filter for $Date$ keyword expansion on Windows using the Command Prompt. It requires git.exe to be in the system's PATH. It also forces a new checkout of affected files to apply the filter. ```cmd install-gitconfig.bat del TODO.md include/ktx.h tools/toktx/toktx.cpp git checkout TODO.md include/ktx.h tools/toktx/toktx.cpp ``` -------------------------------- ### Compile and Hot-Reload for Development Source: https://github.com/harmony-55/harmonyos_samples/blob/main/H5Launch/h5web/README.md Use this command to start the development server, which compiles the project and enables hot-reloading for faster development cycles. ```bash npm run serve ``` -------------------------------- ### Start Ability for Split-Screen Source: https://github.com/harmony-55/harmonyos_samples/blob/main/multi-ticket-class/README.md Initiates an in-app split-screen feature using UIAbilityContext.startAbility(). ```ets UIAbilityContext.startAbility() ```