Method, device and equipment for sharing data between cross-end container and native running environment
By setting up a shared storage area in the native running environment, the target data obtained or updated by the cross-end container and the native running environment are saved in two data formats that are suitable for their respective environments, and then the shared storage area is accessed by their respective environments to read the required data format, which solves the problem of time-consuming data transmission between the cross-end container and the native running environment, and achieves more efficient data reading and multiplexing.
Patent Information
- Application Number
- CN202311095318.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
The existing method of transmitting data between cross-end containers and native operating environments has a time-consuming problem, especially because the data format is inconsistent, frequent format conversion is required.
By setting up a shared storage area in the native running environment, the target data obtained or updated by the cross-end container and the native running environment are saved in two data formats that are suitable for their respective environments, and then the shared storage area is accessed by their respective environments to read the required data format.
It reduces the time-consuming conversion of data formats during data transmission, improves the data reading speed, and reduces the number of data requests to external data sources through data multiplexing, reducing the total time-consuming of data acquisition.
Smart Images

Figure CN119536896A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of cross-end container technology, and more particularly to a method, apparatus, and device for sharing data between a cross-end container and a native runtime environment. Background Art
[0002] Cross-end container, or cross-end runtime environment, is a technology that allows users to run on multiple terminals by writing a set of code. Due to good platform compatibility, cross-end containers are used in the production of many software applications. Due to the difference in underlying mechanisms, the cross-end runtime environment is usually isolated from the native runtime environment on the terminal, and data is often transmitted between the two through a bridge module. However, the existing method of transmitting data between the cross-end runtime environment and the native runtime environment often has the problem of being time-consuming. Summary of the invention
[0003] The embodiments of the present disclosure describe a method, apparatus, device, and medium for sharing data across end containers and native runtime environments.
[0004] According to a first aspect, a method for sharing data between a cross-end container and a native operating environment is provided, wherein the cross-end container and the native operating environment are running on a target terminal, and the method includes:
[0005] The cross-end container or the native operating environment obtains or updates target data, and stores the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively;
[0006] The native operating environment or the cross-end container accesses the shared storage area and reads target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container.
[0007] According to a second aspect, a device for sharing data between a cross-end container and a native operating environment is provided, wherein the cross-end container and the native operating environment are run on a target terminal, comprising:
[0008] a data acquisition unit configured to acquire or update target data through the cross-end container or the native operating environment, and store the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment;
[0009] The access unit is configured to access the shared storage area through the native operating environment or the cross-end container, and read target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container.
[0010] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.
[0011] According to a fourth aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.
[0012] According to an embodiment of the present disclosure, a method, apparatus, device and medium for sharing data between a cross-end container and a native operating environment are provided. First, the cross-end container or the native operating environment obtains or updates the target data, and saves the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively. Then, the native operating environment or the cross-end container accesses the shared storage area to read the target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container. Through this method, through this method, the time spent on data format conversion during data transmission between the two parties can be reduced, the data reuse rate can be improved, and the number of data requests for external data sources can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A schematic diagram showing data transmission between cross-end containers and native runtime environments;
[0014] Figure 2 (a) is a schematic diagram showing a method for sharing data across end containers and native runtime environments according to an embodiment of the present disclosure;
[0015] Figure 2 (b) is a schematic diagram showing saving data in a shared storage area and reading data from a shared storage area according to an embodiment of the present disclosure;
[0016] Figure 3 A schematic diagram of a process for sharing data across a terminal container and a native operating environment according to an embodiment of the present disclosure is shown;
[0017] Figure 4 A schematic diagram showing a shared storage area as a global singleton according to an embodiment of the present disclosure;
[0018] Figure 5 A schematic block diagram of a device for sharing data across a terminal container and a native operating environment according to an embodiment of the present disclosure is shown;
[0019] Figure 6 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown;
[0020] Figure 7 A schematic diagram of the structure of a storage medium suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0021] The technical solution provided in this specification is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant inventions, rather than to limit the inventions. It should also be noted that, for ease of description, only the parts related to the relevant inventions are shown in the accompanying drawings. It should be noted that, in the absence of conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.
[0022] In the description of the implementations of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one / kind of implementation" or "the implementation" should be understood as "at least one / kind of implementation". The term "some implementations" should be understood as "at least some implementations". Other explicit and implicit definitions may also be included below.
[0023] As mentioned earlier, a cross-end container (cross-end runtime environment) is a technology that allows users to write a set of code and run it on multiple terminals. This technology abstracts and encapsulates the capabilities of the underlying platform to provide a unified and standardized API (Application Programming Interface) for upper-level applications to simplify the user's programming process and improve software production efficiency. Due to good platform compatibility, cross-end containers are used in the production of many software applications. Due to the difference in the underlying mechanism, the cross-end runtime environment is usually isolated from the native runtime environment on the terminal, and data can usually be transmitted between the two through a bridge module. The native runtime environment usually refers to the integrated environment of the operating system or basic development platform on the terminal, through which applications can often directly access the underlying functions and resources of the operating system. Figure 1 Figure 1 shows a schematic diagram of data transmission between cross-end containers and native runtime environments. Figure 1 As shown, the cross-end container and the local operating environment running on the terminal can obtain each other's data through the bridge module.
[0024] However, directly using the bridge module to transmit data often has transmission performance issues caused by data standardization. For example, the cross-end container uses data in one data format (for example, Json format), and the native operating environment uses data in another data format (for example, class instance serialization format). Therefore, before passing the data through the bridge module, it is necessary to convert the data format. The process of format conversion will reduce the speed of data transmission. In addition, in actual operation scenarios, the cross-end operating environment and the native operating environment often request the same data from the same data source. Repeated requests will increase the pressure on the data source server, and the repeated request process itself also increases the total time required to obtain dual-test data for the cross-end operating environment and the native operating environment.
[0025] In order to solve the above technical problems, the embodiments of the present disclosure provide a method for sharing data across end containers and native operating environments. Figure 2 (a) shows a schematic diagram of a method for sharing data across end containers and native runtime environments according to an embodiment of the present disclosure. Figure 2 As shown in (a), in some embodiments, the cross-end container or native operating environment can obtain or update data, and save the obtained or updated data in a shared storage area in the native operating environment in a data format corresponding to the cross-end container (e.g., a first data format) and a data format corresponding to the native operating environment (e.g., a second data format). Then, the native operating environment or cross-end container can access the shared storage area to obtain data in a data format corresponding to its own environment. Specifically, in one example, Figure 2 As shown in (b), for example, after the native operating environment obtains data Data1 from an external data source, the native operating environment can save Data1 in a shared storage area in the native operating environment in a first data format and a second data format. Then, for example, when a cross-end container wants to use Data1, it can access the shared storage area to obtain data Data1 in the first data format. In another example, when the native operating environment uses Data1, it can directly read data Data1 in the first data format in the shared storage area. In other examples, after the cross-end container obtains data Data2, for example, Data2 can be saved in a shared storage area in the native operating environment in a first data format and a second data format, respectively, so that the subsequent native operating environment or cross-end container can directly read Data2 corresponding to its environment from the shared storage area.
[0026] The advantages of this method are: on the one hand, data transmission between the cross-end container and the native operating environment can be completed by both parties accessing the shared storage space. In this process, the conversion of the data format applicable to both parties is completed before each party saves the data provided by itself to the shared storage space, so that both parties do not need to perform format conversion when directly reading the saved data (for the convenience of description, or referred to as the other party's data), which improves the speed of data reading by both parties. Furthermore, it also improves the speed of different tasks performed by both parties using the data provided by the other party. In one example, for example, one party can use the data saved by the other party to increase the speed of loading its own page. On the other hand, for the same data requested from the same data source, the frequency of data requests can be reduced through data reuse, thereby reducing the pressure on the data source server, and reducing the total time consumed for dual-test data acquisition in the cross-end operating environment and the native operating environment.
[0027] The detailed process of this method is further described below.
[0028] Figure 3 A schematic diagram of a method for sharing data between a cross-end container and a native operating environment according to an embodiment of the present disclosure is shown. The cross-end container and the native operating environment are running on a target terminal. Figure 3 As shown, the method comprises at least the following steps:
[0029] Step S301, the cross-end container or the native operating environment obtains or updates target data, and saves the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively;
[0030] Step S303: The native operating environment or the cross-end container accesses the shared storage area to read target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container.
[0031] First, in step S301, any one of the cross-end container or the native operating environment can obtain or update the target data, and save the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment. In different embodiments, the target terminal can be different types of computer devices, and this specification does not limit this. In one embodiment, for example, it can be a mobile terminal, and specifically, for example, it can be one of a mobile phone, a notebook, a tablet computer, and a car computer. In different embodiments, the cross-end container running on the target terminal can be a container of different specific types. According to the operating system or basic development platform installed on different terminals, in different embodiments, the native operating environment running on the target terminal can also be different. In different embodiments, the target data can also be different specific types, or data for different specific businesses or purposes, and this specification does not limit this. In one embodiment, the cross-end container and the native operating environment can be called by the target program on the target terminal, for example, and the target program can perform different tasks through the cross-end container and the native operating environment, respectively. For example, cross-platform standardized tasks can be performed through the cross-end container, and tasks that can access the underlying resources of the operating system or can be efficiently performed locally can be performed through the native operating environment.
[0032] As mentioned above, data can be transmitted between the cross-end container and the native operating environment through a bridge module. Therefore, in one embodiment, the cross-end container can use a bridge module for transmitting data between the native operating environment and the cross-end container to store the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, such as Figure 2 In different specific embodiments, the cross-end container can save the target data in the shared storage area in the native operating environment through different specific types of bridge modules. In a specific embodiment, for example, the target data can be saved in the shared storage area in the native operating environment through the JSBridge (JavaScript Bridge) module.
[0033] In different embodiments, the data sources of the target data obtained or updated by the cross-end container or the native operating environment may be different. In one embodiment, the cross-end container or the native operating environment may obtain the target data from an external data source. Thus, the obtained external data may be saved in a shared storage area in the native operating environment in a first data format and a second data format, respectively. In this embodiment, the external data saved to the shared storage area may be reused by the cross-end container and the native operating environment in subsequent steps to reduce the number of data requests for the external data source, thereby reducing the pressure on the external data source server and reducing the total time consumption of data requests.
[0034] In another embodiment, the cross-end container or native operating environment can also update the target data inside the cross-end container or the native operating environment. Thus, their internal data can be saved in the shared storage area in the native operating environment in the first data format and the second data format, respectively. In this embodiment, when the cross-end container or native operating environment reuses the data saved in the shared storage area in subsequent steps, it can also directly read the data in the data format that matches its own environment without format conversion, further improving the speed of reading data.
[0035] In different embodiments, the shared storage area may be set differently. In one embodiment, the shared storage area may be set as a global single object instance, or global singleton for short. A global singleton may be a globally unique program object (Object) in a program or application, and may be accessed globally. In a specific embodiment, the global single object instance may include a predetermined data access interface. Furthermore, the cross-end container or native runtime environment may use the data access interface to save the target data in the global single object instance in a first data format and a second data format, respectively. Also, through the data access interface, the target data in the second data format or the first data format may be read from the global single object instance, such as Figure 4 As shown. By saving data through a global single object instance, data can be easily accessed in the global scope of the runtime environment, and cross-end containers can also easily access data through the bridge module.
[0036] In order to further facilitate the storage and reading of different data in the shared storage area, in a specific embodiment, the target data can also be stored in the storage unit corresponding to the identifier in the shared storage area in the first data format and the second data format according to the identifier corresponding to the target data. Then, when the native operating environment or the cross-end container accesses the shared storage area later, the target data in the data format matching the native operating environment or the cross-end container environment can be read from the storage unit corresponding to the identifier according to the identifier of the target data.
[0037] In different embodiments, depending on the cross-end container and the native operating environment, the first data format and the second data format may also be different specific formats, which is not limited in this specification. In one embodiment, the first data format may be, for example, a Json format, and the second data format may be, for example, a class instance serialization format.
[0038] Then, in step S303, the native operating environment or the cross-end container accesses the shared storage area to read the target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container. In this step, the native operating environment or the cross-end container can directly read the target data in the data format that matches its own environment from the shared storage area.
[0039] In the above-mentioned embodiment where either the cross-end container or the native operating environment obtains the target data from the external data source and saves it to the shared storage area. In this step, both the cross-end container or the native operating environment can reuse the target data saved in the shared storage area, and no longer request data from the external data source, thereby reducing the frequency and time consumption of the total data request. In addition, the processing pressure on the data source server and the transmission pressure on the network can also be reduced.
[0040] In the above embodiment, in which either the cross-end container or the native operating environment updates the internal target data and saves it to the shared storage area, in this step, both the cross-end container or the native operating environment can directly read the target data in the data format matching their own environment stored in the shared storage area without format conversion, thereby increasing the speed of reading data.
[0041] In the above embodiment of reading target data from a cross-end container, the cross-end container can access the shared storage area through the bridge module to read the target data in the first data format.
[0042] Figure 5 A schematic block diagram of a device for sharing data across a terminal container and a native runtime environment according to an embodiment of the present disclosure is shown. The device is used to perform the following steps: Figure 3In the method shown, the cross-end container and the native operating environment are run on the target terminal. Figure 5 As shown, the device 500 includes:
[0043] The data acquisition unit 501 is configured to acquire or update target data through the cross-end container or the native operating environment, and store the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively;
[0044] The access unit 502 is configured to access the shared storage area through the native operating environment or the cross-end container, and read target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container.
[0045] The present disclosure also provides an electronic device, including a memory and a processor. The memory stores executable code. When the processor executes the executable code, the following is achieved: Figure 3 The method shown.
[0046] You can also refer to the following Figure 6 , which shows a schematic structural diagram of an electronic device 600 suitable for implementing an embodiment of the present application. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0047] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601. The above-mentioned processing device 601 may be a general-purpose processor, a digital signal processor (Digital Signal Processing, DSP), a microprocessor or a microcontroller, and may further include an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 to the random access memory (RAM) 603. In RAM603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, ROM602 and RAM603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0048] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0049] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the cross-end container and native runtime environment sharing data provided by the embodiment of the present application are executed.
[0050] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the following steps provided in the present disclosure: Figure 3 Sharing data across containers and native runtime environments as shown in . Figure 7 A schematic diagram of a storage medium for implementing an embodiment of the present application. Figure 7As shown, the storage medium 700 may be a non-transitory computer-readable storage medium for storing non-transitory computer-executable instructions 701. When the non-transitory computer-executable instructions 701 are executed by the processor, the cross-end container and native operating environment sharing data provided by the embodiment of the present application can be implemented. For example, when the non-transitory computer-executable instructions 701 are executed by the processor, one or more steps in the cross-end container and native operating environment sharing data provided by the embodiment of the present application can be performed. For example, the storage medium 700 can be applied to the above-mentioned electronic device. For example, the storage medium 700 may include a memory in the electronic device. For the description of the storage medium 700, reference may be made to the description of the memory in the embodiment of the electronic device, and the repetitions will not be repeated. The specific functions and technical effects of the storage medium 700 may refer to the description of the cross-end container and native operating environment sharing data provided by the embodiment of the present application, which will not be repeated here.
[0051] It should be noted that the computer-readable medium of the embodiment of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a memory card of a smart phone, a storage component of a tablet computer, a portable computer disk, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0052] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the server, the electronic device implements the cross-end container and native runtime environment data sharing provided by the embodiment of the present application.
[0053] Computer program code for performing the operations of the disclosed embodiments may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0054] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, which 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 may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they may 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 flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions. The units involved in the embodiments described in the present disclosure can be implemented by software or by hardware. Among them, the name of the unit does not constitute a limitation on the unit itself under certain circumstances. The functions described above in this article can be performed at least in part by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0055] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the storage medium and computing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0056] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned public concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) to form a technical solution. In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of a single embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.
[0057] The above specific implementation methods further describe in detail the purpose, technical solutions and beneficial effects of the embodiments of the present invention. Although the subject matter has been described in a language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. It should be understood that the above are only specific implementation methods of the embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for sharing data between a cross-end container and a native operating environment, wherein the cross-end container and the native operating environment are running on a target terminal, the method comprising: The cross-end container or the native operating environment obtains or updates target data, and stores the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively; The native operating environment or the cross-end container accesses the shared storage area and reads target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container.
2. The method according to claim 1, wherein: The cross-end container or the native operating environment obtains or updates target data, and stores the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively, including: The cross-end container stores the target data in the first data format and the second data format in a shared storage area in the native operating environment through a bridge module for transmitting data between the native operating environment and the cross-end container; The native operating environment or the cross-end container accesses the shared storage area and reads target data in a second data format or a first data format corresponding to the native operating environment or the cross-end container, including: The cross-end container accesses the shared storage area through the bridge module and reads the target data in the first data format.
3. The method according to claim 1, wherein: The cross-end container or the native operating environment obtains or updates target data, including: The cross-end container or the native operating environment obtains target data from an external data source.
4. The method according to claim 1, wherein: The cross-end container or the native operating environment obtains or updates target data, including: The cross-end container or the native operating environment updates target data within the cross-end container or the native operating environment. The method according to claim 1 , wherein the shared storage area is a global single object instance.
6. The method according to claim 5, wherein: The global single object instance includes a predetermined data access interface; The storing the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment respectively includes: The cross-end container or the native runtime environment saves the target data in the global single object instance in the first data format and the second data format respectively through the data access interface; The native operating environment or the cross-end container accesses the shared storage area and reads target data in a second data format or a first data format corresponding to the native operating environment or the cross-end container, including: The native runtime environment or the cross-end container reads the target data in the second data format or the first data format from the global single object instance through the data access interface.
7. The method according to claim 1, wherein: The method includes storing the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment, respectively; According to the identifier corresponding to the target data, storing the target data in a first data format and a second data format in a storage unit corresponding to the identifier in the shared storage area; Reading target data in a second data format or a first data format corresponding to the native operating environment or the cross-end container includes: The target data in the second data format or the first data format is read from the storage unit corresponding to the identifier in the shared storage area.
8. The method according to claim 1, wherein: The first data format is a Json format, and the second data format is a class instance serialization format.
9. A device for sharing data between a cross-end container and a native operating environment, wherein the cross-end container and the native operating environment are running on a target terminal, comprising: a data acquisition unit configured to acquire or update target data through the cross-end container or the native operating environment, and store the target data in a shared storage area in the native operating environment in a first data format corresponding to the cross-end container and a second data format corresponding to the native operating environment; The access unit is configured to access the shared storage area through the native operating environment or the cross-end container, and read target data in the second data format or the first data format corresponding to the native operating environment or the cross-end container.
10. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 8.
11. An electronic device comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 8 is implemented.