Interoperation method, medium and device between native application module and 3D module
By implementing the interoperability method between native application modules and 3D modules in the mobile APP, and using multi-process mechanisms to share memory pressure, the problem of a sharp increase in resource occupation after integrating 3D modules is solved, and the stability and interoperability of the application are achieved.
Patent Information
- Application Number
- CN202210856962.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-07-20
AI Technical Summary
After integrating 3D modules, existing mobile APPs can easily lead to a sharp increase in resource usage, resulting in application memory overflow or crash.
A free port is monitored through the native application module and the port number is written to the target file. The 3D module initializes the 3D engine in the child process, and obtains the port number by reading the content in the target file, establishes a connection between the native application and the 3D application, and realizes interoperability.
It effectively avoids the sharp increase in resource usage, prevents application memory overflow or crash, and at the same time realizes convenient and reliable interoperability between native application modules and 3D modules.
Smart Images

Figure CN115237624B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of 3D development technology, and in particular to a method, medium and device for interoperation between a native application module and a 3D module. Background Art
[0002] The technology used in traditional mobile client APP development is pure 2D development technology, which has a rich ecosystem, low learning cost, fast development speed, low investment cost, and can achieve rich plane interactive operations. However, the disadvantage is that it cannot display 3D scenes and cannot efficiently simulate the physical effects in reality. Although there are games that support 3D on the mobile side, almost all business logic is developed using 3D technology, which has high learning cost, slow development speed, high investment cost, and slow return. The detailed comparison table is as follows:
[0003] Mobile native APP Mobile Games Support 2D yes yes 3D support no Yes (including physics engine) Learning Difficulty Low high Development speed quick slow Development Cost Low high Tool Library Very many rare Program resource usage Low high Cross-platform no yes Number of users Very high Low
[0004] In the future, with further breakthroughs in hardware technology and further maturity of VR, AR, MR and other technologies, the 3D era of the metaverse will eventually arrive. More and more companies will introduce 3D engines that are currently used in games into existing native applications, and expand support for three-dimensional space-based operations in some scenarios. It is obviously unrealistic to rewrite large and complex application functions based on 3D engines in order to support 3D.
[0005] At present, there are few 3D engines that support integration into mobile apps, and even fewer technologies that integrate 3D modules into apps. For example, the Unity engine has just supported the function of integrating into apps as an application library, but the interaction method provided by the engine is relatively simple and can only support interaction within the same process. In addition, after integrating 3D modules, the originally complex mobile apps will face the problem of a sharp increase in resource usage, resulting in application memory overflow and crash or being terminated by the system. Summary of the invention
[0006] The purpose of the embodiments of the present application is to provide a method, medium and device for the interoperability of a native application module and a 3D module, so as to facilitate the interoperability of the native application module and the 3D module while avoiding the problem of a sharp increase in resource usage causing an application memory overflow crash or being terminated by the system.
[0007] In order to achieve the above purpose, the embodiments of the present application are implemented in the following manner:
[0008] In a first aspect, an embodiment of the present application provides an interoperability method between a native application module and a 3D module, wherein a mobile terminal APP includes a native application module and an integrated 3D module, and the method is applied to the mobile terminal APP, comprising: the native application module listens to an idle port through a native application, and writes the port number of the listening port to a target file after the listening is successful, wherein the target file is a specific file in a private directory on the file system that is only accessible to the mobile terminal APP itself; the 3D module is started through a native application, wherein the 3D module is located in a subprocess of the native application; the 3D module initializes a 3D engine, and after the 3D engine initialization is completed, starts the initialization of the 3D application, wherein the 3D module represents a functional module, the 3D application represents a specific application, and the 3D engine is used to drive the 3D application to run; the content of the target file is read through the 3D application to obtain the port number of the listening port; based on the port number, the listening port is connected through the 3D application to establish a connection between the native application and the 3D application, so as to realize the interoperability between the native application module and the 3D module.
[0009] In an embodiment of the present application, a 3D module is integrated in a mobile APP, a native application is used to monitor an idle port, and after the monitoring is successful, the port number of the listening port is written to a target file (a specific file in a private directory on the file system that is only accessible to the mobile APP itself), and the content in the target file is read by the 3D application to obtain the port number of the listening port; based on the port number, the listening port is connected through the 3D application to establish a connection between the native application and the 3D application, so as to realize the interoperability between the native application module and the 3D module. This method can realize the interoperability between the native application module and the 3D module very conveniently and reliably. In addition, after starting the 3D module, the 3D module can be located in the subprocess of the native application, and the multi-process mechanism can be used to share the memory pressure, thereby effectively avoiding the problem of a sharp increase in resource usage leading to an application memory overflow crash or being terminated by the system.
[0010] In combination with the first aspect, in a first possible implementation of the first aspect, a method of monitoring an idle port through a native application is: randomly selecting an idle port through the native application to start a TCP protocol Socket monitoring.
[0011] In this implementation, Socket and TCP protocols are interfaces and protocols supported by all current operating systems that support network communication, and therefore have good applicability.
[0012] In combination with the first aspect, in a second possible implementation of the first aspect, based on the port number, connecting to the listening port through the 3D application to establish a connection between the native application and the 3D application includes: opening a TCP protocol Socket through the 3D application, and initiating a connection to the listening port based on the port number; after the connection between the 3D application and the listening port is established, sending a verification package to the native application through the 3D application; verifying through the native application whether the first verification package sent by the 3D application is legal; if legal, the native application marks the connection as established and rejects any other connections thereafter; if illegal, the native application actively disconnects the current connection and continues to listen to other connections until the connection between the native application and the 3D application is verified to be legal.
[0013] In this implementation, this method can use the listening port to establish a connection between the native application and the 3D application, and verify the legitimacy of the connection, thereby ensuring the reliability of the connection between the native application and the 3D application.
[0014] In combination with the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, after the connection between the native application and the 3D application is verified to be legal, the method further includes: sending initialization data to the 3D application through the native application, so that the 3D module completes the initialization of the 3D application based on the initialization data.
[0015] In this implementation, the 3D application can be initialized in this way.
[0016] In combination with the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, after the 3D application is initialized, the method further includes: sending an operation request to the native application through the 3D application, wherein the operation request represents a request for the 3D application to operate the native application; and returning the operation result to the 3D application through the native application.
[0017] In this implementation, the interoperability between 3D applications and native applications can be easily achieved.
[0018] In combination with the first aspect, in a fifth possible implementation of the first aspect, after establishing a connection between the native application and the 3D application, the method further includes: the 3D module shuts down the 3D engine; the 3D application disconnects from the native application; and the native application shuts down monitoring of the monitoring port.
[0019] In this implementation, such processing can disconnect the 3D application from the native application and close the 3D module.
[0020] In a second aspect, an embodiment of the present application provides an interoperability method between a native application module and a 3D module, wherein a mobile APP includes a native application module and an integrated 3D module, wherein the 3D module is located in a subprocess of the native application, and the method is applied to the 3D module, including: starting initialization of the 3D application, wherein the 3D module represents a functional module, the 3D application represents a specific application, and the 3D engine is used to drive the 3D application to run; reading the content in a target file to obtain the port number of a listening port, wherein the target file is a specific file in a private directory on the file system that is accessible only to the mobile APP itself, and the target file contains the port number of an idle port listened to by the native application, and the idle port listened to by the native application is the listening port; based on the port number, connecting the listening port to establish a connection between the native application and the 3D application, thereby realizing the interoperability between the native application module and the 3D module.
[0021] In combination with the second aspect, in a first possible implementation of the second aspect, based on the port number, connecting to the listening port to establish a connection between the native application and the 3D application, including: opening a TCP protocol Socket, and initiating a connection to the listening port based on the port number; after the connection between the 3D application and the listening port is established, sending a verification package to the native application so that the native application can verify whether the first verification package sent by the 3D application is legal, wherein if the native application determines that the verification package is legal, the native application marks the connection as established and rejects any other connections thereafter; if the native application determines that the verification package is illegal, the native application actively disconnects the current connection and continues to listen to other connections until the connection between the native application and the 3D application is verified to be legal.
[0022] In combination with the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, after the connection between the native application and the 3D application is verified to be legal, the method further includes: receiving initialization data sent by the native application; and completing initialization of the 3D application based on the initialization data.
[0023] In combination with the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, after the 3D application is initialized, the method further includes: sending an operation request to the native application, wherein the operation request represents a request for the 3D application to operate the native application; and receiving the operation result returned by the native application.
[0024] In a third aspect, an embodiment of the present application provides a storage medium, wherein the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the interoperability method between the native application module and the 3D module described in any one of the first aspect or possible implementation methods of the first aspect.
[0025] In a fourth aspect, an embodiment of the present application provides a terminal device of a mobile APP, wherein the terminal device has a built-in mobile APP, and the mobile APP includes a native application module and an integrated 3D module, and is used to execute the interoperability method between the native application module and the 3D module described in any one of the first aspect or possible implementation methods of the first aspect through the native application module and the 3D module.
[0026] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 A flowchart of the interoperability method between the native application module and the 3D module applied to the mobile APP provided in an embodiment of the present application.
[0029] Figure 2 This is a timing diagram of the interaction between the native application module and the 3D module. DETAILED DESCRIPTION
[0030] First, for ease of understanding, here are some concepts that will be covered later:
[0031] Mobile APP: A third-party application, which can be understood as a client program. The mobile APP introduced in this article includes native application modules, and the 3D module is also integrated in the mobile APP.
[0032] Native application module: can be understood as the functional module of the native application.
[0033] Native application: an application that can run directly on the current operating system.
[0034] 3D module: represents a functional module.
[0035] 3D application: represents a specific application.
[0036] 3D engine: A tool used to drive 3D applications.
[0037] To facilitate understanding, here is an example to illustrate the relationship between the 3D module, 3D application, and 3D engine:
[0038] For example, iOS, Android, Windows, and macOS are different operating systems with completely different development technologies. "Xin" (targeting mobile apps) has a built-in mini-program runtime engine (the mini-program runtime engine is analogous to a 3D engine), enabling developers to directly develop mini-programs (the developed mini-programs are analogous to 3D applications) using only one language and the development interfaces, documentation, and tools provided by "Xin", which can run on these different operating systems.
[0039] "Xin", which can run on different operating systems, adapts to different operating systems at the lower level and provides a unified interface and language at the upper level, allowing developers to conveniently develop cross-platform mini-programs with specific functions. The developed mini-programs cannot run independently and must run within the "Xin" client (which contains the mini-program runtime engine). In the "Xin" client, the mini-program is just one module (this mini-program module is analogous to a 3D module), which can be understood as a function, and the Moments of "Xin" is also a module, one-on-one chat is a module, and payment is also a module.
[0040] Next, the technical solutions in the embodiments of the present application will be described in conjunction with the accompanying drawings in the embodiments of the present application.
[0041] Please refer to Figure 1 , Figure 1 , which is a flowchart of an interoperability method between a native application module and a 3D module for a mobile app provided by an embodiment of the present application.
[0042] In this embodiment, the interoperability method between the native application module and the 3D module (applied to a mobile app, which includes a native application module and an integrated 3D module) may include step S10, step S20, step S30, step S40, and step S50.
[0043] To achieve the interoperability between the native application module and the 3D module, the mobile app may execute step S10.
[0044] Step S10: The native application module listens for an idle port through the native application and writes the port number of the listening port to a target file after successful listening, where the target file is a specific file in a private directory on the file system that can only be accessed by the mobile app itself.
[0045] In this embodiment, the native application module may listen for an idle port through the native application.
[0046] For example, the method of monitoring an idle port through a native application can be: randomly selecting an idle port through the native application to start a TCP protocol Socket monitoring. Socket and TCP protocols are interfaces and protocols supported by all operating systems that currently support network communication, and therefore have good applicability.
[0047] After the monitoring is successful, the native application can write the port number of the monitoring port to the target file. Here, the target file is a specific file in a private directory on the file system that is only accessible to the mobile APP itself (i.e., the program itself). This specific file can be pre-generated or created in real time based on pre-set rules, which is not limited here.
[0048] After writing the port number of the listening port to the target file, the mobile APP can execute step S20.
[0049] Step S20: starting the 3D module through a native application, wherein the 3D module is located in a subprocess of the native application.
[0050] In this embodiment, the 3D module can be started through the native application, and the 3D module can be located in a sub-process of the native application, so that the memory pressure can be shared by utilizing the multi-process mechanism.
[0051] After starting the 3D module, the mobile APP can execute step S30.
[0052] Step S30: start initialization of the 3D application, wherein the 3D module represents a functional module, the 3D application represents a specific application, and the 3D engine is used to drive the 3D application to run.
[0053] In this embodiment, the 3D module can initialize the 3D engine. After the 3D engine is initialized, the initialization of the 3D application can be further started (the initialization of the 3D application requires subsequent initialization data, and here the initialization of the 3D application is started).
[0054] It should be noted that, if a 3D engine corresponds to one 3D application, the 3D engine needs to be initialized each time before starting the initialization of the 3D application, so that the 3D application can be further initialized after the 3D engine initialization is completed. If a 3D engine corresponds to multiple 3D applications, the 3D engine only needs to be initialized before starting the first 3D application (indicating the startup order of 3D applications, not the setting order of 3D applications). When starting subsequent 3D applications, since the 3D engine has been initialized, it does not need to be initialized again, and the initialization of subsequent 3D applications can be directly started.
[0055] After starting the initialization of the 3D application, the mobile APP may execute step S40.
[0056] Step S40: Read the content in the target file through the 3D application to obtain the port number of the listening port.
[0057] In this embodiment, the content in the target file (including the port number of the listening port written by the native application) can be read by the 3D application to obtain the port number of the listening port.
[0058] After obtaining the port number of the monitoring port, the mobile APP can execute step S50.
[0059] Step S50: Based on the port number, the 3D application is connected to the listening port to establish a connection between the native application and the 3D application, so as to achieve interoperability between the native application module and the 3D module.
[0060] In this embodiment, the mobile APP can connect to the listening port through the 3D application based on the port number to establish a connection between the native application and the 3D application, thereby realizing the interoperability between the native application module and the 3D module.
[0061] This method can easily and reliably realize the interoperability between native application modules and 3D modules. In addition, after starting the 3D module, the 3D module can be located in the sub-process of the native application, using the multi-process mechanism to share memory pressure, thereby effectively avoiding the problem of a sharp increase in resource usage leading to application memory overflow and crash or being terminated by the system.
[0062] For example, the mobile APP can open a TCP protocol socket through the 3D application, and then initiate a connection to the listening port based on the obtained port number. After the connection between the 3D application and the listening port is established, the 3D application can send a verification package to the native application. Then, the native application can verify whether the first verification package sent by the 3D application is legal:
[0063] If it is legitimate, the native application marks the connection as established and rejects any other connections thereafter.
[0064] If it is not legal, the native application will actively disconnect the current connection and continue to monitor other connections until the connection between the native application and the 3D application is verified to be legal.
[0065] This method can use the listening port to establish a connection between the native application and the 3D application, and verify the legitimacy of the connection to ensure the reliability of the connection between the native application and the 3D application.
[0066] After the connection between the native application and the 3D application is verified to be legitimate, the mobile APP can further send initialization data to the 3D application through the native application, so that the 3D module completes the initialization of the 3D application based on the initialization data.
[0067] After the 3D application is initialized, the mobile APP can send an operation request to the native application through the 3D application. Here, the operation request represents a request for the 3D application to operate the native application. Then, the native application can return the operation result to the 3D application. In this way, the interoperability between the 3D application and the native application can be easily realized.
[0068] If you need to exit the 3D module, the 3D module can shut down the 3D engine (or uninstall the 3D engine). Then, the 3D application disconnects from the native application, and the native application shuts down the monitoring port. This process can disconnect the 3D application from the native application and exit the 3D module.
[0069] To facilitate the understanding of this solution, here is an exemplary interoperation process between the native application module and the 3D module. Figure 2 , Figure 2 The following is a timing diagram of the interoperation between the native application module and the 3D module. The mobile APP can implement the interoperation between the native application module and the 3D module by following the steps below:
[0070] (1) Before starting the 3D module page, the native application randomly selects an idle port and starts a TCP protocol socket listener.
[0071] (2) After successful monitoring, the port number (such as 127.0.0.1:<port>, where the address is the local IP loopback address) is written to a file (i.e., the target file) with a specific file name on the file system and in a private directory that is accessible only to the program itself.
[0072] (3) The native application starts a 3D module, which can be located in a child process of the native application.
[0073] (4) After the 3D module engine initialization is completed, the 3D application initialization begins.
[0074] (5) Read the content of a file with a specific file name in a private directory on the file system that is accessible only to the program itself, and determine the port that the native application listens on.
[0075] (6) The 3D module opens a TCP socket and initiates a connection to 127.0.0.1:<port> (the local IP loopback address).
[0076] (7) After the connection is established, the 3D module immediately sends a verification package to the native application according to the customized private protocol.
[0077] (8) After the native application establishes a connection, it verifies whether the first verification packet sent by the other end is legal. If it is legal, it marks the connection as established and rejects any subsequent connections. If it is illegal, it actively disconnects the current connection and continues to listen for other connections.
[0078] (9) After the connection is verified to be legitimate, the native application sends initialization data to the 3D module, including the server address, basic information of the currently logged-in user, etc.
[0079] (10) The 3D application is initialized.
[0080] (11) After the 3D application is initialized, it can interoperate with the native application according to the agreed protocol package, including opening specific pages, pulling data, synchronizing status, etc.
[0081] (12) If you need to exit the 3D module, you must first uninstall or close the 3D engine.
[0082] (13) The 3D application disconnects after the engine is uninstalled or shut down.
[0083] (14) When the native application finds that the verified connection is disconnected, it closes the port it is listening on.
[0084] Table 1 below is an example of the protocol packet structure. The upper part shows the number of bytes occupied, and the lower part shows the description:
[0085] Table 1. Protocol packet structure example
[0086]
[0087] At present, there are few 3D engines that support integrating 3D application modules into mobile APPs. The Unity engine just supports the function of integrating into APPs as application libraries, but the interaction method provided by its engine is relatively simple and can only support interaction within the same process. It cannot effectively use the multi-process mechanism of the Android system to share memory pressure, resulting in the original complex mobile APP easily overflowing memory after integrating the 3D module. However, this solution cleverly combines multiple independent technologies to solve the problem of interaction between modules of different technologies in the same application. The native APP listens to any available port and uses the file system to pass the accurate port number. The 3D module obtains the port and makes a TCP connection to the port. After successful verification, it only exchanges interoperable data with the unique connection, and finally exits the 3D module to close the listening port. This allows applications written with the integrated 3D engine in multi-process mode to easily interoperate with native APP application modules, thereby effectively avoiding the problem of application memory overflow crash or system termination caused by a sharp increase in resource usage.
[0088] In addition, in this embodiment, the 3D module is used as the execution body, then the interoperability method between the native application module and the 3D module may include: initializing the 3D engine, and after the 3D engine initialization is completed, starting the initialization of the 3D application, wherein the 3D module represents a functional module, the 3D application represents a specific application, and the 3D engine is used to drive the 3D application to run; reading the content in the target file to obtain the port number of the listening port, wherein the target file is a specific file in a private directory on the file system that is only accessible to the mobile terminal APP itself, and the target file contains the port number of an idle port listened by the native application, and the idle port listened by the native application is the listening port; based on the port number, connecting the listening port to establish a connection between the native application and the 3D application, so as to realize the interoperability between the native application module and the 3D module.
[0089] Based on the port number, connecting to the listening port to establish a connection between the native application and the 3D application may be specifically performed as follows: opening a TCP protocol Socket, and initiating a connection to the listening port based on the port number; after the connection between the 3D application and the listening port is established, sending a verification packet to the native application so that the native application can verify whether the first verification packet sent by the 3D application is legal, wherein if the native application determines that the verification packet is legal, the native application marks the connection as established and rejects any other subsequent connections; if the native application determines that the verification packet is illegal, the native application actively disconnects the current connection and continues to listen to other connections until the connection between the native application and the 3D application is verified to be legal.
[0090] After the connection between the native application and the 3D application is verified to be legal, the method may further include: receiving initialization data sent by the native application; and completing initialization of the 3D application based on the initialization data.
[0091] After the 3D application is initialized, the method may further include: sending an operation request to the native application, wherein the operation request indicates a request for the 3D application to operate the native application; and receiving an operation result returned by the native application.
[0092] In this embodiment, the terminal device may be a smart terminal equipped with a mobile APP (the mobile APP includes a native application module and an integrated 3D module), such as a tablet computer, a smart phone, etc., which is not limited here.
[0093] Exemplarily, the terminal device may include: a communication module connected to the outside world through a network, one or more processors for executing program instructions, a bus and different forms of memory, such as a disk, ROM, or RAM, or any combination thereof.
[0094] Exemplarily, the memory stores programs, and the processor can call and run these programs (mobile APP programs) from the memory, so that the programs can be run, and the interoperability method of the native application module and the 3D module can be implemented through the execution of the native application module and the 3D module.
[0095] An embodiment of the present application provides a storage medium, which includes a stored program. When the program is running, a device where the storage medium is located is controlled to execute the interoperability method between the native application module and the 3D module of the present embodiment.
[0096] In summary, the embodiments of the present application provide a method, medium and device for interoperation between a native application module and a 3D module, integrate a 3D module in a mobile terminal APP, use a native application to monitor an idle port, and write the port number of the listening port to a target file (a specific file in a private directory on the file system that is only accessible to the mobile terminal APP itself) after the monitoring is successful, read the content in the target file through the 3D application to obtain the port number of the listening port; based on the port number, connect the listening port through the 3D application to establish a connection between the native application and the 3D application, and realize the interoperability between the native application module and the 3D module. This method can very conveniently and reliably realize the interoperability between the native application module and the 3D module. In addition, after starting the 3D module, the 3D module can be located in the subprocess of the native application, and the multi-process mechanism can be used to share the memory pressure, thereby effectively avoiding the problem of a sharp increase in resource usage leading to application memory overflow crash or system termination.
[0097] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0098] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for interoperation between a native application module and a 3D module, characterized in that: The mobile terminal APP includes a native application module and an integrated 3D module, wherein the native application module represents a functional module of the native application, the native application represents an application program running on the current operating system, the 3D module represents a functional module, the 3D application represents a specific application, the 3D engine is used to drive the 3D application to run, and the method is applied to the mobile terminal APP, including: The native application module monitors an idle port through a native application, and writes the port number of the monitored port to a target file after the monitoring is successful, wherein the target file is a specific file in a private directory on the file system that is only accessible to the mobile terminal APP itself; Starting the 3D module through a native application, wherein the 3D module is located in a subprocess of the native application; The 3D module initializes the 3D engine, and after the 3D engine initialization is completed, starts initialization of the 3D application; Read the content in the target file through the 3D application to obtain the port number of the listening port; Based on the port number, the 3D application is connected to the listening port to establish a connection between the native application and the 3D application, thereby realizing the interoperability between the native application module and the 3D module.
2. The method for interoperating between a native application module and a 3D module according to claim 1, characterized in that: The way to monitor an idle port through a native application is: A free port is randomly selected through the native application to start a TCP protocol Socket listening.
3. The method for interoperating between a native application module and a 3D module according to claim 1, characterized in that: Based on the port number, connecting the listening port through the 3D application to establish a connection between the native application and the 3D application includes: Open a TCP protocol socket through the 3D application, and initiate a connection to the listening port based on the port number; After the connection between the 3D application and the listening port is established, a verification packet is sent to the native application through the 3D application; The native application verifies whether the first verification packet sent by the 3D application is legal; if it is legal, the native application marks the connection as established and rejects any other connections thereafter; if it is illegal, the native application actively disconnects the current connection and continues to listen for other connections until the connection between the native application and the 3D application is verified to be legal.
4. The method for interoperating between a native application module and a 3D module according to claim 3, characterized in that: After the connection between the native application and the 3D application is verified to be legitimate, the method further includes: The initialization data is sent to the 3D application through the native application, so that the 3D module completes the initialization of the 3D application based on the initialization data.
5. The method for interoperating between a native application module and a 3D module according to claim 4, characterized in that: After the 3D application is initialized, the method further includes: Sending an operation request to the native application through the 3D application, wherein the operation request represents a request for the 3D application to operate the native application; The native application returns the operation result to the 3D application.
6. The method for interoperating between a native application module and a 3D module according to claim 1, characterized in that: After establishing the connection between the native application and the 3D application, the method further includes: The 3D module turns off the 3D engine; 3D applications are disconnected from native applications; The native application closes monitoring of the monitoring port.
7. A method for interoperation between a native application module and a 3D module, characterized in that: The mobile terminal APP includes a native application module and an integrated 3D module, wherein the native application module represents a functional module of the native application, the native application represents an application program running on the current operating system, the 3D module represents a functional module, the 3D application represents a specific application, the 3D engine is used to drive the 3D application to run, the 3D module is located in a subprocess of the native application, and the method is applied to the 3D module, including: Start initialization of 3D application; Read the content in the target file to obtain the port number of the listening port, wherein the target file is a specific file in a private directory on the file system that is accessible only to the mobile terminal APP itself, and the target file contains the port number of an idle port listened by the native application, and the idle port listened by the native application is the listening port; Based on the port number, the listening port is connected to establish a connection between the native application and the 3D application, thereby achieving interoperability between the native application module and the 3D module.
8. The method for interoperating between a native application module and a 3D module according to claim 7, characterized in that: Based on the port number, connecting the listening port to establish a connection between the native application and the 3D application includes: Open a TCP socket and initiate a connection to the listening port based on the port number. After the connection between the 3D application and the listening port is established, a verification packet is sent to the native application so that the native application can verify whether the first verification packet sent by the 3D application is legal. If the native application determines that the verification packet is legal, the native application marks the connection as established and rejects any other connections thereafter. If the native application determines that the verification packet is illegal, the native application actively disconnects the current connection and continues to listen to other connections until the connection between the native application and the 3D application is verified to be legal.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the interoperation method between the native application module and the 3D module according to any one of claims 1 to 6.
10. A terminal device for a mobile APP, characterized in that: The terminal device has a built-in mobile APP, which includes a native application module and an integrated 3D module, and is used to execute the interoperability method between the native application module and the 3D module described in any one of claims 1 to 6 through the native application module and the 3D module.
Citation Information
Patent Citations
Fast application starting method and device, equipment and storage medium
CN110990075A
Debugging method, electronic equipment and storage medium
CN114020621A