Version: 1.7
语言 : 中文
Integrating Tuanjie into OpenHarmony applications
Building and delivering for OpenHarmony

Specify OpenHarmony Player command-line arguments

A use-case for extending the OpenHarmony ability is to pass command-line arguments when you launch the OpenHarmony Player. For information on the available command-line arguments, refer to Command-line argument.

You can specify command-line arguments in the following ways:

  • In DevEco: If you open your project in DevEco Studio, you can pass startup command-line arguments to Tuanjie through Launch Flags in Run/Debug Configurations dialog using the following words.

    --ps unity "<command_line_arguments>"
    
  • Via OpenHarmony Device Connector (HDC): You can pass command-line arguments by launching an OpenHarmony application via hdc by using the following code.

    hdc shell aa start -a <abilityName> -b <bundleName> --ps unity "<command_line_arguments>"
    
  • The following example shows how to pass -force-vulkan command-line argument to your application.

    hdc shell aa start -a TuanjiePlayerAbility -b com.Company.MyGame --ps unity " -force-vulkan"
    

If the “<command_line_arguments>” starts with the hyphen -, it is necessary to place a blank space at the beginning of the command_line arguments. For example, to pass -force-vulkan command-line argument to your application.

 hdc shell aa start -a TuanjiePlayerAbility -b com.Company.MyGame --ps unity "-force-vulkan"

should be written as:

 hdc shell aa start -a TuanjiePlayerAbility -b com.Company.MyGame --ps unity " -force-vulkan"

to avoid the parameter “-force-vulkan” from being recognized as an option.

Integrating Tuanjie into OpenHarmony applications
Building and delivering for OpenHarmony