A page management method, apparatus, storage medium, and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2026-08-14
AI Technical Summary
然而,这种跨应用操作在返回逻辑上可能出现偏差,因两个应用独立维护页面栈,导致用户无法按预期路径回退
[0034]借由上述技术方案,本发明提供的一种页面管理方法、装置、存储介质及电子设备,在目标应用启动小程序的情况下,创建第一小程序活动实例及相应的第一页面管理器,以使第一页面管理器生成并管理小程序初始的第一小程序页面,再将第一小程序页面添加至小程序的第一模拟页面栈;将第一小程序活动实例加入至目标应用的系统返回栈,以响应于用户触发的回退操作,在系统返回栈中回退至第一小程序活动实例时,按照第一模拟页面栈中的当前小程序页面排序依次还原页面;在小程序进行内部页面跳转的情况下,判断系统返回栈的栈顶活动实例类型,在栈顶活动实例类型为原生活动实例的情况下,创建第二小程序活动实例及相应的第二页面管理器,以使第二页面管理器生成并管理小程序进行内部跳转后的第二小程序页面,再将第二小程序页面添加至小程序的第二模拟页面栈;将第二小程序活动实例加入至系统返回栈,以响应于用户触发的回退操作,在系统返回栈中回退至第二小程序活动实例时,按照第二模拟页面栈中的当前小程序页面排序依次还原页面;响应于用户触发的回退操作,按照系统返回栈中的当前活动实例排序依次还原页面。本发明通过在目标应用中创建小程序的活动实例和页面管理器,实现小程序页面的模拟栈管理,并将小程序活动实例纳入系统返回栈,从而形成一个统一的返回路径,确保了用户在进行跨应用操作时,能够按预期顺序回退,维护操作路径的完整性与一致性。
Smart Images

Figure CN121009245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of application technology, and more particularly to a page management method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the development of mobile applications, many medium and large apps have begun to integrate mini-programs to quickly implement independent functions, such as events, group buying, and meeting booking. This approach allows developers to reduce the frequency of updates to the host app, thereby enabling rapid iteration.
[0003] Given current technological requirements, users expect to open mini-programs within the host app and access the host app's functional pages from within the mini-program. However, this cross-application operation may encounter discrepancies in the return logic, as the two applications maintain their own page stacks independently, preventing users from navigating back along the expected path.
[0004] Therefore, how to solve the problem of cross-application page stack management and ensure the integrity and consistency of user operation paths has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of the above problems, the present invention provides a page management method, apparatus, storage medium, and electronic device that overcomes or at least partially solves the above problems, the technical solution of which is as follows:
[0006] A page management method, comprising:
[0007] When the target application launches a mini program, a first mini program activity instance and a corresponding first page manager are created so that the first page manager generates and manages the initial first mini program page of the mini program, and then the first mini program page is added to the first simulated page stack of the mini program.
[0008] The first mini-program activity instance is added to the system back stack of the target application in response to the user-triggered back operation. When returning to the first mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0009] When the mini-program performs an internal page jump, determine the type of the active instance at the top of the system's return stack;
[0010] If the activity instance type at the top of the stack is a native activity instance, a second mini-program activity instance and a corresponding second page manager are created so that the second page manager generates and manages the second mini-program page after the mini-program performs an internal jump. Then, the second mini-program page is added to the second simulated page stack of the mini-program.
[0011] The second mini-program activity instance is added to the system back stack in response to the user-triggered back operation. When returning to the second mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack.
[0012] In response to a user-triggered back operation, the pages are restored sequentially according to the current active instances in the system's back stack.
[0013] Optionally, the method further includes:
[0014] When the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack in response to the user-triggered back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0015] Optionally, after the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack, the method further includes:
[0016] When the mini-program performs another internal page jump and the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the fourth mini-program page after the mini-program performs another internal jump, and adds the fourth mini-program page to the first simulated page stack in response to the user-triggered back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0017] Optionally, after the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack, the method further includes:
[0018] When the mini-program opens the first native page of the target application, a first native activity instance is created and added to the system back stack. In response to a user-triggered back operation, the page is restored sequentially according to the current activity instances in the system back stack.
[0019] Optionally, after adding the first native activity instance to the system back stack, the method further includes:
[0020] When the mini-program performs an internal page jump and the activity instance type at the top of the stack is a native activity instance, a third mini-program activity instance and a corresponding third page manager are created so that the third page manager generates and manages the fifth mini-program page after the mini-program performs an internal jump, and then the fifth mini-program page is added to the third simulated page stack of the mini-program.
[0021] The third mini-program activity instance is added to the system back stack in response to a user-triggered back operation. When returning to the third mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the third simulated page stack.
[0022] Optionally, after adding the second mini-program activity instance to the system back stack, the method further includes:
[0023] When the mini-program opens the second native page of the target application, a second native activity instance is created and added to the system back stack. In response to a user-triggered back operation, the page is restored sequentially according to the current activity instances in the system back stack.
[0024] Optionally, each mini-program activity instance can share the runtime environment of the mini-program.
[0025] A page management device includes: a first active instance creation unit, a first active instance push unit, a stack top active instance type determination unit, a second active instance creation unit, a second active instance push unit, and a page rollback unit.
[0026] The first activity instance creation unit is used to create a first mini program activity instance and a corresponding first page manager when the target application launches the mini program, so that the first page manager generates and manages the initial first mini program page of the mini program, and then adds the first mini program page to the first simulated page stack of the mini program.
[0027] The first activity instance push unit is used to add the first mini-program activity instance to the system back stack of the target application in response to the user-triggered back operation. When backing to the first mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0028] The stack top activity instance type determination unit is used to determine the type of the activity instance at the top of the system return stack when the mini-program performs an internal page jump;
[0029] The second activity instance creation unit is used to create a second mini-program activity instance and a corresponding second page manager when the activity instance type at the top of the stack is a native activity instance, so that the second page manager generates and manages the second mini-program page after the mini-program performs internal navigation, and then adds the second mini-program page to the second simulated page stack of the mini-program.
[0030] The second activity instance push unit is used to add the second mini-program activity instance to the system back stack in response to the user-triggered back operation. When backing to the second mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack.
[0031] The page back unit is used to respond to a user-triggered back operation and restore the page sequentially according to the current active instance in the system back stack.
[0032] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the page management method described above.
[0033] An electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the page management method.
[0034] By means of the above technical solution, the present invention provides a page management method, apparatus, storage medium, and electronic device. When a target application launches a mini-program, a first mini-program activity instance and a corresponding first page manager are created. The first page manager generates and manages the initial first mini-program page, and then adds the first mini-program page to the mini-program's first simulated page stack. The first mini-program activity instance is added to the target application's system back stack in response to user-triggered back operations. When navigating back to the first mini-program activity instance from the system back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack. When the mini-program performs internal page navigation, the system back stack determines... The invention establishes a unified return path by creating a mini-program activity instance and a corresponding second page manager at the top of the return stack. If the top-level activity instance is a native activity instance, a second mini-program activity instance and a corresponding second page manager are created. This second page manager generates and manages the second mini-program page after an internal jump, and then adds the second mini-program page to the mini-program's second simulated page stack. The second mini-program activity instance is also added to the system return stack in response to user-triggered back operations. When navigating back to the second mini-program activity instance in the system return stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack. This invention achieves simulated stack management of mini-program pages by creating mini-program activity instances and page managers within the target application, and by incorporating mini-program activity instances into the system return stack. This forms a unified return path, ensuring that users can navigate back in the expected order when performing cross-application operations, maintaining the integrity and consistency of the operation path.
[0035] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0036] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0037] Figure 1 A diagram illustrating the principle analysis of stack return disorder provided in an embodiment of the present invention is shown.
[0038] Figure 2 A flowchart illustrating one embodiment of the page management method provided by this invention is shown.
[0039] Figure 3 A flowchart illustrating another implementation of the page management method provided in this invention is shown.
[0040] Figure 4 A schematic diagram illustrating the principle analysis of the page management method provided in an embodiment of the present invention is shown;
[0041] Figure 5 A schematic diagram of the structure of the page management device provided in an embodiment of the present invention is shown;
[0042] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention is shown. Detailed Implementation
[0043] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0044] With the rapid development of mobile applications (Apps), more and more medium and large-sized applications are integrating mini-programs to achieve specific independent functions, such as event functions, group buying, and meeting booking. This approach allows developers to quickly implement functions without frequently updating the host App, thus enabling rapid iteration and deployment.
[0045] Many capabilities of mini-programs rely on interfaces and functions provided by the host app. For example, common function pages such as the camera page and personal information can be developed as shared modules by the host app for mini-programs to call. In this way, mini-program developers do not need to implement the same functions repeatedly and can directly reuse the existing page logic and user interaction experience of the host app. For example, on the Android platform, an app's page is usually composed of activity instances, and multiple activities form a page stack (or back stack) to record the user's operation path. In contrast, Android mini-programs usually have only one activity, and their pages are managed by their own page manager (PageManager). The PageManager is responsible for manipulating fragments or views, recording user operations within them to simulate the system's page stack.
[0046] In certain scenarios, users may want to open a mini-program within the host app and then access a specific function page of the host app from the mini-program. This interaction requires flexible navigation between the two page stacks while maintaining the integrity of the user's operation path. It should allow users to reverse the page stack when performing a back navigation, ensuring the continuity of the operation logic and the consistency of the user experience. Specifically, the user's operation flow can be represented as: App1 → Mini1 → App2 → Mini2, where "App" represents the host application and "Mini" represents the mini-program.
[0047] However, the current implementation cannot support such complex page stack transitions, especially when the mini-program needs to call a single function page of the host application. Under the current technical framework, the logic of the back operation may deviate when the user interacts between the mini-program and the host application. This is because in the Android environment, mini-programs are considered relatively independent applications, and their interaction logic is similar to cross-application operations. For example, when application A opens a page of mini-program B, and then mini-program B opens a page of application A in return, if the user presses the back button, they should logically return from mini-program B to the entry point of application A. However, since both maintain their own page stacks independently, inconsistent behavior may occur when returning due to differences in stack structure.
[0048] like Figure 1 As shown in the diagram, this invention provides a principle analysis diagram of stack return disorder. State ① in the diagram illustrates that when the host app launches the mini-program, it creates the mini-program's page manager and pushes its simulated stack onto the host app's system page stack. If the user selects "back," they will correctly return to the host app's homepage. State ② in the diagram illustrates that within the mini-program, if the user opens a page in the host app (e.g., App-Page1) and then opens another page in the mini-program (Mini-Page2) from that page, the system stack will simultaneously contain both the host app's page and the mini-program's simulated stack. State ③ in the diagram illustrates that when the user clicks "back," the system prioritizes processing the mini-program's simulated stack instead of returning to the host app's page. The user will return to Mini-Page1 instead of the expected App-Page1. This is because the mini-program's return logic takes precedence over the host app's return logic, leading to disorder during the return process.
[0049] Based on this, this embodiment of the invention provides a page management method. When the target application launches a mini-program, an activity instance and a page manager for the mini-program are first created to generate and manage the initial page, which is then added to the mini-program's simulated page stack. Simultaneously, the activity instance is added to the target application's system back stack, forming an overall structure containing both the mini-program and the target application's activity instance. When navigating within the mini-program, the type of the instance at the top of the back stack is determined. If it is an instance of the target application, a new mini-program activity instance and manager are created, a new page is generated, and added to its simulated page stack. Similarly, this new mini-program activity instance is added to the back stack so that when the user triggers a back operation, the pages can be restored sequentially according to the order in the back stack and the simulated page stack. Therefore, this invention achieves simulated stack management of mini-program pages and incorporates them into the system back stack, thereby ensuring accurate recording and reverse reconstruction of the user's operation path during complex interactions, maintaining the integrity and consistency of the operation path.
[0050] like Figure 2 The diagram shows a flowchart of one embodiment of the page management method provided by this invention. The method may include:
[0051] S200. When the target application launches the mini-program, create a first mini-program activity instance and a corresponding first page manager, so that the first page manager generates and manages the initial first mini-program page of the mini-program, and then adds the first mini-program page to the first simulated page stack of the mini-program.
[0052] The target application refers to the main application that the user is currently using, within which the mini-program can be launched, providing an environment for interaction with the mini-program.
[0053] In this context, a mini-program refers to a lightweight application that runs within the target application. Mini-programs have independent functions and interfaces, but can share some resources with the target application.
[0054] Among them, a mini-program activity instance refers to a specific running activity instance (Activity) created for a mini-program, which is equivalent to a running window of the mini-program.
[0055] The PageManager is used to manage all pages in the corresponding simulated page stack, including page creation, destruction, display, and hiding.
[0056] The mini-program page is a specific interface associated with the corresponding mini-program activity instance, through which users interact with specific functions of the mini-program.
[0057] The simulated page stack is a data structure maintained by the page manager to record the hierarchical relationship between pages in the mini-program. It simulates the history of the mini-program's pages to support navigation between pages and user back actions.
[0058] Specifically, in this embodiment of the invention, when the target application launches the mini-program, a first mini-program activity instance and a corresponding first page manager are first created. The first page manager generates and manages the initial page of the mini-program and adds it to the first simulated page stack of the mini-program to maintain the history of the mini-program page, so that users can easily navigate and return within the mini-program.
[0059] S210. Add the first mini-program activity instance to the system back stack of the target application in response to the user-triggered back operation. When returning to the first mini-program activity instance in the system back stack, restore the pages in the order of the current mini-program pages in the first simulated page stack.
[0060] The system back stack manages the history of activities within the application. When a user navigates through the application, each time a new page or activity is opened, the current activity is pushed onto the stack, creating a traceable back path. When the user clicks the back button, the activities are popped out sequentially according to the stack order, allowing the user to return to the previous page.
[0061] Specifically, in this embodiment of the invention, the first mini-program activity instance is added to the system back stack of the target application so that the previous activity instance can be traced when the user performs a back operation. When the user returns to the first mini-program activity instance in the system back stack, the previous page state will be restored sequentially according to the current order of the mini-program pages in the first simulated page stack, thereby facilitating reverse rollback according to the cross-application call path.
[0062] S220. When the mini-program performs internal page navigation, determine the type of the active instance at the top of the system's return stack.
[0063] S230. When the activity instance type at the top of the stack is a native activity instance, create a second mini-program activity instance and a corresponding second page manager so that the second page manager can generate and manage the second mini-program page after the mini-program performs an internal jump, and then add the second mini-program page to the second simulated page stack of the mini-program.
[0064] In this context, a native activity instance refers to a specific running activity instance within the target application, used to display the user interface provided by the target application and handle user interactions. Each native activity instance can independently manage its own UI (User Interface) state and lifecycle, representing a specific function or view within the application.
[0065] Internal page navigation refers to the navigation process between different pages within a mini-program. When users interact with a mini-program, they may need to access different functions or information. By using internal page navigation, users can switch between different pages within the mini-program without exiting or restarting it.
[0066] The "top activity instance type" refers to the category of the activity instance currently at the top of the system's back stack. The top activity instance can be a native activity instance or a mini-program activity instance.
[0067] Specifically, when a mini-program navigates to an internal page, it first determines the type of the current top-of-stack activity instance in the system's back stack. If the top-of-stack activity instance is a native activity instance, a second mini-program activity instance and its corresponding second page manager are created. Next, the second page manager is responsible for generating and managing the newly navigated second mini-program page and adding it to the mini-program's second simulated page stack. Because the target application's interface was opened before navigating to the second mini-program page, a separate second mini-program activity instance and corresponding second page manager are generated for the second mini-program page. This ensures that when the second mini-program activity instance is subsequently added to the system back stack, it is positioned above the corresponding native activity instance, facilitating reverse navigation according to cross-application call paths.
[0068] S240. Add the second mini-program activity instance to the system back stack in response to the user-triggered back operation. When returning to the second mini-program activity instance in the system back stack, restore the pages in the order of the current mini-program pages in the second simulated page stack.
[0069] Specifically, in this embodiment of the invention, the second mini-program activity instance is added to the system back stack of the target application. At this time, the order in the system back stack can be "second mini-program activity instance → native activity instance → first mini-program activity instance → native activity instance (target application homepage)". When the user goes back to the second mini-program activity instance in the system back stack, the previous page state will be restored in sequence according to the current order of the mini-program pages in the second simulated page stack, which helps to reverse back according to the cross-application call path.
[0070] S250, In response to a user-triggered rollback operation, restore the pages sequentially according to the current active instances in the system's back stack.
[0071] Specifically, in this embodiment of the invention, the most recent active instance in the system's back stack will be found, and the page state previously accessed by the user will be restored step by step in the recorded order. This ensures that the user can reverse back along the cross-application call path, thereby maintaining the continuity of the operation logic and the consistency of the user experience.
[0072] This invention provides a page management method, comprising: when a target application launches a mini-program, creating a first mini-program activity instance and a corresponding first page manager, so that the first page manager generates and manages the initial first mini-program page, and then adding the first mini-program page to the mini-program's first simulated page stack; adding the first mini-program activity instance to the target application's system back stack in response to a user-triggered back operation; when navigating back to the first mini-program activity instance in the system back stack, restoring the pages sequentially according to the current mini-program page order in the first simulated page stack; and when the mini-program performs an internal page jump, determining the liveness of the top of the system back stack. In the case of a native activity instance at the top of the stack, a second mini-program activity instance and a corresponding second page manager are created. This allows the second page manager to generate and manage the second mini-program page after an internal navigation within the mini-program. The second mini-program page is then added to the mini-program's second simulated page stack. The second mini-program activity instance is also added to the system back stack in response to user-triggered back operations. When navigating back to the second mini-program activity instance from the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack. This invention achieves simulated stack management of mini-program pages by creating mini-program activity instances and page managers within the target application, and by incorporating mini-program activity instances into the system back stack, thus forming a unified back path. This ensures that users can navigate back in the expected order when performing cross-application operations, maintaining the integrity and consistency of the operation path.
[0073] Optional, based on Figure 2 The method shown is as follows: Figure 3 As shown, this is a flowchart illustrating another embodiment of the page management method provided by the present invention. The method may further include:
[0074] S300. When the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack in response to the user-triggered back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0075] Specifically, in this embodiment of the invention, when the activity instance type at the top of the stack is a mini-program activity instance, since both consecutive page jumps are to mini-program pages, the first page manager will generate and manage a new third mini-program page and add it to the first simulated page stack. At this time, the order in the first simulated page stack is "third mini-program page → first mini-program page". When the user triggers a back operation, the first mini-program activity instance will be searched in the system back stack, and the previous pages will be restored sequentially according to the order of the first simulated page stack, that is, backing up from the third mini-program page to the first mini-program page, thereby ensuring that the user can smoothly trace back their historical browsing path.
[0076] By maintaining the order of the mini-program pages in the first simulated page stack, this embodiment of the invention can effectively record every step of the user's operation, so that when the user goes back, they can go back in the expected order, thereby maintaining the integrity and consistency of the operation path and improving the user experience.
[0077] Optionally, in the above Figure 3 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, after the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack, the method may further include:
[0078] If the mini-program performs another internal page jump and the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the fourth mini-program page after the mini-program performs another internal jump, and adds the fourth mini-program page to the first simulated page stack in response to the user's back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored in order according to the current mini-program page order in the first simulated page stack.
[0079] Specifically, in this embodiment of the invention, when the activity instance type at the top of the stack is a mini-program activity instance, since the three consecutive page jumps are all mini-program pages, the first page manager will generate and manage a new fourth mini-program page and add the fourth mini-program page to the first simulated page stack. At this time, the order in the first simulated page stack is "fourth mini-program page → third mini-program page → first mini-program page". When the user triggers a back operation, the first mini-program activity instance will be searched in the system back stack, and the previous pages will be restored sequentially according to the order of the first simulated page stack. That is, first back to the third mini-program page from the fourth mini-program page, and then back to the second mini-program page, thereby ensuring that the user can perform reverse back according to the cross-application call path, thus maintaining the continuity of the operation logic and the consistency of the user experience.
[0080] Optionally, in the above Figure 3 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, after the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack, the method may further include:
[0081] When the first native page of the target application is opened in the mini program, a first native activity instance is created and added to the system back stack. In response to the user's back operation, the page is restored in sequence according to the current activity instance in the system back stack.
[0082] Specifically, in this embodiment of the invention, when the first native page of the target application is opened in the mini-program, a corresponding first native activity instance is created for the first native page opened this time, and the first native activity instance is added to the system back stack. At this time, the order in the system back stack is "first native activity instance → first mini-program activity instance → native activity instance (target application homepage)". When the user triggers the back operation, the user first goes back from the first native page to the mini-program page in the first simulated page stack corresponding to the first mini-program activity instance, and then goes back to the target application homepage. This ensures that the user can perform reverse back according to the cross-application call path, thereby maintaining the continuity of the operation logic and the consistency of the user experience.
[0083] Optionally, in this embodiment of the invention, after adding the first native activity instance to the system back stack, a third mini-program activity instance and a corresponding third page manager can be created when the mini-program performs an internal page jump and the activity instance at the top of the stack is a native activity instance. This allows the third page manager to generate and manage the fifth mini-program page after the mini-program performs an internal jump, and then add the fifth mini-program page to the mini-program's third simulated page stack. The third mini-program activity instance is added to the system back stack in response to a user-triggered back operation. When the user returns to the third mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the third simulated page stack.
[0084] It is understood that this part can be referred to in the description of steps S230 and S240, and will not be repeated here.
[0085] Optionally, in the above Figure 2 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, after adding the second mini-program activity instance to the system back stack, the method may further include:
[0086] When the second native page of the target application is opened in the mini program, a second native activity instance is created and added to the system back stack. In response to the user's back operation, the page is restored in order according to the current activity instance in the system back stack.
[0087] Specifically, in this embodiment of the invention, when the second native page of the target application is opened in the mini-program, a corresponding second native activity instance is created for the opened second native page, and the second native activity instance is added to the system back stack. The order in the system back stack at this time is "second native activity instance → second mini-program activity instance → native activity instance → first mini-program activity instance → native activity instance (target application homepage)". When the user triggers a back operation, the user first goes back from the second native page to the mini-program page in the second simulated page stack corresponding to the second mini-program activity instance, then back to the native activity instance, then back to the mini-program page in the first simulated page stack corresponding to the first mini-program activity instance, and finally back to the target application homepage. This ensures that the user can perform reverse backtracking according to the cross-application call path, thereby maintaining the continuity of the operation logic and the consistency of the user experience.
[0088] Optionally, in the above Figure 2 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, each mini-program activity instance shares the runtime environment of the mini-program.
[0089] This invention establishes a runtime environment sharing mechanism among multiple mini-program activity instances, enabling the reuse of the JavaScript engine (jsEngine), API interface module (jsApi), and memory data area already initialized by the first mini-program activity instance when multiple subsequent mini-program activity instances are created. This shared runtime environment ensures that the page back operation can correctly restore the JavaScript execution context when inserting a mini-program activity instance into the system back stack, making the back path of multi-level hybrid navigation meet user expectations.
[0090] To facilitate understanding of the overall scheme of the page management method provided in the embodiments of the present invention, this section combines... Figure 4 For example: Figure 4 The diagram illustrates the principle of the page management method provided in this embodiment of the invention. After the host app opens the mini-program, it first creates the mini-program's Activity and PageManager to manage the mini-program's pages. At this stage, the mini-program's initial page (e.g., Mini-Page1) is created and managed by the PageManager. When the mini-program's Activity is pushed onto the stack, the host app's back stack will contain two Activities, ensuring the user can normally return to the mini-program's previous state. When navigating between pages within the mini-program, the activity instance at the top of the stack is checked first. If the top of the stack is the mini-program's Activity, a new page (e.g., Mini-Page2) is created and added to the simulated stack, ensuring a smooth page navigation process. When the top of the stack is a native page, the mini-program needs to enter the page management sub-process. In this sub-process, a new Activity and PageManager are created. At this time, the mini-program's runtime environment (e.g., jsEngine and jsApi) is still shared, ensuring consistent runtime performance even when navigating between different native interfaces. The final system back stack will look like this. Figure 4 As shown in the bottom left corner, ensure that each page (mini-program and host app) can be navigated in the normal order.
[0091] Although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.
[0092] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0093] Corresponding to the above method embodiments, this invention also provides a page management device, the structure of which is as follows: Figure 5 As shown, it may include: a first activity instance creation unit 10, a first activity instance push unit 20, a stack top activity instance type judgment unit 30, a second activity instance creation unit 40, a second activity instance push unit 50, and a page back unit 60.
[0094] The first activity instance creation unit 10 is used to create a first mini-program activity instance and a corresponding first page manager when the target application launches the mini-program, so that the first page manager generates and manages the initial first mini-program page of the mini-program, and then adds the first mini-program page to the first simulated page stack of the mini-program.
[0095] The first activity instance push unit 20 is used to add the first mini-program activity instance to the system back stack of the target application in response to the user-triggered back operation. When going back to the first mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0096] The stack top activity instance type determination unit 30 is used to determine the type of the activity instance at the top of the system return stack when the mini-program performs internal page navigation.
[0097] The second activity instance creation unit 40 is used to create a second mini-program activity instance and a corresponding second page manager when the activity instance type at the top of the stack is a native activity instance, so that the second page manager can generate and manage the second mini-program page after the mini-program performs internal navigation, and then add the second mini-program page to the second simulated page stack of the mini-program.
[0098] The second activity instance push unit 50 is used to add the second mini-program activity instance to the system back stack in response to the user-triggered back operation. When backing to the second mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack.
[0099] Page back unit 60 is used to respond to a user-triggered back operation and restore the page sequentially according to the current active instance in the system back stack.
[0100] Optionally, the page management device may also include: a first mini-program page push unit.
[0101] The first mini-program page push unit is used to generate and manage the third mini-program page after the mini-program performs an internal jump when the activity instance type at the top of the stack is a mini-program activity instance. The third mini-program page is added to the first simulated page stack in response to the user-triggered back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored in the order of the current mini-program pages in the first simulated page stack.
[0102] Optionally, the page management device may also include a second mini-program page push unit.
[0103] The second mini-program page push unit is used after the first mini-program page push unit generates and manages the third mini-program page after the mini-program performs an internal jump in the first page manager and adds the third mini-program page to the first simulated page stack. When the mini-program performs another internal page jump and the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the fourth mini-program page after the mini-program performs another internal jump and adds the fourth mini-program page to the first simulated page stack. In response to the user-triggered back operation, when the system returns to the first mini-program activity instance in the back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
[0104] Optionally, the page management device may further include: a third active instance creation unit and a third active instance stacking unit.
[0105] The third activity instance creation unit is used by the first mini-program page stack unit to generate and manage the third mini-program page after the mini-program performs an internal jump in the first page manager, and add the third mini-program page to the first simulated page stack. Then, when the mini-program opens the first native page of the target application, the first native activity instance is created.
[0106] The third activity instance push unit is used to add the first native activity instance to the system back stack in response to the user-triggered back operation, and restore the page in sequence according to the current activity instances in the system back stack.
[0107] Optionally, the page management device may further include: a fourth active instance creation unit and a fourth active instance stacking unit.
[0108] The fourth activity instance creation unit is used after the third activity instance push unit adds the first native activity instance to the system return stack. When the mini program performs an internal page jump and the activity instance at the top of the stack is a native activity instance, it creates a third mini program activity instance and a corresponding third page manager so that the third page manager can generate and manage the fifth mini program page after the mini program performs an internal jump. Then, the fifth mini program page is added to the mini program's third simulated page stack.
[0109] The fourth activity instance push unit is used to add the third mini-program activity instance to the system back stack in response to the user-triggered back operation. When going back to the third mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the third simulated page stack.
[0110] Optionally, the page management device may further include: a fifth active instance creation unit and a fifth active instance push unit.
[0111] The fifth activity instance creation unit is used to create a second native activity instance after the second activity instance push unit 50 adds the second mini-program activity instance to the system back stack, when the mini-program opens the second native page of the target application.
[0112] The fifth activity instance push unit is used to add the second native activity instance to the system back stack in response to the user-triggered back operation, and restore the page in the order of the current activity instances in the system back stack.
[0113] Optionally, each mini-program activity instance can share the mini-program's runtime environment.
[0114] This invention provides a page management device, which is used for: when a target application launches a mini-program, creating a first mini-program activity instance and a corresponding first page manager, so that the first page manager generates and manages the initial first mini-program page, and then adding the first mini-program page to the mini-program's first simulated page stack; adding the first mini-program activity instance to the target application's system back stack in response to a user-triggered back operation, and when returning to the first mini-program activity instance in the system back stack, restoring the pages sequentially according to the current mini-program page order in the first simulated page stack; and when the mini-program performs an internal page jump, determining that the top of the system back stack is active. In the case of a native activity instance at the top of the stack, a second mini-program activity instance and a corresponding second page manager are created. This allows the second page manager to generate and manage the second mini-program page after an internal navigation within the mini-program. The second mini-program page is then added to the mini-program's second simulated page stack. The second mini-program activity instance is also added to the system back stack in response to user-triggered back operations. When navigating back to the second mini-program activity instance from the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack. This invention achieves simulated stack management of mini-program pages by creating mini-program activity instances and page managers within the target application, and by incorporating mini-program activity instances into the system back stack, thus forming a unified back path. This ensures that users can navigate back in the expected order when performing cross-application operations, maintaining the integrity and consistency of the operation path.
[0115] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0116] The page management device includes a processor and a memory. The first active instance creation unit 10, the first active instance push unit 20, the stack top active instance type judgment unit 30, the second active instance creation unit 40, the second active instance push unit 50, and the page rollback unit 60 are all stored in the memory as program units. The processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0117] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, active instances and page managers for the mini-program can be created within the target application. This enables simulated stack management of the mini-program page and incorporates the mini-program active instance into the system back stack, forming a unified return path. This ensures that users can revert to the expected order when performing cross-application operations, maintaining the integrity and consistency of the operation path.
[0118] This invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the page management method.
[0119] This invention provides a processor for running a program, wherein the program executes the page management method during runtime.
[0120] like Figure 6 As shown, this embodiment of the invention provides an electronic device 1000, which includes at least one processor 1001, at least one memory 1002 connected to the processor 1001, and a bus 1003. The processor 1001 and the memory 1002 communicate with each other via the bus 1003. The processor 1001 is used to call program instructions in the memory 1002 to execute the aforementioned page management method. The electronic device in this document can be a server, PC, PAD, mobile phone, etc.
[0121] The present invention also provides a computer program product that, when executed on an electronic device, is suitable for executing a program with initialization page management method steps.
[0122] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0123] In a typical configuration, an electronic device includes one or more processors (CPUs), memory, and a bus. The electronic device may also include input / output interfaces, network interfaces, etc.
[0124] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM, and memory includes at least one memory chip. Memory is an example of computer-readable media.
[0125] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0127] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0128] In the description of this invention, it should be understood that if the terms "upper", "lower", "front", "rear", "left" and "right" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the position or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.
[0129] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0130] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0131] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the present invention.
Claims
1. A page management method, characterized in that, include: When the target application launches a mini program, a first mini program activity instance and a corresponding first page manager are created so that the first page manager generates and manages the initial first mini program page of the mini program, and then the first mini program page is added to the first simulated page stack of the mini program. The first mini-program activity instance is added to the system back stack of the target application in response to the user-triggered back operation. When returning to the first mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack. When the mini-program performs an internal page jump, determine the type of the active instance at the top of the system's return stack; If the activity instance type at the top of the stack is a native activity instance, a second mini-program activity instance and a corresponding second page manager are created so that the second page manager generates and manages the second mini-program page after the mini-program performs an internal jump. Then, the second mini-program page is added to the second simulated page stack of the mini-program. The second mini-program activity instance is added to the system back stack in response to the user-triggered back operation. When returning to the second mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack. In response to a user-triggered back operation, the pages are restored sequentially according to the current active instances in the system's back stack.
2. The method according to claim 1, characterized in that, Also includes: When the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack in response to the user-triggered back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
3. The method according to claim 2, characterized in that, After the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack, the method further includes: When the mini-program performs another internal page jump and the activity instance type at the top of the stack is a mini-program activity instance, the first page manager generates and manages the fourth mini-program page after the mini-program performs another internal jump, and adds the fourth mini-program page to the first simulated page stack in response to the user-triggered back operation. When the system returns to the first mini-program activity instance in the back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack.
4. The method according to claim 2, characterized in that, After the first page manager generates and manages the third mini-program page after the mini-program performs an internal jump, and adds the third mini-program page to the first simulated page stack, the method further includes: When the mini-program opens the first native page of the target application, a first native activity instance is created and added to the system back stack. In response to a user-triggered back operation, the page is restored sequentially according to the current activity instances in the system back stack.
5. The method according to claim 4, characterized in that, After adding the first native activity instance to the system back stack, the method further includes: When the mini-program performs an internal page jump and the activity instance type at the top of the stack is a native activity instance, a third mini-program activity instance and a corresponding third page manager are created so that the third page manager generates and manages the fifth mini-program page after the mini-program performs an internal jump, and then the fifth mini-program page is added to the third simulated page stack of the mini-program. The third mini-program activity instance is added to the system back stack in response to a user-triggered back operation. When returning to the third mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the third simulated page stack.
6. The method according to claim 1, characterized in that, After adding the second mini-program activity instance to the system back stack, the method further includes: When the mini-program opens the second native page of the target application, a second native activity instance is created and added to the system back stack. In response to a user-triggered back operation, the page is restored sequentially according to the current activity instances in the system back stack.
7. The method according to any one of claims 1 to 6, characterized in that, Each mini-program activity instance shares the runtime environment of the mini-program.
8. A page management device, characterized in that, include: The system comprises a first activity instance creation unit, a first activity instance push unit, a stack top activity instance type judgment unit, a second activity instance creation unit, a second activity instance push unit, and a page back unit. The first activity instance creation unit is used to create a first mini program activity instance and a corresponding first page manager when the target application launches the mini program, so that the first page manager generates and manages the initial first mini program page of the mini program, and then adds the first mini program page to the first simulated page stack of the mini program. The first activity instance push unit is used to add the first mini-program activity instance to the system back stack of the target application in response to the user-triggered back operation. When backing to the first mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the first simulated page stack. The stack top activity instance type determination unit is used to determine the type of the activity instance at the top of the system return stack when the mini-program performs an internal page jump; The second activity instance creation unit is used to create a second mini-program activity instance and a corresponding second page manager when the activity instance type at the top of the stack is a native activity instance, so that the second page manager generates and manages the second mini-program page after the mini-program performs internal navigation, and then adds the second mini-program page to the second simulated page stack of the mini-program. The second activity instance push unit is used to add the second mini-program activity instance to the system back stack in response to the user-triggered back operation. When backing to the second mini-program activity instance in the system back stack, the pages are restored sequentially according to the current mini-program page order in the second simulated page stack. The page back unit is used to respond to a user-triggered back operation and restore the page sequentially according to the current active instance in the system back stack.
9. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the page management method as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, The electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the page management method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
'Back' button in mobile applications
US20050114798A1
Multi-screen view and navigation for mobile applications
US20250181225A1