harmony 鸿蒙Overview of Starting an Application of the Specified Type

  • 2025-06-06
  • 浏览 (2)

Overview of Starting an Application of the Specified Type

This topic describes how to implement application redirection by specifying an application type instead of a specific application. The following methods are available:

  • Using startAbilityByType to Start a Vertical Domain Panel: You can call the startAbilityByType API to start a vertical domain panel based on a specific business category, such as navigation, finance, email, flight, and express. The panel displays all the vertical applications available on the device, and users can choose to open one of them.
  • Using mailto to Redirect to an Email Application: The mailto protocol allows for the creation of hyperlinks linked to email addresses, enabling users to swiftly navigate to their email applications from hyperlinks present within websites or applications.
  • Using startAbility to Open a File: You can call the startAbility API to open a file of a specific type.

Using startAbilityByType to Start a Vertical Domain Panel

Working Principles

You can call the startAbilityByType API to start a vertical domain panel based on a specific business category, such as navigation, finance, and email. The panel displays all the vertical applications available on the device, and users can choose to open one of them.

The vertical domain panel provides secure and trusted applications available on the device, while reducing the access cost of the caller.

Matching Rules

The UIAbilityContext.startAbilityByType and UIExtensionContentSession.startAbilityByType APIs can be used to start a vertical domain panel based on the business category specified by the caller. The vertical applications available on the device are displayed on the panel.

Based on the type and wantParams.sceneType values passed in the startAbilityByType API, the system matches the target application that declares the corresponding linkFeature in the module.json5 file based on the following mappings.

Function Caller Application (Input Parameter of startAbilityByType) Target Application (Value of linkFeature in the Configuration File)
Route planning - type: navigation
- wantParams.sceneType: 1
RoutePlan
Navigation - type: navigation
- wantParams.sceneType: 2
Navigation
Place search - type: navigation
- wantParams.sceneType: 3
PlaceSearch
Transfer - type: finance
- wantParams.sceneType: 1
Transfer
Credit card repayment - type: finance
- wantParams.sceneType: 2
CreditCardRepayment
Email writing - type: mail
- wantParams.sceneType: 1
ComposeMail
Query flights by flight number - type: flight
- wantParams.sceneType: 1
QueryByFlightNo
Query flights based on origin and destination - type: flight
- wantParams.sceneType: 2
QueryByLocation
Express delivery query - type: express
- wantParams.sceneType: 1
QueryExpress

Using mailto to Redirect to an Email Application

You can create hyperlinks that link to email addresses through mailto, so that users can easily access email clients by touching the hyperlinks present within websites or applications. For details, see Using mailto to Start an Email Application.

Using startAbility to Open a File

You can call the startAbility API to search for an installed application that meets the requirements to open a specific type of file. For details, see Using startAbility to Start a File Application.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Ability Kit

harmony 鸿蒙Obtaining Reasons for Abnormal Application Exits

harmony 鸿蒙UIAbility Backup and Restore

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Introduction to Ability Kit

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model

harmony 鸿蒙Common action and entities Values (Not Recommended)

harmony 鸿蒙API Switching Overview

0  赞