Android end network resource processing method and device, equipment and storage medium
By dynamically monitoring and adjusting network traffic in Android mobile applications, the problem of unreasonable bandwidth allocation is solved, and more efficient network resource utilization is achieved in financial applications, ensuring user experience and transaction stability.
Patent Information
- Application Number
- CN202411235671.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-06
AI Technical Summary
In the Android mobile application in the financial industry, network resource processing is complex and unreasonable allocation of bandwidth leads to slow web page loading speed and delayed data transmission, affecting the timeliness and accuracy of financial transactions. The traditional bandwidth processing method lacks flexibility and cannot Adapt to the needs of modern financial applications.
Monitor and upload network traffic through the Android system interface, calculate network traffic changes, determine the maximum bandwidth, and dynamically limit the bandwidth of resource downloads based on the web page loading status, giving priority to ensuring the smoothness of web page loading, relaxing bandwidth limits when the web page loading is completed, allowing Resource downloads use more bandwidth.
Dynamically adjust bandwidth allocation in complex network environments, improve network resource utilization efficiency, ensure user experience, reduce operation delays or failures, and improve the stability and response speed of financial services.
Smart Images

Figure CN119094477A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to an Android-side network resource processing method, device, equipment and storage medium. Background Art
[0002] In the digital wave of the financial industry, Android mobile applications have become the main entry point for users' daily financial activities. These applications support a wide range of financial services, from basic payments to complex investment management. However, with the increase in user demand and the increase in transaction frequency, the complexity of network resource processing has also increased. Especially in the mobile network environment, the effective allocation of bandwidth has become particularly important.
[0003] During peak trading hours, financial applications need to handle a large number of real-time requests simultaneously, including user trading operations, market data updates, and backend resource synchronization. Improper allocation of network bandwidth may lead to slow web page loading, data transmission delays, and even affect the timeliness and accuracy of financial transactions. For example, when users try to access their bank accounts during peak hours, if the page loads too slowly, it may cause users to abandon transactions or make operational errors, which in turn has a negative impact on customer satisfaction.
[0004] The network resource processing of Android mobile applications is particularly complex. Since users operate through mobile devices anytime and anywhere, the uncertainty of the network environment requires applications to be able to flexibly respond to changing bandwidth requirements. These applications often face challenges such as network environment fluctuations and network resource competition. They need to reasonably allocate bandwidth resources while ensuring user experience to ensure the smooth progress of key operations.
[0005] Currently, many financial institutions still rely on traditional bandwidth processing methods, which are often fixed and inflexible and cannot adapt to the needs of modern financial applications. This not only affects the user's operating experience, but may also bring more serious consequences, such as transaction delays and data synchronization failures. To this end, financial institutions urgently need to introduce a more dynamic and intelligent bandwidth processing solution to cope with the increasingly complex network environment and improve the stability and response speed of Android applications.
[0006] In short, the processing and optimization of network bandwidth is crucial to the success of Android financial applications. Financial institutions need to continuously innovate and optimize bandwidth processing technology to ensure that they can provide users with fast and reliable services under any network conditions, thereby enhancing market competitiveness, improving user satisfaction, and promoting sustainable business development. Summary of the invention
[0007] The main purpose of the present invention is to provide an Android-side network resource processing method, device, equipment and storage medium, aiming to solve the technical problem of how to realize intelligent processing and dynamic allocation of network resources on the Android side and avoid web page loading delay.
[0008] To achieve the above object, the present invention provides an Android-side network resource processing method, comprising:
[0009] Monitor the download network traffic and upload network traffic of each application through the Android system interface, record the total network traffic difference and time interval between each network resource request, and calculate the total network traffic change within the first preset time period based on the total network traffic difference and time interval;
[0010] Determine the maximum bandwidth of the network in the entire monitoring period according to the total network traffic change in the first preset time period;
[0011] Monitor the current usage status of network resources, including web page loading and resource downloading;
[0012] Determine whether there is a web page loading at present; if so, limit the network bandwidth used for resource downloading to within a preset ratio range of the maximum bandwidth; if not, do not limit the network bandwidth used for resource downloading.
[0013] In one embodiment, the download network traffic and upload network traffic of each application are monitored through the Android system interface, the total network traffic difference and the time interval between each network resource request are recorded, and the total network traffic change within the first preset time period is calculated based on the total network traffic difference and the time interval, including:
[0014] When the web page starts loading, use the onPageStarted callback method of WebView to record the initial network traffic of the application;
[0015] During the web page loading process, use the shouldInterceptRequest callback method of WebView to monitor web resource requests multiple times. Each time a request is monitored, the total network traffic of the current application is recorded, and the time interval between the previous request and the difference between the total network traffic of the application are calculated.
[0016] The total network traffic change within the first preset time period is determined based on the calculated total network traffic difference between two adjacent resource requests and the time interval.
[0017] In one embodiment, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth includes:
[0018] During the web page loading process, the network traffic consumption of each resource request is monitored and recorded in real time through the shouldInterceptRequest callback method.
[0019] Analyze and determine the type of the current web page in real time based on the accumulated network traffic consumption during web page loading;
[0020] According to the type of the current webpage, the network bandwidth used for resource downloading is dynamically limited within a preset ratio range of the maximum bandwidth.
[0021] In one embodiment, dynamically limiting the network bandwidth used for resource downloading within a preset ratio range of the maximum bandwidth according to the type of the current webpage includes:
[0022] Collecting historical network traffic data, and training a traffic prediction model based on the historical network traffic data;
[0023] During the webpage loading process, combining the type of the current webpage and the accumulated network traffic consumption, predicting the bandwidth demand of the current webpage within a second preset time period based on the traffic prediction model;
[0024] According to the predicted bandwidth demand of the current webpage within the second preset time period, the network bandwidth used for resource downloading is dynamically limited within a preset ratio range of the maximum bandwidth.
[0025] In one embodiment, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth includes:
[0026] During the web page loading process, the shouldInterceptRequest callback method of WebView is used to monitor each resource download request in real time;
[0027] When the download request of a certain resource is triggered more than the preset threshold number of times, the resource is marked as a critical resource;
[0028] A maximum bandwidth limit within a preset ratio range of the maximum bandwidth is allocated for downloading the key resource.
[0029] In one embodiment, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth includes:
[0030] During the web page loading process, use the shouldInterceptRequest callback method to monitor each resource download request in real time and record the bandwidth consumption of the request;
[0031] Calculate the cumulative bandwidth consumption of all resource downloads in real time, compare the cumulative bandwidth consumption with the preset ratio range of the maximum bandwidth, and determine whether the bandwidth usage of the current resource download exceeds the preset ratio range;
[0032] If so, reduce the amount of data read each time by the read method, thereby slowing down resource download speed and reducing bandwidth usage.
[0033] In one embodiment, determining whether a web page is currently being loaded includes:
[0034] Set a preset time interval as the monitoring timeout, start the timer when the web page starts loading, and monitor the callback time of the shouldInterceptRequest callback method;
[0035] Whenever a web page initiates a resource request, the shouldInterceptRequest callback method will be triggered, the time when the shouldInterceptRequest callback method is triggered will be recorded, and the timer will be reset;
[0036] If the shouldInterceptRequest callback method is triggered within the preset time interval of the timer, it is determined that a web page is currently being loaded;
[0037] If the timer reaches the preset time interval and the shouldInterceptRequest callback method is not triggered, it is determined that there is no web page loading currently.
[0038] Furthermore, to achieve the above-mentioned purpose, the present invention also provides an Android-side network resource processing device, comprising:
[0039] A network traffic monitoring module monitors the download network traffic and upload network traffic of each application through an Android system interface, records the total network traffic difference and time interval between each network resource request, and calculates the total network traffic change within a first preset time period based on the total network traffic difference and time interval;
[0040] A bandwidth calculation module determines the maximum bandwidth of the network in the entire monitoring period according to the total network traffic change in the first preset time period;
[0041] A resource usage status monitoring module monitors the current network resource usage status, including web page loading and resource downloading;
[0042] The bandwidth processing module determines whether there is a web page loading at present; if so, the network bandwidth used for resource download is limited to be within a preset ratio range of the maximum bandwidth; if not, the network bandwidth used for resource download is not limited.
[0043] Furthermore, to achieve the above-mentioned purpose, the present invention also provides an Android-side network resource processing device, which includes a memory, a processor, and an Android-side network resource processing program stored in the memory and executable on the processor, and the Android-side network resource processing program, when executed by the processor, implements the steps of the Android-side network resource processing method as described above.
[0044] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a computer storage medium, on which an Android-side network resource processing program is stored, and when the Android-side network resource processing program is executed by a processor, the steps of the Android-side network resource processing method as described above are implemented.
[0045] Beneficial effects: The present invention relates to an Android-side network resource processing method, which monitors the download and upload network traffic of each application in real time through the Android system interface, records the total traffic difference and time interval between each network resource request, and calculates the total network traffic change within the first preset time period based on this. According to the change, the maximum bandwidth in the entire monitoring cycle is determined, and by continuously monitoring the usage status of the current network resources, it is determined whether there is a web page loading. When the web page is loading, the bandwidth for resource downloading is limited to a preset proportion of the maximum bandwidth to give priority to ensuring the smoothness of web page loading; when the web page loading is completed or does not exist, the bandwidth restriction on resource downloading is relaxed, allowing it to use more bandwidth to speed up the download speed. The present invention can dynamically adjust bandwidth allocation in a complex network environment, improve the efficiency of network resource utilization, and ensure that users have a better experience when using key applications such as finance. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0047] Figure 1 This is a flow chart of an embodiment of a method for processing network resources on an Android device according to the present invention;
[0048] Figure 2 This is a functional module diagram of a preferred embodiment of the Android-side network resource processing device of the present invention;
[0049] Figure 3 This is a structural diagram of the device hardware operating environment involved in the Android-side network resource processing device embodiment of the present invention. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0051] It should be noted that in the digital wave of the financial industry, Android mobile applications have become the main entry point for users' daily financial activities. These applications support a wide range of financial services from basic payments to complex investment management. However, with the increase in user demand and the increase in transaction frequency, the complexity of network resource processing has also increased. Especially in the mobile network environment, the effective allocation of bandwidth has become particularly important.
[0052] During peak trading hours, financial applications need to handle a large number of real-time requests simultaneously, including user trading operations, market data updates, and backend resource synchronization. Improper allocation of network bandwidth may lead to slow web page loading, data transmission delays, and even affect the timeliness and accuracy of financial transactions. For example, when users try to access their bank accounts during peak hours, if the page loads too slowly, it may cause users to abandon transactions or make operational errors, which in turn has a negative impact on customer satisfaction.
[0053] The network resource processing of Android mobile applications is particularly complex. Since users operate through mobile devices anytime and anywhere, the uncertainty of the network environment requires applications to be able to flexibly respond to changing bandwidth requirements. These applications often face challenges such as network environment fluctuations and network resource competition. They need to reasonably allocate bandwidth resources while ensuring user experience to ensure the smooth progress of key operations.
[0054] Currently, many financial institutions still rely on traditional bandwidth processing methods, which are often fixed and inflexible and cannot adapt to the needs of modern financial applications. This not only affects the user's operating experience, but may also bring more serious consequences, such as transaction delays and data synchronization failures. To this end, financial institutions urgently need to introduce a more dynamic and intelligent bandwidth processing solution to cope with the increasingly complex network environment and improve the stability and response speed of Android applications.
[0055] In short, the processing and optimization of network bandwidth is crucial to the success of Android financial applications. Financial institutions need to continuously innovate and optimize bandwidth processing technology to ensure that they can provide users with fast and reliable services under any network conditions, thereby enhancing market competitiveness, improving user satisfaction, and promoting sustainable business development.
[0056] See also Figure 1 , Figure 1This is a flow chart of an embodiment of an Android-side network resource processing method provided by the present invention. It should be noted that although a logical sequence is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0057] like Figure 1 As shown, the Android end network resource processing method proposed by the present invention includes the following steps:
[0058] S10, monitoring the download network traffic and upload network traffic of each application through the Android system interface, recording the total network traffic difference and time interval between each network resource request, and calculating the total network traffic change within the first preset time period based on the total network traffic difference and time interval;
[0059] In this embodiment, the API interfaces provided by the Android operating system, such as TrafficStats.getTotalRxBytes() and TrafficStats.getTotalTxBytes(), are used to monitor the network activity of each application in real time. The system obtains the download traffic (number of bytes received) and upload traffic (number of bytes sent) of the application respectively to track the usage of network resources.
[0060] Every time an application sends a network resource request, the system will record the current network traffic (including downloads and uploads) and compare it with the last recorded traffic data to calculate the total traffic difference between the two requests. At the same time, the system will also record the time interval between the two requests in order to analyze the efficiency of network resource usage.
[0061] The system will calculate the changes in network traffic within a preset time period (such as 1 minute or 5 minutes) through the aforementioned traffic difference and time interval. This calculation helps to determine the current network bandwidth usage and trend, thereby providing data support for subsequent bandwidth processing and allocation.
[0062] In one specific implementation, in a financial transaction application, the system monitors the download and upload network traffic of each application through the Android system interface. Each time a network resource request is issued, the system records the current traffic data and calculates the traffic difference and time interval between the previous and next requests. The system uses this data to analyze the total traffic change within a first preset time period to determine the network bandwidth usage during the peak trading period. Then, based on the analysis results, the system can dynamically adjust the bandwidth allocation, prioritize the bandwidth of the transaction request, reduce delays, and improve the transaction success rate.
[0063] In another specific implementation, in an insurance claim application, the system monitors the network traffic when the user uploads claim materials and queries the claim status through the Android system interface. The system records the network traffic difference and time interval between each operation, and calculates the traffic change within the first preset time period. Based on these data, the system can adjust the bandwidth allocation strategy at different claim operation stages to ensure that the user has a higher bandwidth when uploading materials. After the data is uploaded, the system reallocates the bandwidth to other operations to optimize the use of overall network resources.
[0064] Through the above steps, the network resource usage of the Android side can be effectively monitored and processed, especially in financial applications. By recording and analyzing network traffic in real time, the system can dynamically adjust bandwidth allocation to ensure priority processing of key operations (such as transactions, payments, and uploads), and improve the overall network resource utilization efficiency. This method not only improves the accuracy of network resource processing, but also ensures the stability of the application and user experience in a complex network environment, and reduces operation delays or failures caused by network problems.
[0065] S20, determining the maximum bandwidth of the network in the entire monitoring period according to the total network traffic change in the first preset time period;
[0066] In this embodiment, based on the total network traffic change in the first preset time period, the system can calculate the peak traffic in this period and determine the maximum bandwidth in the entire monitoring period accordingly. Specifically, the system will identify the highest peak of traffic in this period by monitoring the changes in network traffic. This peak traffic represents the maximum demand for network resources in a specific time, and can therefore be used as the maximum bandwidth in the entire monitoring period.
[0067] In one specific implementation, the system monitors the download and upload network traffic of each application through the Android system interface. In this implementation, the system not only records the traffic difference and time interval, but also introduces a dynamic traffic prediction model, which predicts the traffic peak of the next period by analyzing the past traffic pattern. Then, the system dynamically adjusts the traffic monitoring of the preset time period according to the prediction results to ensure that bandwidth resources can be scheduled in advance during peak hours to avoid sudden traffic peaks from putting pressure on the system.
[0068] In another specific implementation, when monitoring network traffic, the system not only records the total traffic difference and time interval between each network resource request, but also combines traffic data with user behavior patterns. For example, the system analyzes the user's operating habits, such as transaction frequency and time period, and adjusts the monitoring strategy for the preset time period in combination with traffic changes. During periods when the user's transaction frequency is high, the system increases the monitoring frequency and shortens the time interval to more finely capture traffic changes, providing a more accurate basis for bandwidth allocation.
[0069] In other specific embodiments, the system determines the maximum bandwidth by calculating the total network traffic change within the first preset time period, and combines it with an intelligent traffic control mechanism. In this way, the system not only determines the maximum bandwidth based on historical traffic data, but also adjusts the upper limit of the network bandwidth in real time. This mechanism can dynamically increase or decrease the bandwidth limit to adapt to changes in the network environment. For example, when the network environment deteriorates, the system will automatically reduce the maximum bandwidth to maintain the stability of the network, and vice versa.
[0070] Through the above steps, the maximum bandwidth in the entire monitoring cycle can be accurately calculated, thereby optimizing the allocation of network resources. Different specific implementation methods are applied to different financial scenarios. By reasonably allocating bandwidth resources, priority processing of key tasks is ensured, and the system response speed and user experience are improved. At the same time, it can adapt to changes in the network environment, reduce operation delays or failures caused by insufficient bandwidth, and improve the stability and reliability of financial services.
[0071] S30, monitoring the usage status of current network resources, wherein the usage status includes web page loading and resource downloading;
[0072] In this embodiment, the real-time monitoring of the current network activities of the system specifically includes two main usage states: web page loading and resource downloading. The system obtains the real-time usage of network resources by monitoring these activities. Web page loading involves obtaining and rendering web page content, while resource downloading involves the transmission of files or data. Monitoring these usage states can help the system allocate bandwidth resources more accurately to optimize network performance.
[0073] In one specific implementation, the system uses a built-in monitoring module to prioritize bandwidth allocation to ensure fast presentation of web pages when a web page is detected to be loading. The system will periodically query the web page loading status and reallocate bandwidth resources to background resource download tasks after loading is complete. This approach ensures efficient loading of web pages and reduces user waiting time.
[0074] In another specific implementation, the system not only monitors web page loading and resource downloading, but also introduces a distinction between resource types. For example, the system will prioritize the web page content that the user is browsing, and for large file downloads, the traffic speed is limited in the background. In this way, the system can allocate bandwidth resources more intelligently, ensuring smooth foreground operations and efficient background operations.
[0075] In other embodiments, the system incorporates an intelligent traffic handling mechanism that can identify critical resource downloads (such as important updates or high-priority files) while monitoring web page loading and resource downloads. The system allocates more bandwidth to these critical resources, ensuring that important files are downloaded quickly even when web pages are loading. This approach improves the flexibility and adaptability of overall network resource handling.
[0076] Through the above steps, bandwidth resources can be allocated more accurately to ensure a balance between web page loading and resource downloading. Different specific implementation methods can adapt to different network environments and user needs by expanding and changing the original technical features, optimizing bandwidth usage, and improving system response speed and user experience. Not only can it maintain efficient operation of applications in complex network environments, but it can also dynamically adjust bandwidth allocation according to resource type and priority to improve network resource utilization efficiency.
[0077] S40, determining whether there is a web page currently being loaded; if so, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth; if not, not limiting the network bandwidth used for resource downloading.
[0078] In this embodiment, in the network resource processing, priority is given to ensuring the smoothness of web page loading. The system determines the bandwidth allocation for resource downloading by detecting the web page loading status. If the system detects that the web page is loading, it will limit the bandwidth for resource downloading so that it runs within the preset maximum bandwidth ratio range to ensure the speed and stability of web page loading. If it is detected that the web page is not loading, the system will cancel the bandwidth restriction so that the resource download can use more bandwidth to speed up the download speed.
[0079] In one specific implementation, the system determines the web page loading status through the onPageStarted and onPageFinished callback methods of WebView. If onPageStarted is triggered, the system will recognize that the web page loading is in progress, and immediately limit the bandwidth for resource downloads to 30%-50% of the maximum bandwidth to ensure that the web page content can be loaded quickly. When the onPageFinished method is triggered, indicating that the web page loading is complete, the system will lift the bandwidth restriction and allow the resource download task to use more bandwidth, such as 80%-100% of the maximum bandwidth.
[0080] In another specific implementation, the system combines real-time network traffic monitoring with web page loading status judgment. When the system detects that a large amount of network traffic is concentrated on the download of web page resources such as HTML, CSS and JavaScript, it will automatically identify that the web page is loading. At this time, the system will limit the speed of other resource downloads, limiting their use of 20%-40% of the maximum bandwidth. Once it is detected that the web page resource has been loaded and the network traffic has dropped, the system will automatically restore the bandwidth for resource downloads to 80%-100% of the maximum bandwidth to ensure the efficiency of resource downloads.
[0081] In other specific embodiments, the system uses an AI algorithm to predict the duration of web page loading, and dynamically adjusts it in combination with real-time monitored network traffic data. When AI predicts that it will take a long time for a web page to load (for example, more than 3 seconds), the system will immediately limit the resource download bandwidth to between 10%-30% of the maximum bandwidth when the web page loading begins to ensure smooth loading of the web page. As the web page loading nears completion, the system gradually relaxes the bandwidth limit for resource downloads until the limit is completely lifted. This gradual adjustment method can make full use of bandwidth resources and improve overall network utilization efficiency in the case of long web page loading times.
[0082] Through the above steps, the use of network resources can be effectively optimized, the web page loading speed can be increased, and the user experience can be improved. It can intelligently handle bandwidth allocation to ensure efficient operation in different network environments. It not only increases the priority of web page loading, but also makes full use of the remaining bandwidth after loading is completed, speeds up resource downloads, and achieves the best use of network resources.
[0083] The present invention relates to an Android-side network resource processing method, which monitors the download and upload network traffic of each application in real time through an Android system interface, records the total traffic difference and time interval between each network resource request, and calculates the total network traffic change within a first preset time period based on this. According to the change, the maximum bandwidth in the entire monitoring cycle is determined, and by continuously monitoring the usage status of the current network resources, it is determined whether there is a web page loading. When a web page is loading, the bandwidth for resource downloading is limited to a preset ratio range of the maximum bandwidth to give priority to ensuring the smoothness of web page loading; when the web page loading is completed or does not exist, the bandwidth restriction on resource downloading is relaxed, allowing it to use more bandwidth to speed up the download speed. The present invention can dynamically adjust bandwidth allocation in a complex network environment, improve network resource utilization efficiency, and ensure that users have a better experience when using key applications such as finance.
[0084] In one embodiment, the above S10 includes:
[0085] S101, when the webpage starts loading, using the onPageStarted callback method of WebView to record the initial network traffic of the application;
[0086] S102, during the web page loading process, using the shouldInterceptRequest callback method of WebView to monitor web page resource requests multiple times, recording the total network traffic of the current application each time a request is monitored, and calculating the time interval between the last request and the difference between the total network traffic of the application;
[0087] S103: Determine a change in total network traffic within a first preset time period based on a calculated total network traffic difference between two adjacent resource requests and a time interval.
[0088] In this embodiment, when the webpage starts to load, the onPageStarted method is triggered, and the system obtains and records the network traffic data of the application at this time through the Android interface, including the initial number of bytes downloaded and uploaded. This record serves as the reference point for subsequent traffic difference calculation.
[0089] During the web page loading process, every time the web page sends a resource request (such as images, scripts, etc.), the shouldInterceptRequest callback method will be triggered. The system will record the current total network traffic data at each request, compare it with the data of the previous request, and calculate the traffic difference.
[0090] The system records each resource request and the time interval between these requests. By comparing the traffic difference and time interval between two requests, the system can analyze the dynamic changes in network usage.
[0091] The system aggregates the traffic difference and time interval data calculated each time to determine the total traffic change within a preset time period (e.g., 1 minute). This data reflects the network bandwidth usage during web page loading.
[0092] In one specific implementation, the system records the initial network traffic through the onPageStarted method of WebView, and introduces a dynamic adjustment mechanism, which adjusts the subsequent traffic recording frequency based on the monitoring results of the previous network traffic. For example, if a large change in traffic is detected, the system will increase the recording frequency, and vice versa. Then, during the web page loading process, the traffic is monitored and the difference is calculated through the shouldInterceptRequest callback method. Within the preset time period, the system dynamically adjusts the maximum bandwidth according to the traffic changes, making the bandwidth allocation more accurate.
[0093] In another specific implementation, the system not only records the traffic difference for each resource request, but also calculates it in combination with the rate of traffic change. Using the initial traffic recorded by the onPageStarted method as a benchmark, the system calculates the traffic change rate (i.e., the traffic change per second) for each request when the shouldInterceptRequest callback method is triggered multiple times. Within a preset time period, the system determines whether it is necessary to adjust the bandwidth limit in advance based on the rate change. For example, when a substantial increase in the traffic rate is detected, the system can reduce the bandwidth for resource downloads in advance to ensure smooth web page loading.
[0094] In other specific embodiments, the system introduces a category differentiation mechanism when recording network traffic. The initial traffic recorded by the onPageStarted method includes not only the overall traffic, but is also subdivided into web page loading traffic and resource download traffic. Subsequently, when the shouldInterceptRequest callback method is triggered, the system records these two types of traffic separately and calculates their difference and time interval. Within the preset time period, the system will adjust the bandwidth allocation according to the changes in traffic of different categories. For example, when the web page loading traffic increases, the system will reduce the bandwidth for resource downloads, and vice versa.
[0095] Through the above steps, this embodiment can accurately monitor the traffic changes and time intervals of each resource request during the webpage loading process, thereby determining the total network traffic change within the first preset time period. This dynamic analysis method can effectively optimize the use of network bandwidth, improve webpage loading speed and resource download efficiency, especially in key business scenarios such as finance and insurance, significantly improving the system response speed and user experience.
[0096] In one embodiment, in the above S40, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth includes:
[0097] S401, during the web page loading process, the network traffic consumption of each resource request is monitored and recorded in real time through the shouldInterceptRequest callback method.
[0098] S402, analyzing and determining the type of the current web page in real time according to the accumulated network traffic consumption during the web page loading process;
[0099] S403: Dynamically limit the network bandwidth used for resource downloading within a preset ratio range of the maximum bandwidth according to the type of the current webpage.
[0100] In this embodiment, during the web page loading process, the system monitors the network traffic of all resource requests in real time through the shouldInterceptRequest callback method. Each time a request is triggered, the system records the network traffic data consumed by the request. This step ensures that the system can accurately grasp the bandwidth usage during web page loading and provide data support for subsequent bandwidth processing.
[0101] The system uses the accumulated and recorded network traffic consumption to analyze the types of resources required by web pages in real time (such as static web pages, dynamic web pages, video content, etc.). Based on different traffic patterns and consumption rates, the system can determine the type of the current web page and provide a basis for bandwidth allocation.
[0102] The system dynamically adjusts the bandwidth limit for resource downloads based on the analyzed web page type. For example, for dynamic web pages or video content with high bandwidth requirements, the system may strictly limit the download bandwidth of other resources to ensure smooth web page loading; while for simple static web pages, the bandwidth limit may be more relaxed to balance the speed of resource downloads.
[0103] In one specific implementation, the system introduces a bandwidth usage prediction algorithm when monitoring the traffic consumption of resource requests in real time. This algorithm predicts the bandwidth that may be required for the next resource request based on historical data and current traffic trends. Based on this prediction, the system pre-adjusts the resource download bandwidth limit each time the shouldInterceptRequest callback method is triggered. For example, if it is predicted that a large number of images will be loaded in the next web page, the system will limit the download bandwidth of other resources in advance to ensure smooth image loading.
[0104] In another specific implementation, the system uses a machine learning model to classify web page types in real time when analyzing the cumulative network traffic consumption. The system not only relies on simple traffic consumption patterns, but also uses more feature data, such as the type of resource request (video, image, script, etc.), response time, and even user behavior patterns. This model continuously learns and optimizes to improve the accuracy of web page type identification. For identified high-bandwidth demand web pages, the system will more strictly limit the download bandwidth of other resources.
[0105] In other specific implementations, the system adds a user priority strategy when dynamically limiting resource download bandwidth. In addition to considering the type of web page, the system also combines the user's historical operating habits and priority settings. For example, for important business users, the system will automatically increase the bandwidth priority of web page content when the web page is loaded, and limit the download of other resources to between 5% and 15% of the maximum bandwidth to ensure that the web page content of key users can be loaded quickly. For general users, the resource download bandwidth is allowed to be limited to between 30% and 50%.
[0106] Through the above steps, this embodiment can monitor the traffic consumption during web page loading in real time, accurately determine the web page type, and reasonably limit the bandwidth usage of resource downloads according to the bandwidth requirements of the web page. This not only ensures the priority and smoothness of web page loading, but also improves the efficiency of background resource downloads, significantly improving the overall user experience and system performance in a complex network environment.
[0107] In one embodiment, the above S403 includes:
[0108] S4031, dynamically limiting the network bandwidth used for resource downloading within a preset ratio range of the maximum bandwidth according to the type of the current webpage, including:
[0109] S4032, collecting historical network traffic data, and training a traffic prediction model according to the historical network traffic data;
[0110] S4033, during the webpage loading process, combining the type of the current webpage and the accumulated network traffic consumption, predicting the bandwidth demand of the current webpage within a second preset time period based on the traffic prediction model;
[0111] S4034: Dynamically limit the network bandwidth used for resource downloading within a preset ratio range of the maximum bandwidth according to the predicted bandwidth demand of the current webpage within a second preset time period.
[0112] In this embodiment, by recording and analyzing past network traffic data, the system can identify specific web page types and their corresponding bandwidth demand patterns. The system uses this data to train a traffic prediction model that can predict the bandwidth requirements of different types of web pages in the future.
[0113] During the webpage loading process, the system monitors the type of the current webpage and the accumulated network traffic consumption in real time, and inputs these data into the previously trained traffic prediction model. Based on the prediction results of the model, the system can estimate the bandwidth required for the webpage in the future (the second preset time period).
[0114] Based on the bandwidth demand predicted by the model, the system dynamically adjusts the bandwidth limit for resource downloads to ensure that web page loading can get priority bandwidth resource allocation. The bandwidth limit is within the maximum bandwidth ratio preset by the system to balance the bandwidth allocation for web page loading and resource downloads.
[0115] In one specific implementation, the system first collects network traffic data of different types of web pages during loading in the past, such as text-based web pages, image-intensive web pages, video content pages, etc. Based on this data, the system trains a traffic prediction model that can predict the bandwidth requirements of different types of web pages during web page loading. When a user starts loading a new web page, the system identifies the type of web page in real time and, combined with the current traffic consumption data, predicts the bandwidth requirements of the web page in the next few seconds. Based on the prediction results, the system limits the bandwidth for resource downloads to between 20% and 30% of the maximum bandwidth, giving priority to ensuring the loading speed of the web page.
[0116] In another specific embodiment, the system not only trains the traffic prediction model based on historical network traffic data, but also combines the user's historical behavior patterns (such as access time, frequency, preferences, etc.). The system is able to predict the bandwidth requirements of users accessing specific types of web pages in a specific time period. During the web page loading process, the system combines these historical behavior data with the current traffic consumption to predict the bandwidth requirements in the short term in the future. For example, during peak hours, the system may limit the bandwidth for resource downloads to 10%-20% of the maximum bandwidth to ensure that users get the best experience when browsing important content.
[0117] In other specific implementations, the system expands the functionality of the traffic prediction model, not only taking into account the type of web page and historical traffic data, but also introducing the impact of real-time network conditions (such as network delay, jitter, etc.). During the web page loading process, the system dynamically adjusts the parameters of the bandwidth prediction model according to the current network conditions, so that it can more accurately predict future bandwidth requirements. When the network conditions are good, the system may allow resource downloads to use a higher bandwidth (for example, 50%-60%), and when the network conditions are poor, the system limits the bandwidth to a lower range to ensure smooth web page loading.
[0118] Through the above steps, this embodiment can dynamically predict and adjust bandwidth allocation during web page loading, ensuring that web page loading speed is prioritized in a complex network environment. By optimizing the use of bandwidth resources, these technical solutions not only improve the system response speed and user experience, but also improve the overall network resource utilization efficiency and adapt to changing network conditions and user needs.
[0119] In one embodiment, in the above S40, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth includes:
[0120] S404, during the web page loading process, monitor each resource download request in real time through the shouldInterceptRequest callback method of WebView;
[0121] S405, when the download request of a certain resource is triggered more than a preset threshold number of times, the resource is marked as a critical resource;
[0122] S406: Allocate a maximum bandwidth limit within a preset ratio range of the maximum bandwidth for downloading the key resource.
[0123] In this embodiment, during the web page loading process, the system monitors the initiation of each resource download request in real time through the shouldInterceptRequest callback method of WebView. This method can intercept and process each resource download request, so that the system can instantly obtain relevant information about the resource request and monitor it.
[0124] When the number of download requests for a resource exceeds the preset threshold set by the system, the system will mark the resource as a critical resource. This indicates that the resource is more important to the user experience and needs to be downloaded first.
[0125] Once a resource is marked as a critical resource, the system will allocate it a maximum bandwidth limit within a preset ratio of the maximum bandwidth. This means that critical resources will be given priority to obtain bandwidth resources to speed up their download speed and improve user experience.
[0126] In one specific implementation, the system monitors resource requests in real time through the shouldInterceptRequest callback method and dynamically adjusts the monitoring frequency based on the response time of the request. For example, if the response time of a resource exceeds expectations, the system will increase the monitoring frequency of the resource and mark it as a critical resource based on the accumulation of the number of requests. For these resources, the system limits the bandwidth to between 90% and 100% of the maximum bandwidth to ensure their fast download, especially when the network conditions are poor.
[0127] In another specific embodiment, the system dynamically adjusts the criteria for marking critical resources by analyzing the size and frequency of resource requests. If the system detects that a small file (such as a CSS file) is frequently requested and is critical to the layout of the web page, the system marks it as a critical resource. To ensure that these small but important files are loaded first, the system limits their download bandwidth to 70%-80% of the maximum bandwidth, while reducing the download priority of other large resources (such as videos).
[0128] In other specific implementations, the system introduces a real-time network status monitoring function. While determining key resources, the system will dynamically adjust the bandwidth limit for resource downloads based on the current network bandwidth availability. For example, when the network load is high, the system will limit the download bandwidth of key resources to 50%-60% of the maximum bandwidth after marking them to avoid excessive impact on overall network performance. When network conditions improve, the system will automatically relax these restrictions to increase the download speed of key resources.
[0129] This embodiment significantly improves the efficiency of web page loading and user experience by dynamically identifying key resources and allocating bandwidth in priority. The system can monitor resource download requests in real time and adjust its bandwidth allocation strategy after the importance of the resource is confirmed. In this way, the system ensures the fast download of key resources, reduces user waiting time, and maintains efficient loading and smooth presentation of web pages in complex network environments.
[0130] In one embodiment, in the above S40, limiting the network bandwidth used for resource downloading to be within a preset ratio range of the maximum bandwidth includes:
[0131] S407, during the webpage loading process, use the shouldInterceptRequest callback method to monitor each resource download request in real time and record the bandwidth consumption of the request;
[0132] S408, calculating the cumulative bandwidth consumption of all resource downloads in real time, comparing the cumulative bandwidth consumption with a preset ratio range of the maximum bandwidth, and determining whether the bandwidth usage of the current resource download exceeds the preset ratio range;
[0133] S409: If yes, reduce the amount of data read by the read method each time, thereby slowing down the resource download speed and reducing bandwidth usage.
[0134] In this embodiment, the system monitors each resource download request in real time through the shouldInterceptRequest callback method of WebView, and records the bandwidth consumption of each request. This record can help the system track the real-time bandwidth usage of resource downloads for subsequent bandwidth processing and optimization.
[0135] The system calculates the cumulative bandwidth consumption of all resource downloads in real time and compares it with the preset ratio range of the set maximum bandwidth. If the cumulative consumption exceeds the preset ratio, the system determines that the current resource download has occupied too much bandwidth.
[0136] If bandwidth usage exceeds the preset ratio, the system will slow down resource download speed by reducing the amount of data read each time by the read method. This measure can reduce bandwidth usage, allowing more bandwidth to be used for web page loading first, ensuring that the web page can be presented smoothly.
[0137] In one specific implementation, the system performs real-time monitoring through the shouldInterceptRequest callback method, but when recording the bandwidth consumption of each request, the system also records the response time of the request. If it is found that the response time of some resource requests is significantly extended, the system will prioritize recording the bandwidth consumption of these requests and use the weighted average method to calculate the cumulative bandwidth consumption. In this way, the system can identify and respond to the impact of network jitter and more accurately slow down the download speed when the bandwidth limit is exceeded.
[0138] In another specific implementation, the system expands the calculation method of bandwidth consumption and introduces a prediction model based on historical traffic data. The system not only calculates the real-time cumulative bandwidth consumption, but also uses the prediction model to estimate future bandwidth usage and compares it with the preset ratio of the current maximum bandwidth. If it is predicted that the bandwidth may exceed the limit in the future, the system will take measures in advance to control the download speed by reducing the reading amount of the read method. This method is particularly suitable for scenarios where the network environment fluctuates greatly.
[0139] In other specific implementations, the system introduces a priority sorting mechanism in bandwidth control. The system first classifies resource download requests (such as high-priority web page core resources and low-priority ancillary resources), and then monitors the bandwidth consumption of these requests in real time. When bandwidth usage exceeds the limit, the system will give priority to reducing the read method reading amount of low-priority resources to ensure that high-priority resources can obtain sufficient bandwidth support. This mechanism can ensure the priority loading of key resources and improve user experience.
[0140] Through the above steps, this embodiment can more intelligently allocate bandwidth resources in a complex network environment, optimize web page loading speed, and improve user experience.
[0141] In one embodiment, in the above S40, determining whether a web page is currently loaded includes:
[0142] S410, setting a preset time interval as a monitoring timeout, starting a timer when the webpage starts loading, and monitoring the callback time of the shouldInterceptRequest callback method;
[0143] S411, whenever a web page initiates a resource request, the shouldInterceptRequest callback method will be triggered, the time when the shouldInterceptRequest callback method is triggered each time is recorded, and the timer is reset;
[0144] S412, if the shouldInterceptRequest callback method is triggered within the preset time interval counted by the timer, it is determined that a web page is currently being loaded;
[0145] S413: If the timer reaches the preset time interval and the shouldInterceptRequest callback method is not triggered, it is determined that there is no web page loading currently.
[0146] In this embodiment, when the webpage starts loading, the system sets a preset time interval as the timeout time for monitoring the webpage loading status. The timer starts when the webpage starts loading and is used to monitor the callback time of the shouldInterceptRequest callback method.
[0147] Whenever a web page initiates a resource request, the shouldInterceptRequest callback method is triggered, the system records the time when the method is triggered, and resets the timer. This operation ensures that the system can continuously monitor the loading status of the web page.
[0148] The system will determine the web page loading status based on the status of the timer. If the shouldInterceptRequest callback method is triggered again within the preset time interval, the system will assume that the web page is still loading. If the timer exceeds the preset time interval and no new callback is triggered, the system will assume that the web page loading has been completed.
[0149] In one specific implementation, the system sets a preset time interval of 3 seconds and starts a timer when the web page starts loading. Each time the shouldInterceptRequest callback method is triggered, the system records the trigger time and resets the timer. If the method is triggered again within 3 seconds, the system determines that the web page is still loading and continues to monitor. If it is not triggered for more than 3 seconds, the system determines that the web page has been loaded and allocates bandwidth resources to other tasks.
[0150] In another specific implementation, the system dynamically adjusts the preset time interval when different types of web pages are loaded. For example, for multimedia-intensive web pages, the system sets the time interval to 5 seconds to cope with more resource requests. When the shouldInterceptRequest callback method is triggered again within 5 seconds, the system confirms that the web page is loading. If it is not triggered for more than 5 seconds, the system determines that the loading has ended and relaxes the bandwidth limit for resource downloads.
[0151] In other specific implementations, the system adjusts the timer strategy in combination with network conditions. In an environment with high network latency, the system will extend the preset time interval, such as from 2 seconds to 4 seconds, to accommodate slower resource request responses. When the shouldInterceptRequest callback method is not triggered within the adjusted time interval, the system determines that the web page loading has been completed and dynamically adjusts the bandwidth allocation for other tasks.
[0152] This embodiment ensures the reasonable allocation of network resources by real-time monitoring and dynamic adjustment of the web page loading status. The system can flexibly adjust the bandwidth allocation strategy according to the web page loading status and network environment to avoid resource waste and optimize user experience. Under complex network conditions, it can more efficiently process bandwidth resources and ensure fast loading of web page content.
[0153] The present invention also provides an Android-side network resource processing device, referring to Figure 2 , Figure 2 This is a functional module diagram of a preferred embodiment of an Android-side network resource processing device of the present invention. The Android-side network resource processing device comprises:
[0154] A network traffic monitoring module monitors the download network traffic and upload network traffic of each application through an Android system interface, records the total network traffic difference and time interval between each network resource request, and calculates the total network traffic change within a first preset time period based on the total network traffic difference and time interval;
[0155] A bandwidth calculation module determines the maximum bandwidth of the network in the entire monitoring period according to the total network traffic change in the first preset time period;
[0156] A resource usage status monitoring module monitors the current network resource usage status, including web page loading and resource downloading;
[0157] The bandwidth processing module determines whether there is a web page loading at present; if so, the network bandwidth used for resource download is limited to be within a preset ratio range of the maximum bandwidth; if not, the network bandwidth used for resource download is not limited.
[0158] The specific implementation of the Android-side network resource processing device of the present invention is basically the same as the above-mentioned embodiments of the Android-side network resource processing method, and will not be repeated here.
[0159] The present invention also provides an Android-side network resource processing device, such as Figure 3 As shown, the Android-side network resource processing device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0160] Those skilled in the art will understand that Figure 3 The hardware structure of the Android-side network resource processing device shown in the figure does not constitute a limitation on the Android-side network resource processing device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0161] like Figure 3 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and an Android-side network resource processing program. Among them, the operating system is a program for managing and controlling the Android-side network resource processing device and software resources, supporting the operation of the network communication module, the user interface module, the Android-side network resource processing program and other programs or software; the network communication module is used to manage and control the network interface 1004; the user interface module is used to manage and control the user interface 1003.
[0162] exist Figure 3 In the hardware structure of the Android-side network resource processing device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client and communicate data with the client; the processor 1001 can call the Android-side network resource processing program stored in the memory 1005, and perform the same operations as the Android-side network resource processing method.
[0163] The specific implementation of the Android-side network resource processing device of the present invention is basically the same as the above-mentioned embodiments of the Android-side network resource processing method, and will not be repeated here.
[0164] In addition, an embodiment of the present invention further proposes a computer storage medium, on which an Android-side network resource processing program is stored. When the Android-side network resource processing program is executed by a processor, the steps of the Android-side network resource processing method as described above are implemented.
[0165] The specific implementation of the computer storage medium of the present invention is basically the same as the above-mentioned embodiments of the Android-side network resource processing method, and will not be repeated here.
[0166] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.
[0167] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0168] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, RandomAccess Memory), a disk or an optical disk.
[0169] 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. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0170] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An Android-side network resource processing method, characterized in that: The following steps are involved: Monitor the download network traffic and upload network traffic of each application through the Android system interface, record the total network traffic difference and time interval between each network resource request, and calculate the total network traffic change within the first preset time period based on the total network traffic difference and time interval; Determine the maximum bandwidth of the network in the entire monitoring period according to the total network traffic change in the first preset time period; Monitor the current usage status of network resources, including web page loading and resource downloading; Determine whether there is a web page loading at present; if so, limit the network bandwidth used for resource downloading to within a preset ratio range of the maximum bandwidth; if not, do not limit the network bandwidth used for resource downloading.
2. The Android-side network resource processing method according to claim 1, characterized in that: The method includes monitoring the download network traffic and upload network traffic of each application program through an Android system interface, recording the total network traffic difference and the time interval between each network resource request, and calculating the total network traffic change within a first preset time period based on the total network traffic difference and the time interval, including: When the web page starts loading, use the onPageStarted callback method of WebView to record the initial network traffic of the application; During the web page loading process, use the shouldInterceptRequest callback method of WebView to monitor web resource requests multiple times. Each time a request is monitored, the total network traffic of the current application is recorded, and the time interval between the previous request and the difference between the total network traffic of the application are calculated. The total network traffic change within the first preset time period is determined based on the calculated total network traffic difference between two adjacent resource requests and the time interval.
3. The Android-side network resource processing method according to claim 1, characterized in that: Limiting the network bandwidth used for resource downloading to within a preset ratio range of the maximum bandwidth includes: During the web page loading process, the network traffic consumption of each resource request is monitored and recorded in real time through the shouldInterceptRequest callback method; Analyze and determine the type of the current web page in real time based on the accumulated network traffic consumption during web page loading; According to the type of the current webpage, the network bandwidth used for resource downloading is dynamically limited within a preset ratio range of the maximum bandwidth.
4. The method for processing network resources on the Android terminal according to claim 3, characterized in that: According to the type of the current webpage, the network bandwidth used for resource download is dynamically limited within a preset ratio range of the maximum bandwidth, including: Collecting historical network traffic data, and training a traffic prediction model based on the historical network traffic data; During the webpage loading process, combining the type of the current webpage and the accumulated network traffic consumption, predicting the bandwidth demand of the current webpage within a second preset time period based on the traffic prediction model; According to the predicted bandwidth demand of the current webpage within the second preset time period, the network bandwidth used for resource downloading is dynamically limited within a preset ratio range of the maximum bandwidth.
5. The method for processing network resources on the Android side as described in claim 1, characterized in that: Limiting the network bandwidth used for resource downloading to within a preset ratio range of the maximum bandwidth includes: During the web page loading process, the shouldInterceptRequest callback method of WebView is used to monitor each resource download request in real time; When the download request of a certain resource is triggered more than the preset threshold number of times, the resource is marked as a critical resource; A maximum bandwidth limit within a preset ratio range of the maximum bandwidth is allocated for downloading the key resource.
6. The method for processing network resources on the Android terminal according to claim 1, characterized in that: Limiting the network bandwidth used for resource downloading to within a preset ratio range of the maximum bandwidth includes: During the web page loading process, use the shouldInterceptRequest callback method to monitor each resource download request in real time and record the bandwidth consumption of the request; Calculate the cumulative bandwidth consumption of all resource downloads in real time, compare the cumulative bandwidth consumption with the preset ratio range of the maximum bandwidth, and determine whether the bandwidth usage of the current resource download exceeds the preset ratio range; If so, reduce the amount of data read each time by the read method, thereby slowing down resource download speed and reducing bandwidth usage.
7. The method for processing network resources on an Android device according to claim 1, wherein: Determine whether there is a web page loading, including: Set a preset time interval as the monitoring timeout, start the timer when the web page starts loading, and monitor the callback time of the shouldInterceptRequest callback method; Whenever a web page initiates a resource request, the shouldInterceptRequest callback method will be triggered, the time when the shouldInterceptRequest callback method is triggered will be recorded, and the timer will be reset; If the shouldInterceptRequest callback method is triggered within the preset time interval of the timer, it is determined that a web page is currently being loaded; If the timer reaches the preset time interval and the shouldInterceptRequest callback method is not triggered, it is determined that there is no web page loading currently.
8. An Android-side network resource processing device, characterized in that: The Android-side network resource processing device comprises: A network traffic monitoring module monitors the download network traffic and upload network traffic of each application through an Android system interface, records the total network traffic difference and time interval between each network resource request, and calculates the total network traffic change within a first preset time period based on the total network traffic difference and time interval; A bandwidth calculation module determines the maximum bandwidth of the network in the entire monitoring period according to the total network traffic change in the first preset time period; A resource usage status monitoring module monitors the current network resource usage status, including web page loading and resource downloading; The bandwidth processing module determines whether there is a web page loading at present; if so, the network bandwidth used for resource download is limited to be within a preset ratio range of the maximum bandwidth; if not, the network bandwidth used for resource download is not limited.
9. An Android-side network resource processing device, characterized in that: The Android-side network resource processing device includes a memory, a processor, and an Android-side network resource processing program stored in the memory and executable on the processor. When the Android-side network resource processing program is executed by the processor, the steps of the Android-side network resource processing method as described in any one of claims 1 to 7 are implemented.
10. A computer storage medium, characterized in that: The storage medium stores an Android-side network resource processing program, which, when executed by a processor, implements the steps of the Android-side network resource processing method as described in any one of claims 1-7.
