• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Creating an Application Multi-Instance
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9Multi-instance allows an application to run on multiple pages so that a user can log in multiple accounts and run the application at the same time without affecting each other. For example, a user can run several social accounts, or primary and secondary game accounts simultaneously without frequent log-in and log-out.
10
11Multiple application process pages on the home screen are independent in terms of the running, notification, and more. Instances share data with each other and can be switched using accounts.
12
13Relationship between multiple application instances:
14- The application icons of multiple instances are the same.
15- Instances share data and can be switched using accounts.
16
17## Constraints
18
19Application multi-instance can run on only 2-in-1 devices.
20
21## How to Develop
221. Configure the multi-instance.
23
24    Configure the [multiAppMode](app-configuration-file.md#multiappmode) field in the **App/app.json5** configuration file in the project. The code snippet is as follows:
25    ```json
26    {
27      "app": {
28        //  ...
29        "multiAppMode": {
30          "multiAppModeType": "multiInstance",
31          "maxCount": 5
32        }
33      }
34    }
35    ```
36
372. Create a multi-instance.
38
39- Build and package the configured project and install it on the device.
40- Right-click an application icon on the home screen to open an application process. Then right-click the application icon again and choose **Open**.
41In this case, two application process pages of the same application are displayed on the home screen.
42