目录

Creating an Application Multi-Instance

Multi-instance allows an application to run on multiple processes 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.

Multiple application instances 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.

Relationship between multiple application instances:

Constraints

Application multi-instance can run on only 2-in-1 devices.

How to Develop

  1. Configure the multi-instance.

    Configure the multiAppMode field in the App/app.json5 configuration file in the project. The code snippet is as follows:

    {
      "app": {
        // ...
        "multiAppMode": {
          "multiAppModeType": "multiInstance",
          "maxCount": 5
        }
      }
    }
  2. Create a multi-instance.