DEV Community

ZHZL-m
ZHZL-m

Posted on

【Journey of HarmonyOS Next】DevEco Studio User Guide (7)

Image description

1 -> Add a Page

In ArkTS projects, you can add Pages. A page is a page that represents an application/metaservice. The application/meta-service can be designed as multiple functional pages, each page performs separate file management, and the scheduling and management of the page can be implemented through routing APIs to achieve the decoupling of functions within the application. After adding a page to an ArkTS project, a new ets file will be generated in the pages folder.

  1. In the Stage project, select pages in the ets folder, right-click, and select New > Page, which provides the following page types:

Empty Page: creates a normal page to display the basic Hello World features.
Map Page: Create a map page to display the map view function, which is currently only available on mobile devices.
Payment Page: Create a payment page, which can be clicked to bring up the payment pop-up window, which is currently only supported for use in Phone devices;
IAP PAGE: IAP Kit scenario-based template that allows you to quickly create codes related to in-app payment to purchase virtual digital goods.

Image description

illustrate

In API 10 projects, only page creation is supported to display the basic Hello World function. If you want to use a scenario-based page template, switch the project to API 11 or later and develop it.

  1. Enter the Page name (consisting of uppercase and lowercase letters, digits, and underscores) and click Finish.

Image description

2 -> Import the sample project
DevEco Studio supports the import function of sample projects, which can be imported into DevEco Studio with one click by connecting with sample resources in the Gitee open source community.

This section describes how to import samples.

  1. On the welcome page of DevEco Studio, go to Customize > All Settings... > Version Control > Git page, click Test to check whether Git is installed.

illustrate

When you open a project, you can click File > Settings to enter the settings interface.

Installed, follow step 2 to start importing samples.

Image description

If it is not installed, please click Download and Install, and DevEco Studio will be downloaded and installed automatically. After the installation is complete, follow Step 2 to start importing the sample.

Image description

  1. On the Welcome page of DevEco Studio, click the More Action > Import Sample button on the Projects tab to import the Sample project.

illustrate

With the project open, you can click File > New > Import > Import Sample to import it.

Image description

  1. Select the sample project you want to import and click Next.

  2. Set the project name and project location, click Finish, and wait for the sample project to be imported.

Image description

  1. After importing the sample, wait for the project to be synchronized.

illustrate

If the network is restricted, and the message "Failed to connect to gitee.com port 443: Time out" message is displayed during import, please configure the Git proxy information.

3 -> Create an intent framework

DevEco Studio supports the creation of an intent framework to help applications understand user intent and provide corresponding services and experiences.

3.1 -> Usage Constraints

Support API 11 and above projects to create intent frameworks;
Only the HAP module of the Stage project can be used to create an intent framework.

3.2 -> Usage

  1. Select the module or the file under the module, and right-click the New > Insight Intent to enter the Intent Framework configuration page.

Intent domain: Intent domain.
Source entry name: the name of the entry code of the intent framework.
Intent Settings: Intent configuration. Take MusicDomain as an example:
PlayMusic: Enable/disable the PlayMusic Intent capability to play a song (specify a song). By default, you need to associate UIAbility, and you can select the ability to be associated with it from the Ability name drop-down list.
PlayMusicList: Enable/disable the PlayMusicList intent capability to play playlists (specify an entire playlist). By default, you need to associate UIAbility, and you can select the Ability to be associated in the Ability name drop-down list.
illustrate

PlayMusic and PlayMusicList do not support turning off at the same time, please select at least one intent.

Image description

  1. Click Finish to complete the intent frame creation. In this case, the entry code file will be generated in the entry > src > main > ets > insightintents directory. In the entry > src > main > resource > base > profile, generate a insight_intent.json file where you can view information about the current Intent Framework configuration.

Image description

Top comments (0)