harmony 鸿蒙Redirection Rules

  • 2023-02-03
  • 浏览 (563)

Redirection Rules

Generally, UI redirection within an application is triggered by users. However, an application can call startAbility() to implement UI redirection.

The PageAbility has a UI. It can use startAbility() to start an ability that has a UI and is visible to users.

The visible field under abilities in the config.json file specifies whether an ability can be started by other application components.

Table 1 Description of visible

Name Description Initial Value Allowed
visible Whether the ability can be called by other applications.
true: The ability can be called by any application.
false: The ability can be called only by other components of the same application.
Yes (initial value: false)

To enable an ability to be called by any application, configure the config.json file as follows:

{
  "module": {
    ...
    "abilities": [
      {
        "visible": "true",
        ...
      }
    ]
  }
}

If the ability contains skills, you are advised to set visible to true so that the ability can be implicitly started by other applications. If this attribute is set to false, the system returns PERMISSION_DENIED when other applications attempt to start the ability. In this case, a system application can request the START_INVISIBLE_ABILITY permission to start the ability. Example abilities with visible set to false are home screen, voice assistant, or search assistant.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Application Models

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Using Implicit Want to Open a Website

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model

harmony 鸿蒙AccessibilityExtensionAbility

harmony 鸿蒙Common action and entities Values

harmony 鸿蒙API Switching Overview

harmony 鸿蒙Switching of app and deviceConfig

0  赞