DEV Community

Cover image for Splash Screen, Desktop Shortcut Menu, HAR Package View Display, Screen Recording Prohibition, Full-Screen Video Playback Switch
kouwei qing
kouwei qing

Posted on

Splash Screen, Desktop Shortcut Menu, HAR Package View Display, Screen Recording Prohibition, Full-Screen Video Playback Switch

[Daily HarmonyOS Next Knowledge] Splash Screen, Desktop Shortcut Menu, HAR Package View Display, Screen Recording Prohibition, Full-Screen Video Playback Switch

1. Where to configure the splash screen in HarmonyOS?

Where can the launch screen (the screen displayed when the app first starts) be configured?

Solution: Create a separate launch page and set it as the first page. The launch page uses a timer to jump to the main app page after a fixed display time. Modify the loadContent path in EntryAbility to change the app's entry file (e.g., set to SplashPage).

2. Must the desktop shortcut menu (3D Touch) in HarmonyOS be implemented via a configuration file?

Do the functions in the desktop shortcut menu (3D Touch) require a separate feature package? Since configuring corresponding functions requires binding the bundleName in the configuration file, does this mean that using these functions directly requires separate packaging? If implemented via a configuration file, can parameters be passed dynamically? Are there alternative methods for 3D Touch?

Solution: Implement via the shortcuts tag in module.json5.

Reference: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/module-configuration-file-V5

Check if floating windows meet the requirements: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/application-window-stage-V5

3. How to display views from a HAR package in a sub-window and pass parameters in HarmonyOS?

When using window.setUIContent to pass a path parameter for a view page in another HAR package module, what is the format for passing this path?

Solution: Add the path to the project's main_pages.json file.

Reference: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/application-window-stage-V5

4. How to prohibit screenshot or screen recording when users enter passwords/payment codes in HarmonyOS?

Solution: Refer to the following API: https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5#ZH-CN_TOPIC_0000001884757714__setwindowprivacymode9

Window Module Capabilities:

The window module provides basic capabilities for managing windows, including creation, destruction, property settings, and scheduling between windows. Key features include:

  • Window: The current window instance, the basic unit managed by the window manager.
  • WindowStage: The window manager, responsible for managing basic window units.

5. When playing a video in HarmonyOS, the screen rotates to the "habitual orientation" after entering full-screen. What does "habitual orientation" refer to?

Habitual orientation means the charging port faces right after full-screen playback:

window.getLastWindow(getContext(this), (err, win) => {
  win.setPreferredOrientation(window.Orientation.LANDSCAPE)
})
Enter fullscreen mode Exit fullscreen mode

Top comments (0)