Acceleration method for first-time loading of embedded webpage of Android APP

By intercepting and caching web resource requests in Android apps, the initial loading of embedded web pages is accelerated through preloading URL lists, enhancing user experience and app performance.

CN119201281APending Publication Date: 2024-12-27BEIJING CHESHANGHUI SOFTWARE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411364778.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Existing methods for optimizing the initial loading of embedded web pages in Android apps, such as server-side gzip and CDN optimization, reach a speed limit and require further enhancement to improve user experience.

Method used

Modify the Webview code to intercept and cache web resource requests using a custom network framework, preloading URL lists into a server's memory database, and load resources from local cache during background access.

Benefits of technology

Reduces HTTP network requests and transmission time by caching web page resources, resulting in significantly faster subsequent load times and improved user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201281A_ABST
    Figure CN119201281A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of embedded webpages, and discloses an acceleration method for first-time loading of an Android APP embedded webpage, which comprises the following steps of: step 1, taking over http loading of resources, rectifying Webview codes and mechanisms, and intercepting and taking over http requests of webview resources by using own network framework; according to the resource file interception and cache takeover strategy of the Webview, through takeover of the memory and the disk cache of the Webview, before a user opens a web page, the web page is cached in the memory in advance, so that in the process that the user enters the Webview, the number of established http network requests and the transmission time are reduced, the resource file is directly loaded from the local memory cache, and the user experience is improved. The response speed of the webpage is improved; according to the scheme strategy and the core code of the timed task script, the timed task script is written on one mobile phone, and the script is enabled to run Webview uninterruptedly to access each web page; during the period, the script records a resource file url list required by each web page and uploads the resource file url list.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of embedded web pages, and specifically is a method for speeding up the first loading of an embedded web page in an Android APP. Background Art

[0002] Embedding a web page in an app means loading a web page through an embedded browser component in a native mobile application. This practice can be simply understood as providing a browser function within the app, allowing users to access web content directly in the app without having to jump to an external browser. This technology enables the app to display and interact with web content, thereby expanding the app's functionality and user experience. Through embedded web pages, the app can implement functional interfaces similar to those in HTML5, such as uploading, taking photos, maps, shaking, scanning, cards and coupons, etc., thereby creating applications with unique functions.

[0003] During the initial loading process of an embedded web page, server-side gzip or server-side CDN optimization is usually used for optimization. Although this reduces the traffic of the resource file HTTP network transmission, improves the loading speed and stores the resource files in an independent server in a city close to the user, which increases the speed at which users access the resource files, the compressed volume has a minimum and the acceleration ability is limited. After reaching a certain level, it can no longer be accelerated, so it needs to be improved. Summary of the invention

[0004] The purpose of the present invention is to provide a method for speeding up the first loading of an Android APP embedded web page, so as to solve the problems raised in the above-mentioned background technology.

[0005] In order to achieve the above object, the present invention provides the following technical solution: a method for speeding up the first loading of an embedded web page in an Android APP, comprising the following steps:

[0006] Step 1: Take over resource http loading

[0007] Modify the Webview code and mechanism, and use your own network framework to intercept and take over the http requests of webview resources;

[0008] Step 2: Get a list of web resources in advance

[0009] Write an app to access all web pages at a fixed time every day, use the above mechanism to record the URL list of all resources involved in the latest web page, and save it in the server's memory database;

[0010] Step 3: Enter app / a module and preload it immediately

[0011] Enter the request interface, obtain the URL list stored in the server, and then use the http framework described in the first step to access the URL list serially (speed-limited) in the background;

[0012] Step 4: Speed ​​up

[0013] When a user enters a web page of a certain module, since the resources of the web page have been cached in the disk buffer and the memory buffer in the third stage, the user will experience the accelerated effect.

[0014] Preferably, the http described in step 1 is a stateless protocol, and the http supports persistent connections.

[0015] Preferably, the Webview described in step one has a good network connection, and the Webview can realize the protection function.

[0016] Preferably, the network architecture described in step one is scalable, and the network architecture includes management tools and interfaces.

[0017] Preferably, the web page described in step 2 can realize an interception function, and the web page has a bandwidth limitation function.

[0018] Preferably, the URL list in step 2 has symbol restrictions, and the URL list has character length restrictions.

[0019] Preferably, the memory database described in step 2 can limit memory resources, and the memory database includes maximum and minimum server memory settings.

[0020] Preferably, the server described in step 2 is capable of implementing extended functions, and the server includes protocol requirements.

[0021] Preferably, the interface described in step five has permission restrictions, and the interface can implement a multi-inheritance function.

[0022] The beneficial effects of the present invention are as follows:

[0023] Webview's interception and cache takeover strategy for resource files, by taking over Webview's memory and disk cache, caches the web page in memory before the user opens it, so that when the user enters Webview, the number of http network requests and the transmission time are reduced, and resource files are directly loaded from the local memory cache, which improves the response speed of the web page; the solution strategy and core code of the scheduled task script, on a mobile phone, write a scheduled task script, and let the script run Webview and access various web pages uninterruptedly; during the period, the script will record the URL list of resource files required for each web page and upload it, so that after the app is opened, it can obtain the above resource file URL list and load the resource files of the URL into the local cache in advance. The above solution is effective for Apps that want to effectively improve the loading speed of embedded web pages, and can effectively improve user experience and product competitiveness. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is the timing task script diagram of the present invention;

[0025] Figure 2 It is the preloaded resource file diagram of the present invention;

[0026] Figure 3 Part of the core code of this invention Figure 1 ;

[0027] Figure 4 Part of the core code of the present invention Figure 2 . DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] like Figure 1-4 As shown, an embodiment of the present invention provides a method for speeding up the first loading of an embedded web page in an Android APP, comprising the following steps:

[0030] Step 1: Take over resource http loading

[0031] Modify the Webview code and mechanism, and use your own network framework to intercept and take over the http requests of webview resources;

[0032] Step 2: Get a list of web resources in advance

[0033] Write an app to access all web pages at a fixed time every day, use the above mechanism to record the URL list of all resources involved in the latest web page, and save it in the server's memory database;

[0034] Step 3: Enter app / a module and preload it immediately

[0035] Enter the request interface, obtain the URL list stored in the server, and then use the http framework in the first step to access the URL list serially (speed-limited) in the background;

[0036] Step 4: Speed ​​up

[0037] When a user enters a web page of a certain module, since the resources of the web page have been cached in the disk buffer and the memory buffer in the third stage, the user will experience the accelerated effect.

[0038] By taking over the memory and disk cache of Webview, the web page is cached in memory before the user opens it. When the user enters Webview, the number of http network requests and the transmission time can be reduced, and the resource files can be loaded directly from the local memory cache, thereby saving the CPU consumption and traffic of the mobile phone. At the same time, by writing a scheduled task script, the script can run Webview and access various web pages uninterruptedly; during this period, the script will record the URL list of resource files required for each web page and upload it. In this way, after the app is opened, when it obtains the above resource file URL list, the resource file of the URL is loaded into the local cache in advance, so that the speed of Webview loading the web page for the second time is significantly faster than the first loading.

[0039] Among them, the HTTP in step one is a stateless protocol, and HTTP supports persistent connections.

[0040] A stateless protocol means that the server does not retain any state when transacting with the client, which greatly reduces the server's memory burden and thus maintains a faster response speed. Supporting persistent connections significantly reduces request delays because the client does not need to renegotiate the connection after sending the first request.

[0041] Among them, the Webview in step one has a good network connection, and the Webview can realize the protection function.

[0042] Webview requires a network connection to ensure normal loading and display of web pages; the protection function enables Webview to defend against security issues such as cross-site scripting attacks and cross-site request forgery, thereby improving security.

[0043] Among them, the network architecture of step one is scalable, and the network architecture includes management tools and interfaces.

[0044] Scalability can accommodate more computers or devices to join the network; and management tools and interfaces enable administrators to easily manage and monitor nodes and links in the network to promptly discover and resolve problems.

[0045] Among them, the web page in step 2 can realize the interception function, and the web page has a bandwidth limitation function.

[0046] The interception function protects web pages from security threats such as malicious attacks and data leakage; while the restriction function can limit the default settings of the bandwidth, number of connections or connection timeout of client requests of the Web server to ensure that the server can effectively process requests and avoid service efficiency reduction due to excessive requests.

[0047] The URL list in step 2 has symbol restrictions, and the URL list has character length restrictions.

[0048] The character limit prohibits the use of meaningless characters, underscores, multiple slash characters and other special characters to ensure compliance with system requirements; while the length limit prevents excessively long URLs from affecting readability and engine searches.

[0049] Among them, the memory database in step 2 can limit the memory resources, and the memory database includes the maximum and minimum server memory settings.

[0050] Memory resource limits ensure that the server has enough RAM to support database operations. Insufficient memory may cause performance degradation or system crashes. Server memory settings avoid resource contention caused by setting it too high, or performance or even failure to start if it is set too low.

[0051] Among them, the server in step 2 can realize the extended function, and the server includes the protocol requirements.

[0052] Scalability avoids the situation where the server is unable to cope with the increase in the number of users and is eliminated in a short period of time; and the protocol requirements ensure that the communication data between the server and the client is not stolen or tampered with, protecting the security of data transmission and improving user experience and security.

[0053] Among them, the interface of step five has permission restrictions, and the interface can realize the function of multiple inheritance.

[0054] Permission restrictions mean that methods in an interface can only have public permissions and cannot use modifiers such as private and protected so that other classes can implement or use these methods; the multiple inheritance feature allows an interface to inherit the characteristics of multiple other interfaces, thereby forming a richer interface definition.

[0055] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0056] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for speeding up the first loading of an Android APP embedded web page, characterized in that: The following steps are involved: Step 1: Take over resource http loading Modify the Webview code and mechanism, and use your own network framework to intercept and take over the http requests of webview resources; Step 2: Get a list of web resources in advance Write an app to access all web pages at a fixed time every day, use the above mechanism to record the URL list of all resources involved in the latest web page, and save it in the server's memory database; Step 3: Enter app / a module and preload it immediately Enter the request interface, obtain the URL list stored in the server, and then use the http framework described in the first step to access the URL list serially (speed-limited) in the background; Step 4: Speed ​​up When a user enters a web page of a certain module, since the resources of the web page have been cached in the disk buffer and the memory buffer in the third stage, the user will experience the accelerated effect.

2. According to claim 1, a method for speeding up the first loading of an Android APP embedded web page is characterized in that: The http described in step 1 is a stateless protocol, and the http supports persistent connections.

3. According to claim 1, a method for speeding up the first loading of an Android APP embedded web page is characterized in that: The Webview described in step 1 has a good network connection, and the Webview can realize the protection function.

4. According to claim 1, a method for speeding up the first loading of an Android APP embedded web page is characterized in that: The network architecture described in step 1 is scalable and includes management tools and interfaces.

5. According to claim 1, a method for speeding up the first loading of an Android APP embedded web page is characterized in that: The web page described in step 2 can realize the interception function, and the web page has a bandwidth limitation function.

6. According to claim 1, a speed-up scheme for first loading of an Android APP embedded webpage, characterized in that: The URL list described in step 2 has symbol restrictions, and the URL list has character length restrictions.

7. According to claim 1, a method for speeding up the first loading of an Android APP embedded web page is characterized in that: The memory database described in step 2 can limit memory resources, and the memory database includes maximum and minimum server memory settings.

8. According to claim 1, a method for speeding up the first loading of an Android APP embedded web page is characterized in that: The server described in step 2 can implement extended functions, and the server includes protocol requirements.

9. A method for speeding up the first loading of an Android APP embedded web page according to claim 1, characterized in that: The interface described in step five has permission restrictions, and the interface can realize the function of multiple inheritance.