tencent cloud

Feedback

Operation mechanism

Last updated: 2024-07-12 17:58:08

    1. Mini programme life cycle

    From the time a mini program is started to the time it is finally destroyed, it will go through a variety of states and behave differently in different states.
    

    1.1 Mini program startup

    There will be two kinds of mini programs, one is cold start and the other is hot start;
    Hot start: the process of switching a mini program running in the background to the foreground when the user wants to reopen the opened mini program after a certain period of time;
    Cold start: when the user opens the mini program for the first time or reopens the mini program after it has been actively destroyed by the host application, at this time, the mini program needs to be reloaded and started, i.e. cold start.

    1.2 Frontend/Backend State

    After the mini program starts, the user can directly see the interface of the mini program, at this time the mini program is in the foreground state.
    When the user clicks the app control button in the upper right corner to "close" the mini program or presses the Home button on the mobile phone to leave the host application, the mini program is not destroyed but runs in the background, at this time, the mini program can still be run briefly for a short period of time, but the use of some APIs will be restricted.
    The ways to cut the background include but not limited to the following:
    Tap the capsule button in the upper right corner to leave the mini program;
    iOS left from the left side of the screen right slide to leave the mini program;
    Android tap the back button to leave the mini program;
    Cut the host app directly to the background when the mini program is running in the foreground (gesture or Home button);
    Locking the screen directly when the mini program is running in the foreground.
    When the user enters the client again and opens the mini program, the mini program will run from the background to the foreground.

    1.3 Mini program destruction mechanism

    If the user has not used the mini program for a long time, or the system resources are strained, the mini program will be "destroyed", i.e. completely terminated. Specifically, it includes the following situations:
    When the mini program enters the background and is "hung", if it does not enter the foreground again for a long time (currently 30 minutes), the mini program will be destroyed.
    When a mini program takes up too much system resources, it may be destroyed by the system or recycled by the host app.
    On iOS system, when the host app continuously receives system memory alarms within a certain time interval, it will actively destroy the mini program according to a certain strategy and prompt the user to re-open the mini program for lack of running memory.
    Specific strategies will be continuously adjusted and optimised.

    2. Mini program opening logic

    2.1 Cold start opening page

    When a mini program is cold started, the page will be opened in the following cases;
    If the startup scene does not have path, it goes to the home page;
    If the starting scene has a path, it will go to the page with the corresponding path.

    2.2 Open page in hot launch

    When the mini program is launched, the page will be opened in the following cases;
    If there is no path in the scene, it will keep the last viewed page;
    If the scene is with path, reLaunch to the page with corresponding path.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support