tencent cloud

Feedback

Operation Mechanism

Last updated: 2024-11-28 10:27:55

    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 ways for mini program startup, one is cold start and the other is hot start;
    Hot start: the process of switching a mini program running in the backend to the frontend 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.

    1.2 Frontend/Backend State

    After the mini program is started, the user can directly see the interface of the mini program, at this time the mini program is in the frontend 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 switch to the backend include but not limited to the following:
    Tap the capsule button in the upper right corner to leave the mini program;
    For iOS system, swipe right from the left side of the screen to leave the mini program;
    For Android system, tap the back button to leave the mini program;
    Switch the host app directly to the backend when the mini program is running in the frontend (gesture or Home button);
    Locking the screen directly when the mini program is running in the frontend.
    When the user enters the client again and opens the mini program, the mini program will run from the backend to the frontend.

    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 backend and is "hung", if it does not enter the frontend 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 Open the mini program when it is cold started

    When a mini program is cold started, the page of the mini program will be opened in the following cases;
    If there is no path in the startup scene, it will go to the home page;
    If there is the path in the startup scene, it will go to the page with the corresponding path.

    2.2 Open the mini program when it is hot started

    When the mini program is hot started, the page of the mini program will be opened in the following cases;
    If there is no path in the startup scene, it will keep the last viewed page;
    If there is the path in the startup scene, it will go to the page with the 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