An app offline running method
By splitting and caching interactive data on servers and mobile terminals, the problem of offline use of the app in areas with poor network conditions was solved, enabling the normal operation of functional modules and data synchronization, thus improving business efficiency.
Patent Information
- Application Number
- CN202211005615.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2042-08-22
AI Technical Summary
The existing technology lacks a suitable offline usage solution for apps containing multiple functional modules in areas with poor network conditions, which makes it impossible to carry out inspection and patrol work in real time.
By splitting interactive data into basic interactive data and functional interactive data on the server side, and establishing corresponding caches on the mobile terminal, setting timestamps and expiration periods, the app can be used normally in offline mode and synchronize data when there is a network connection.
This ensures that the app can still function normally even when some functional modules are outdated, improving the availability of functional modules and guaranteeing the smooth operation of related businesses.
Smart Images

Figure CN115586929B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information technology, and in particular to an app offline running method. BACKGROUND
[0002] During the implementation of a project, project construction often needs to be carried out in remote areas or scenic areas where the network environment is poor. The inspection and inspection work in these areas often cannot be assisted by using an app due to the lack of network connection, which reduces the real-time performance of the inspection and inspection work of the project in these areas. Therefore, it is necessary to study a technology that can support the offline use of an app.
[0003] For example, Chinese patent CN110221855A, published on September 10, 2019, discloses an app and server cooperative updating and offline running method, which includes the following steps: the server compresses and packages the obtained function module into a function module file package and stores it; generates app configuration data including the new version number of the app and the latest version number and storage path of each function module file package; the mobile terminal communicates with the server and downloads the app configuration data from the server; reads the version number in the app configuration data and the storage address of each function module file package; downloads the function module file package inconsistent with the version in the mobile terminal according to the app configuration data and stores it; and the mobile terminal updates the app according to the downloaded function module file package. The technical solution can solve the problems of the app on the mobile terminal, such as offline running, inflexible configuration, low update efficiency, and slow upgrade speed. However, the technical solution relies on app configuration data to realize the offline running of the app, and even if there is a small change in the data, a new app version number needs to be configured, which has the problem of inaccurate offline data. SUMMARY
[0004] The technical problem to be solved by the present application is that there is currently a lack of a technical solution for the offline use of an app containing multiple function modules. An app offline running method is proposed, which realizes the offline use of the app and the corresponding function modules by setting up basic interaction data cache and function interaction data cache, and guarantees the efficiency of related businesses.
[0005] To solve the above technical problems, the present application adopts the following technical solution: an app offline running method, the app running in a mobile terminal, the app having data interaction with a server, including the following steps:
[0006] The server collects the interaction data of the app and the server, and divides the interaction data into basic interaction data and function interaction data;
[0007] The server periodically establishes basic interaction data cache and function interaction data cache;
[0008] Synchronize the basic interaction data cache and the function interaction data cache to the app after associating the time stamp and the expiration limit;
[0009] When the mobile terminal starts the app, check the network connection state. If there is no network connection, set the app to offline mode, then call the basic interaction data cache and enter the next step. If there is a network connection, set the app to online mode, judge whether there is data to be uploaded in the local app, if there is, upload the data to be uploaded to the server, and then synchronize the basic interaction data cache and the function interaction data cache. If there is no data to be uploaded, directly synchronize the basic interaction data cache and the function interaction data cache;
[0010] Judge whether the basic interaction data cache is expired. If it is not expired, treat the basic interaction data cache as the basic interaction data feedback by the server, and enter the next step. If the basic interaction data cache is expired, prompt that the network synchronization of the basic interaction data cache is needed, and exit the app;
[0011] When the mobile terminal enables the function module of the app, judge whether the app is in offline mode. If it is not in offline mode, start the function module and interact with the server through the network connection. If it is in offline mode, call the function interaction data cache;
[0012] Judge whether the function interaction data cache is expired. If it is expired, prompt that the function module is not available and exit the function module. If the function interaction data cache is not expired, treat the function interaction data cache as the function interaction data feedback by the server;
[0013] Pack the business data generated by the function module as data to be uploaded and save it locally.
[0014] As a preferred, the method of splitting the interaction data into basic interaction data and function interaction data includes:
[0015] Read the historical interaction data of the app and the server;
[0016] Split the historical interaction data into several sub-data, each sub-data corresponding to a function module of the app;
[0017] Divide the sub-data into version-dependent data according to the version of the corresponding app function module;
[0018] Divide the version-dependent data into app request data and server feedback data, and associate the server feedback data with the corresponding app request to form a request feedback data pair;
[0019] The request feedback data pairs of different versions of the comparison function module are compared. If the server feedback data of the same app request data is the same, the request feedback data pair is included in the basic interaction data set. Otherwise, the request feedback data pair is included in the function interaction data set.
[0020] As preferred, the method for the server to periodically establish the basic interaction data cache includes:
[0021] A period T1 and a starting time are set to divide the time into several period spans.
[0022] The basic interaction data sets corresponding to all function modules are divided into corresponding period spans according to the data generation time.
[0023] The intersection of the basic interaction data sets corresponding to all function modules in the last complete period span is taken as the basic interaction data cache.
[0024] The basic interaction data cache is associated with the timestamp of the end time of the last complete period span, and the expiration period length T1 is set.
[0025] As preferred, within a preset time length, the starting time is adjusted to maximize the intersection of the basic interaction data sets corresponding to all function modules in the last complete period span.
[0026] As preferred, the method for the server to periodically establish the function interaction data cache includes:
[0027] All app requests of each function module are enumerated.
[0028] The latest server feedback data of the corresponding app request is found to form a request feedback data pair.
[0029] All request feedback data pairs of each function module constitute the function interaction data cache of the corresponding function module.
[0030] The digital fingerprint of the function interaction data cache of each function module is extracted.
[0031] The function interaction data cache is associated with the current timestamp, and the expiration period length T2 is set.
[0032] The function interaction data cache is associated with the timestamp, the length T2, and the digital fingerprint, and is synchronized to the mobile terminal.
[0033] When the mobile terminal has a network connection, the app compares the digital fingerprint of each function interaction data cache with the server. If they are consistent, the expiration period of the corresponding function interaction data cache is extended by the length T2. If they are not consistent, the function interaction data cache is immediately synchronized, and the expiration period of the corresponding function interaction data cache is extended by the length T2.
[0034] As preferred, the server extracts the digital fingerprint of the current all-function interaction data cache as the quick identification digital fingerprint, and synchronizes to the mobile terminal;
[0035] When the digital fingerprint of a certain function interaction data cache changes, the server reextracts the quick identification digital fingerprint;
[0036] When the mobile terminal establishes a network connection with the server, the app compares the quick identification digital fingerprint with the server, if consistent, it is determined that the digital fingerprints of all function interaction data caches are consistent, and the expiration period of all function interaction data caches is extended by a time T2, if inconsistent, the digital fingerprints of each function interaction data cache are compared in turn, if consistent, the expiration period of the corresponding function interaction data cache is extended by a time T2, if inconsistent, the function interaction data cache is immediately synchronized, and the expiration period of the corresponding function interaction data cache is extended by a time T2.
[0037] As preferred, the method for checking the network connection state comprises:
[0038] The app sends a preset character and a time stamp to the server multiple times, and the server feeds back a preset response character and a time stamp after receiving it;
[0039] The app calculates the time length of the time consumption of sending the preset character multiple times and receiving the response character, calculates the average value of the time length of the time consumption, if the average value exceeds a preset threshold, it is determined that there is no network connection, if the average value does not exceed the preset threshold, it is determined that there is a network connection.
[0040] The beneficial technical effects of the present application include: establishing a basic interaction data cache and a function interaction data cache, and setting corresponding expiration periods respectively, which can enable the app to be normally used in the case that only part of the function modules are updated and expired, and does not affect the use of other function modules, improves the usability of the function modules when the app is offline, and helps to ensure the smooth progress of related businesses.
[0041] Other features and advantages of the present application will be disclosed in detail in the following specific embodiments and drawings. BRIEF DESCRIPTION OF DRAWINGS
[0042] The present application will be further described below in combination with the drawings:
[0043] Figure 1 The flowchart of the offline running method of the embodiment of the present application is shown.
[0044] Figure 2 The flowchart of the method for splitting the basic interaction data and the function interaction data of the embodiment of the present application is shown.
[0045] Figure 3A flowchart of a method for establishing a basic interaction data cache is shown in the embodiment of the present application.
[0046] Figure 4 A flowchart of a method for establishing a functional interaction data cache is shown in the embodiment of the present application. DETAILED DESCRIPTION
[0047] The technical solutions of the embodiments of the present application are explained and described below in combination with the drawings of the embodiments of the present application. However, the following embodiments are only preferred embodiments of the present application, and not all. Based on the embodiments in the embodiments, other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0048] In the following description, the directions such as terms "in", "out", "up", "down", "left", "right", etc. are only for the convenience of describing the embodiments and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation of the present application.
[0049] An app offline running method, the app runs in a mobile terminal, and the app and a server have data interaction. Please refer to the attached Figure 1 , which comprises the following steps:
[0050] Step A01) Collecting, at the server, the interaction data of the app and the server, and splitting the interaction data into basic interaction data and functional interaction data;
[0051] Step A02) The server periodically establishes a basic interaction data cache and a functional interaction data cache;
[0052] Step A03) Synchronizing the basic interaction data cache and the functional interaction data cache to the app after associating a time stamp and an expiration limit with each of the basic interaction data cache and the functional interaction data cache;
[0053] Step A04) When the mobile terminal starts the app, checking the network connection state, if there is no network connection, setting the app to offline mode, then calling the basic interaction data cache and entering the next step, if there is a network connection, setting the app to online mode, judging whether there is data to be uploaded in the app locally, if there is, uploading the data to be uploaded to the server, and then synchronizing the basic interaction data cache and the functional interaction data cache, if there is not, directly synchronizing the basic interaction data cache and the functional interaction data cache;
[0054] Step A05) Judging whether the basic interaction data cache is expired, if not, regarding the basic interaction data cache as the basic interaction data fed back by the server, and entering the next step, if the basic interaction data cache is expired, prompting that the basic interaction data cache needs to be synchronized with the network, and exiting the app;
[0055] Step A06) When the mobile terminal enables the function module of the app, it is judged whether the app is in offline mode. If not, the function module is started, and data is interacted with the server through network connection. If it is in offline mode, the function interaction data cache is called;
[0056] Step A07) It is judged whether the function interaction data cache is expired. If it is expired, it is prompted that the function module is not available and the function module is exited. If the function interaction data cache is not expired, the function interaction data cache is regarded as the function interaction data feedback by the server;
[0057] Step A08) The business data generated by the function module is packaged as data to be uploaded and saved locally.
[0058] In this embodiment, the app has a basic module and a plurality of function modules. The basic module is used to start the app, perform network check, synchronize data with the server, and provide a list of a plurality of function modules. Each function module corresponds to a business. For example, the device installation site acceptance function module requires the staff holding the mobile terminal to take photos of the corresponding positions according to the instructions of the function module to complete the acceptance of the device installation. The device installation site acceptance function module may be upgraded due to the change of the device model, so the function module also has the possibility of upgrading. The data content interacted with the server by the device installation site acceptance function module is that the server is requested to provide a list of device positions requiring photos to be taken. When the app is in offline mode, the app obtains the list of device positions requiring photos to be taken by calling the function interaction data cache, and the list of device positions requiring photos to be taken obtained from the function interaction data cache is regarded as obtained from the server. The taken photos are cached locally and synchronized to the server when there is network.
[0059] Please refer to the attached Figure 2 The method of splitting the interaction data into basic interaction data and function interaction data includes:
[0060] Step B01) The historical interaction data of the app and the server is read;
[0061] Step B02) The historical interaction data is split into a plurality of sub-data, and each sub-data corresponds to a function module of the app;
[0062] Step B03) The sub-data is divided into version data according to the version of the corresponding function module of the app;
[0063] Step B04) The version data is divided into app request data and server feedback data, and the server feedback data is associated with the corresponding app request to form a request feedback data pair;
[0064] Step B05) Compare the request feedback data pairs of different versions of the function modules. If the server feedback data of the same app request data is the same, the request feedback data pair is included in the basic interaction data set. Otherwise, the request feedback data pair is included in the function interaction data set.
[0065] Please refer to the attached Figure 3 The method for the server to periodically establish the basic interaction data cache includes:
[0066] Step C01) Set a period T1 and a starting time, and divide the time into several period spans.
[0067] Step C02) Divide the basic interaction data sets corresponding to all function modules into the corresponding period spans according to the data generation time.
[0068] Step C03) Find the intersection of the basic interaction data sets corresponding to all function modules in the last complete period span, as the basic interaction data cache.
[0069] Step C04) Associate the basic interaction data cache with the timestamp of the end time of the last complete period span, and set the expiration period length as T1.
[0070] Within a preset time length, adjust the starting time so that the intersection of the basic interaction data sets corresponding to all function modules in the last complete period span is maximized.
[0071] Please refer to the attached Figure 4 The method for the server to periodically establish the function interaction data cache includes:
[0072] Step D01) Enumerate the app requests of each function module.
[0073] Step D02) Find the latest server feedback data of the corresponding app request to form a request feedback data pair.
[0074] Step D03) All request feedback data pairs of each function module constitute the function interaction data cache of the corresponding function module.
[0075] Step D04) Extract the digital fingerprint of the function interaction data cache of each function module.
[0076] Step D05) Associate the function interaction data cache with the current timestamp, and set the expiration period length as T2.
[0077] Step D06) Associate the function interaction data cache with the timestamp, the length T2 and the digital fingerprint, and synchronize it to the mobile terminal.
[0078] Step D07) When the mobile terminal has a network connection, the app compares the digital fingerprints of each function interaction data cache with the server, if consistent, the expiration period of the corresponding function interaction data cache is extended by T2, if inconsistent, the function interaction data cache is immediately synchronized, and the expiration period of the corresponding function interaction data cache is extended by T2.
[0079] The server extracts the digital fingerprints of the digital fingerprints of all current function interaction data caches as the quick identification digital fingerprints, and synchronizes them to the mobile terminal; when the digital fingerprints of a certain function interaction data cache change, the server reextracts the quick identification digital fingerprints; when the mobile terminal establishes a network connection with the server, the app compares the quick identification digital fingerprints with the server, if consistent, it is determined that the digital fingerprints of all function interaction data caches are consistent, the expiration period of all function interaction data caches is extended by T2, if inconsistent, the digital fingerprints of each function interaction data cache are compared in turn, if consistent, the expiration period of the corresponding function interaction data cache is extended by T2, if inconsistent, the function interaction data cache is immediately synchronized, and the expiration period of the corresponding function interaction data cache is extended by T2.
[0080] The method for checking the network connection state comprises: the app sends a preset character and a timestamp to the server multiple times, and the server feeds back a preset response character and a timestamp after receiving; the app calculates the time length of the time consumption of sending the preset character multiple times and receiving the response character, calculates the average value of the time length of the time consumption, if the average value exceeds a preset threshold, it is determined that there is no network connection, if the average value does not exceed the preset threshold, it is determined that there is a network connection.
[0081] The beneficial technical effects of the embodiment include: establishing basic interaction data cache and function interaction data cache, and setting the corresponding expiration period, which can enable the app to be normally used in the case that only part of the function modules are updated and expired, and does not affect the use of other function modules, improves the usability of function modules when the app is offline, and helps to ensure the smooth progress of related business.
[0082] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and those skilled in the art should understand that the present application includes but is not limited to the contents described in the above specific embodiments and the drawings. Any modification that does not deviate from the functional and structural principles of the present application shall be included in the scope of the claims.
Claims
1. An app offline running method, the app running in a mobile terminal, the app having data interaction with a server, characterized in that, The app comprises a basic module and several functional modules, and the running method comprises the following steps: Step A01: collecting interaction data of the app with the server on the server, and splitting the interaction data into basic interaction data and functional interaction data of the corresponding functional module; Step A02: periodically establishing a basic interaction data cache and a functional interaction data cache of the corresponding functional module on the server; Step A03: synchronizing the basic interaction data cache and the functional interaction data cache to the app after associating a time stamp and an expiration limit with each of the basic interaction data cache and the functional interaction data cache; Step A04: when the mobile terminal starts the app, checking a network connection state, setting the app to an offline mode if there is no network connection, calling the basic interaction data cache and entering the next step A05, setting the app to an online mode if there is network connection, judging whether there is to-be-uploaded data in the app locally, uploading the to-be-uploaded data to the server if there is, and then synchronizing the basic interaction data cache and the functional interaction data cache, and directly synchronizing the basic interaction data cache and the functional interaction data cache if there is not; Step A05: judging whether the basic interaction data cache is expired, taking the basic interaction data cache as the basic interaction data fed back by the server if the basic interaction data cache is not expired, and entering the next step, and prompting that the basic interaction data cache needs to be synchronized with the network and exiting the app if the basic interaction data cache is expired; Step A06: when the mobile terminal enables a functional module of the app, judging whether the app is in the offline mode, starting the functional module and interacting with the server through the network connection if the app is not in the offline mode, and calling the functional interaction data cache if the app is in the offline mode; Step A07: judging whether the functional interaction data cache is expired, prompting that the functional module is unavailable and exiting the functional module if the functional interaction data cache is expired, and taking the functional interaction data cache as the functional interaction data fed back by the server if the functional interaction data cache is not expired; Step A08: packaging business data generated by the functional module as to-be-uploaded data and saving the to-be-uploaded data locally.
2. The app offline running method according to claim 1, wherein the method for splitting the interaction data into the basic interaction data and the functional interaction data comprises: reading historical interaction data of the app with the server; splitting the historical interaction data into a plurality of sub-data, each of which corresponds to a functional module of the app; dividing the sub-data into version-dependent data according to versions of the corresponding functional modules of the app; dividing the version-dependent data into app request data and server feedback data, and associating the server feedback data with corresponding app requests to form request feedback data pairs; comparing the request feedback data pairs of different versions of the functional module, and if the server feedback data of the same app request data is the same, the request feedback data pair is included in the basic interaction data set, otherwise, the request feedback data pair is included in the functional interaction data set.
3. The app offline running method according to claim 2, wherein the method for periodically establishing the basic interaction data cache on the server comprises: setting a period T1 and a starting time, and dividing time into a plurality of period spans; The basic interaction data set corresponding to all functional modules is divided into the corresponding period span according to the time of data generation; The intersection of the basic interaction data set corresponding to all functional modules in the last complete period span is taken as the basic interaction data cache; The basic interaction data cache is associated with the timestamp at the end of the last complete period span, and the expiration deadline is set to T1.
4. The app offline running method according to claim 3, wherein, In a preset time length, the starting time is adjusted to maximize the intersection of the basic interaction data set corresponding to all functional modules in the last complete period span.
5. The app offline running method according to claim 3 or 4, wherein, The method for the server to periodically establish the functional interaction data cache comprises: Enumerating the app requests of each functional module; Finding the latest server feedback data corresponding to the app requests to form request feedback data pairs; All request feedback data pairs of each functional module constitute the functional interaction data cache of the corresponding functional module; Extracting the digital fingerprints of the functional interaction data cache of each functional module; Associating the functional interaction data cache with the current timestamp and setting the expiration deadline to T2; Associating the functional interaction data cache with the timestamp, the duration T2 and the digital fingerprints, and synchronizing to the mobile terminal; When the mobile terminal has a network connection, the app compares the digital fingerprints of each functional interaction data cache with the server, if they are consistent, the expiration deadline of the corresponding functional interaction data cache is extended by T2, if they are not consistent, the functional interaction data cache is immediately synchronized, and the expiration deadline of the corresponding functional interaction data cache is extended by T2.
6. The app offline running method according to claim 5, wherein, The server extracts the digital fingerprints of the digital fingerprints of all current functional interaction data caches as the quick identification digital fingerprints and synchronizes them to the mobile terminal; When the digital fingerprints of a certain functional interaction data cache change, the server reextracts the quick identification digital fingerprints; When the mobile terminal establishes a network connection with the server, the app compares the quick identification digital fingerprints with the server, if they are consistent, it is determined that the digital fingerprints of all functional interaction data caches are consistent, the expiration deadline of all functional interaction data caches is extended by T2, if they are not consistent, the digital fingerprints of each functional interaction data cache are compared in turn, if they are consistent, the expiration deadline of the corresponding functional interaction data cache is extended by T2, if they are not consistent, the functional interaction data cache is immediately synchronized, and the expiration deadline of the corresponding functional interaction data cache is extended by T2.
7. The app offline running method according to any one of claims 1 to 4, wherein, The method for checking the network connection state comprises: The app sends a preset character and a timestamp to the server multiple times, and the server feeds back a preset response character and a timestamp after receiving it; The app calculates the time length of sending the preset character and receiving the response character for multiple times, calculates the average value of the time length, and determines that there is no network connection if the average value exceeds a preset threshold, or determines that there is network connection if the average value does not exceed the preset threshold.
Citation Information
Patent Citations
Method for collaborative updating and offline operation of app and server
CN110221855A
Method and system for cache at browser client side
CN102012907A
Method for rapidly implementing offline applications
CN102591953A