CN113032167A - Page communication method, device and equipment - Google Patents
Page communication method, device and equipment Download PDFInfo
- Publication number
- CN113032167A CN113032167A CN202110349208.4A CN202110349208A CN113032167A CN 113032167 A CN113032167 A CN 113032167A CN 202110349208 A CN202110349208 A CN 202110349208A CN 113032167 A CN113032167 A CN 113032167A
- Authority
- CN
- China
- Prior art keywords
- communication
- page
- data
- native application
- standard
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000006854 communication Effects 0.000 title claims abstract description 514
- 238000004891 communication Methods 0.000 title claims abstract description 499
- 238000000034 method Methods 0.000 title claims abstract description 144
- 230000000977 initiatory effect Effects 0.000 claims abstract description 27
- 230000001960 triggered effect Effects 0.000 claims abstract description 19
- 238000012545 processing Methods 0.000 claims description 46
- 230000008569 process Effects 0.000 claims description 30
- 238000004590 computer program Methods 0.000 claims description 10
- 230000004931 aggregating effect Effects 0.000 claims description 6
- 238000012544 monitoring process Methods 0.000 claims description 6
- 230000006870 function Effects 0.000 description 13
- 230000003993 interaction Effects 0.000 description 13
- 238000011161 development Methods 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000002776 aggregation Effects 0.000 description 3
- 238000004220 aggregation Methods 0.000 description 3
- 230000010365 information processing Effects 0.000 description 3
- 230000004044 response Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000007175 bidirectional communication Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000010422 painting Methods 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/542—Event management; Broadcasting; Multicasting; Notifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- Computer And Data Communications (AREA)
Abstract
The application discloses a page communication method, a page communication device and page communication equipment, and relates to the technical field of computers. The method comprises the following steps: determining a communication object which is mounted on a global object by a native application end according to an equipment type standard, wherein the communication object is used for placing communication data when a page is communicated with a native application in a queue pool and setting a callback identifier for the communication data; the communication methods in the communication objects mounted on the global object are aggregated, and then the uniform interface object is exposed; and initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the uniform interface object, so that the native application terminal calls the communication object and acquires communication data matched with a target callback identifier from the queue pool according to the target callback identifier carried in the data communication request. According to the method and the device, the compatibility of the page for the communication of the operating system can be realized, and the data acquisition efficiency in the page communication process is improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a page communication method, apparatus, and device.
Background
With the continuous popularization and optimization of the HTML5, the number of applications developed on the mobile side is increasing, and the h5 page embedded in the application by a developer needs to interact with the native application, such as transferring data, calling a function, and the like, so that the h5 page and the native application can be exposed to each other to achieve the purpose of mutual operation.
In the prior art, the interaction between the h5 page and the native application can use a bridge mode as a communication bridge, and is developed independently each time, so that the website link triggered by the user on the h5 page can be captured by the native application, and then the data callback of the h5 page is executed after the native application is analyzed and processed, thereby realizing the two-way communication between the h5 page and the native application.
In the process of communicating the h5 page with the native application, because the h5 page embedded in the application uses the standard of the bridge mode to be inconsistent, different h5 pages need to be respectively made for terminals of different operating systems, and the interaction logic in the h5 page calls different interfaces according to the operating systems, while the same h5 page needs to judge the operating system corresponding to the h5 page and call different interfaces according to the operating systems, so that the compatibility of the page for the communication of the operating systems is poor, and the data acquisition efficiency in the page communication process is affected.
Disclosure of Invention
In view of this, the present application provides a page communication method, device and apparatus, and mainly aims to solve the problems that in the prior art, the compatibility of a page for operating system communication is poor, and the data acquisition efficiency in the page communication process is affected.
According to a first aspect of the present application, there is provided a page communication method, including:
determining a communication object which is mounted on a global object by a native application end according to a device type standard, wherein the communication object is used for placing communication data when a page is communicated with the native application in a queue pool and setting a callback identifier for the communication data;
aggregating the communication methods in the communication objects mounted on the global object and exposing a uniform interface object;
and initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the uniform interface object, so that the native application terminal calls the communication object and acquires communication data matched with a target callback identifier from the queue pool according to the target callback identifier carried in the data communication request.
In another embodiment, after the determining that the native application is mounted to the communication object on the global object according to the device type standard, the method further includes: and judging the type of the equipment based on the communication object mounted on the global object.
In another embodiment, the determining the device type based on the communication object mounted to the global object specifically includes:
acquiring embedded parameter information formed by mounting the communication method on the global object based on the communication method mounted in the communication object on the global object;
and judging the type of the equipment by using the interface type object mapped by the embedded parameter information.
In another embodiment, before determining that the native application mounts to the communication object on the global object according to the device type standard, the method further includes:
if the communication object is not detected in the global object, judging the device type according to the user agent, and monitoring whether the native application end mounts the communication object corresponding to the device type into the global object.
In another embodiment, before determining that the native application mounts to the communication object on the global object according to the device type standard, the method further includes:
detecting whether a completion event sent by the native application terminal is received, wherein the completion event is used for indicating that the native application terminal has mounted the communication object on the global object and the communication object is initialized;
and if so, initializing page logic which needs to interact with the native application terminal in the page.
In another embodiment, initializing a page logic of the page that needs to interact with the native application, specifically includes:
placing codes corresponding to at least one page logic needing to interact with the native application end in the page into a callback array corresponding to a target method;
and sequentially calling back codes corresponding to the page logics in the callback array through the target method according to the callback array so as to sequentially execute initialization of the at least one page logic.
In another embodiment, before initiating a data communication request to the native application based on a page jump protocol, the method further comprises:
a data communication standard is formulated in advance according to communication logic related to communication between the page and the native application terminal;
the communication data carries information of a multi-level protocol data structure which accords with a preset target data communication standard.
In another embodiment, after initiating a data communication request to the native application based on a page jump protocol, the method further comprises:
and receiving a processing result obtained after the native application terminal processes the target data in the communication data according to the target data communication standard.
In another embodiment, the receiving a processing result obtained by the native application processing the target data in the communication data according to the target data communication standard includes: receiving the processing result obtained by the native application end according to the following mode:
combining the information in the first hierarchical structure and the information in the second hierarchical structure in the information according with the multi-hierarchical protocol data structure, and searching a pre-established data communication standard table according to a combination result;
and when the target data communication standard corresponding to the combination result exists in the data communication standard table, processing the target data according to the operation corresponding to the target data communication standard to obtain the processing result, wherein the target data is located in a third hierarchical structure in the information conforming to the multi-hierarchical protocol data structure.
In another embodiment, the method further comprises:
when an error identifier returned by the native application terminal is received, wherein the error identifier is used for indicating that the communication between the page and the native application terminal does not support the data communication standard corresponding to the combination result, and the data communication standard is updated according to the communication logic involved in the communication between the page and the native application terminal;
based on the updated data communication standard, transmitting the updated communication data from the page to the native application terminal, and initiating an updated data communication request to the native application terminal in a page jump protocol manner, so that the native application terminal processes the data in the updated communication data according to the updated data communication standard.
In another embodiment, when the communication data indicates a request to acquire game data from a service end, after the initiating a data communication request to the native application end based on a page jump protocol, the method further includes:
and receiving the game data generated by the service end responding to the calling of the native application end, and displaying the game data in the page.
In another embodiment, before initiating a data communication request to the native application based on a page jump protocol, the method further comprises:
and expanding communication logic related to communication between the page and the native application end and/or between the page and the service end through a supplementary protocol interface, and formulating a newly added data communication standard according to the expanded communication logic so that the native application end and/or the service end correspondingly processes data transmitted by the page according to the newly added communication standard.
According to a second aspect of the present application, there is provided a page communication apparatus, comprising:
the device comprises a determining unit, a determining unit and a processing unit, wherein the determining unit is used for determining a communication object which is mounted on a global object by a native application end according to a device type standard, the communication object is used for placing communication data when a page is communicated with the native application in a queue pool, and setting a callback identifier for the communication data;
the processing unit is used for exposing a uniform interface object after aggregating the communication methods in the communication objects mounted on the global object;
and the initiating unit is used for initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the unified interface object, so that the native application terminal calls the communication object and acquires communication data matched with the target callback identifier from the queue pool according to the target callback identifier carried in the data communication request.
In another embodiment, the apparatus further comprises:
and the judging unit is used for judging the device type based on the communication object mounted on the global object after the native application terminal is determined to be mounted on the communication object on the global object according to the device type standard.
In another embodiment, the judging unit includes:
the acquisition module is used for acquiring embedded parameter information formed by mounting the communication method on the global object based on the communication method in the communication object mounted on the global object;
and the judging module is used for judging the type of the equipment by using the interface type object mapped by the embedded parameter information.
In another embodiment, the apparatus further comprises:
the monitoring unit is used for judging the device type according to the user agent and monitoring whether the native application end mounts the communication object corresponding to the device type into the global object or not if the communication object is not detected in the global object before the native application end is determined to mount the communication object on the global object according to the device type standard.
In another embodiment, the apparatus further comprises:
the detection unit is used for detecting whether a completion event sent by a native application end is received or not before the native application end is determined to be mounted to a communication object on a global object according to a device type standard, wherein the completion event is used for indicating that the native application end mounts the communication object on the global object and the initialization of the communication object is completed;
and the initialization unit is used for initializing the page logic which needs to interact with the native application terminal in the page if the page logic needs to interact with the native application terminal.
In another embodiment, the initialization unit includes:
the releasing module is used for releasing the code corresponding to at least one page logic needing to be interacted with the native application end in the page into a callback array corresponding to a target method;
and the callback module is used for sequentially calling back codes corresponding to the page logics in the callback array through the target method according to the callback array so as to sequentially execute initialization of the at least one page logic.
In another embodiment, the apparatus further comprises:
the data communication standard is established in advance according to communication logic related to communication between the page and the native application terminal before a data communication request is initiated to the native application terminal based on a page jump protocol;
the communication data carries information of a multi-level protocol data structure which accords with a preset target data communication standard.
In another embodiment, the apparatus further comprises:
and the receiving unit is used for receiving a processing result obtained after the native application terminal processes the target data in the communication data according to the target data communication standard after initiating a data communication request to the native application terminal based on a page jump protocol.
In another embodiment, the receiving unit specifically includes: receiving the processing result obtained by the native application end according to the following mode:
combining the information in the first hierarchical structure and the information in the second hierarchical structure in the information according with the multi-hierarchical protocol data structure, and searching a pre-established data communication standard table according to a combination result;
and when the target data communication standard corresponding to the combination result exists in the data communication standard table, processing the target data according to the operation corresponding to the target data communication standard to obtain the processing result, wherein the target data is located in a third hierarchical structure in the information conforming to the multi-hierarchical protocol data structure.
In another embodiment, the apparatus further comprises:
an updating unit, configured to, when receiving an error identifier returned by the native application, where the error identifier is used to indicate that communication between the page and the native application does not support a data communication standard corresponding to the combination result, update the data communication standard for a communication logic involved in communication between the page and the native application;
and the transfer unit is used for transferring the updated communication data from the page to the native application terminal based on the updated data communication standard, and initiating an updated data communication request to the native application terminal in a page jump protocol mode, so that the native application terminal processes the data in the updated communication data according to the updated data communication standard.
In another embodiment, the apparatus further comprises:
and the display unit is used for receiving the game data generated by the service end responding to the calling of the native application end after the data communication request is initiated to the native application end based on the page jump protocol when the communication data indicates that the game data is requested to be acquired from the service end, and displaying the game data in the page.
In another embodiment, the apparatus further comprises:
and the supplementary unit is used for expanding communication logic related to communication between the page and the native application end and/or between the page and the service end through a supplementary protocol interface before a data communication request is initiated to the native application end based on a page jump protocol, and formulating a newly added data communication standard according to the expanded communication logic so that the native application end and/or the service end correspondingly processes data transmitted by the page according to the newly added communication standard.
According to a third aspect of the present application, there is provided a computer device comprising a memory storing a computer program and a processor implementing the steps of the method of the first aspect when the computer program is executed.
According to a fourth aspect of the present application, there is provided a readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of the first aspect described above.
By the technical scheme, compared with the page communication mode that different interfaces need to be called according to an operating system in the existing mode, the page communication method, the page communication device and the page communication equipment have the advantages that the communication method mounted in the communication object on the global object is aggregated and then the unified interface object is exposed, the interaction self protocol of the communication page can be determined, the compatibility processing is carried out on different operating systems, further, according to the detected data communication requirement triggered by the unified interface object, a data communication request is sent to the native application end based on the page jump protocol, so that the native application end calls the communication object and obtains the communication data matched with the target callback identification from the queue pool according to the target callback identification carried in the data communication request, the different operating systems can be compatible, and the native application end can be used for realizing the information acquisition of the page communication process, therefore, the communication between the page and the native application terminal is realized, and the data acquisition efficiency in the page communication process is improved.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a flowchart illustrating a page communication method provided in an embodiment of the present application;
FIG. 2 is a flowchart illustrating another page communication method provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of a page communication apparatus provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of another page communication apparatus provided in the embodiment of the present application;
fig. 5 is a schematic device structure diagram of a computer apparatus according to an embodiment of the present invention.
Detailed Description
The content of the invention will now be discussed with reference to a number of exemplary embodiments. It is to be understood that these examples are discussed only to enable those of ordinary skill in the art to better understand and thus implement the teachings of the present invention, and are not meant to imply any limitations on the scope of the invention.
As used herein, the term "include" and its variants are to be read as open-ended terms meaning "including, but not limited to. The term "based on" is to be read as "based, at least in part, on". The terms "one embodiment" and "an embodiment" are to be read as "at least one embodiment". The term "another embodiment" is to be read as "at least one other embodiment".
For the webpage view of the application end and the h5 page used in the embedded webpage view of the game, because the webpage view cannot call related method objects, the h5 page needs to communicate with the native application to mutually transmit page data. In the related art, the interaction between the h5 page and the native application can use a bridge mode as a communication bridge, and is developed independently each time, so that a website link triggered by a user on the h5 page can be captured by the native application, and then the data callback of the h5 page is executed after the native application is analyzed and processed, and the bidirectional communication between the h5 page and the native application is realized. However, because the standards of the application embedded h5 page using the bridge mode are not consistent, different h5 pages need to be respectively manufactured for terminals of different operating systems, and the operating system corresponding to the h5 page needs to be judged, and different interfaces are called according to the operating system, so that the compatibility of the page for the operating system communication is poor, and the data acquisition efficiency of the page communication process is affected.
In order to solve the problem, the present embodiment provides a page communication method, as shown in fig. 1, which is applied to a page end, and includes the following steps:
101. and determining a communication object mounted on the global object by the native application according to the equipment type standard.
In this embodiment, when a client (e.g., a web side or an application side with an embedded page) opens a page, the page needs to interact with a native application, for example, current user information is acquired, and a process of interacting a specific page side with the native application is equivalent to interacting with a development language used by the native application based on a script file in a front end of the page, and during the process of interacting the script file with the native application.
It can be understood that the native application has an interface for calling the script file of the page end, and can be mounted to the object to the page at any time (for example, by mounting the object to the window), so as to obtain the calling information of the page end, and the script file has no capability of naturally calling the native application. In the above embodiment, the native application may mount a communication object on the global object, implement data communication between the page end and the native application based on the exposed unified interface object and the communication object mounted on the global object, where the communication object is used to place communication data when the page communicates with the native application in a queue pool, and set a callback identifier (e.g., callbackid) for the communication data, where the callback identifier is equivalent to a unique identifier of the communication data, and can accurately obtain corresponding communication data from the queue pool during subsequent page communication, for example, the queue pool stores communication data a1 as album data, communication data a2 is a chat record, communication data A3 is a page state, and the callback identifier a2 can obtain the chat record.
The execution subject of this embodiment may be a page communication device or device, and may be configured at the page end, and during the communication process between the page end and the native application, the page end may identify different operating system environments by using the communication object mounted on the global object, and after registering the bridge mode (i.e., bridge, also referred to as bridge object, for example, the communication object in this embodiment), all communication methods are mounted on the communication object, although different operating systems may have different names of the communication object, for a user of the page development end, only the method provided by the page development end (i.e., the uniform interface object) needs to be called, and the actual communication process occurs on the communication object, so that the native application is used to perform communication between the page end and the native application according to the communication object mounted on the web page view (i.e., window) by using different operating systems (or device types) during initialization, different interfaces are prevented from being called aiming at pages under different equipment types, flexible interaction between the script file and the native application can be realized more conveniently, and the flexibility and the safety of the development process are improved.
102. And after the communication methods mounted in the communication objects on the global object are subjected to aggregation processing, exposing the uniform interface object.
In an actual application scenario, a bridge mode is required in an interaction process between a native application end and a page end, where the bridge mode (i.e., the communication object) is equivalent to an auxiliary tool for communication between the page end and the native application, and since the page end cannot directly call an api in the native application end, data interaction between the page end and the native application needs to be completed by using the bridge mode, and further, data information obtained by the native application end after executing corresponding operations can be received at the page end, so that rich data information is displayed at the page end.
When the native application is initialized, the bridge code may be dynamically injected, and the initialization of the bridge object is completed, so that the mounting of the bridge object into the window is completed, wherein the bridge object includes but is not limited to the communication object. Optionally, when the device type is an ios end, the communication object may use a webviewjavascript bridge object in window, when the device type is an android end, the WVJBCallbacks object may be used, and when the device type is an android simulator at a PC end, the WVJBCallbacks object may be used. Through the communication object, the page end can call an interaction control with the native application, even jump to other native application pages, and further can acquire the device state, the network state, the user information and the like of the native application at the moment through interaction, the native application can call a desired operation according to requirements through the state of the page at the moment, the communication object usually comprises a communication method, for example, a communication method for judging whether a third-party application is installed or not and acquiring the network information and the like, in order to be compatible with different operating systems, the page end can perform adaptation processing in code logic, and a uniform interface object is exposed after the communication methods are aggregated, so that the interaction logic in the page can call the uniform interface object for different operating systems.
103. And initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the uniform interface object.
The data communication request is initiated based on a page jump protocol, the data communication request may be initiated based on scheme or iframe-scheme (for example, in a lower-version android terminal), or other self-defined protocols are used, the browser may initiate a data acquisition request to the native application through the page jump protocol, and the native application intercepts and analyzes the data acquisition request, so as to implement communication from the page terminal to the native application.
In the embodiment of the invention, when a service end needs to execute a certain page function, the service end can trigger a data communication request through a uniform interface object, then the page can initiate the data communication request to a native application according to the corresponding data communication request based on a page jump protocol, particularly in the process of initiating the data communication request to the native application, a callback identifier can be embedded into a data acquisition request and sent to the native application, and as the callback identifier is the only identifier of communication data, the native application can acquire the communication data matched with the callback identifier from a queue pool by calling the communication object. Optionally, the intra-page jump protocol may be a web page link, designed to facilitate native application inter-call. In actual development, the native application does not register a corresponding intra-page jump protocol, but a front-end page triggers the intra-page jump protocol in a certain way, then a data acquisition request carrying a callback identifier is sent to the native application, the native application calls a communication object to acquire corresponding communication data transmitted by a page, and specific operation is executed according to the data communication standard by analyzing the data communication standard corresponding to the communication data.
In the page communication process, the front-end page can define a data structure when the pages are mutually transmitted according to different data mutual transmission requirements, and a set of protocol (namely a data communication standard) is maintained between the page end and the native application to realize different page functions. Wherein different data communication standards may correspond to different data structures.
Furthermore, in order to realize customized development of the page, the data communication standards of the page end and the native application can be customized, and different customization functions such as custom navigation header, universal sharing, universal encryption function and the like are carried out, so that modularization of the data channel function is solved, and the flexibility of page development is improved.
Furthermore, in order to realize customized development of the newly added functions of the page, a supplementary protocol interface can be opened, agreement is carried out with application accessed to a software toolkit when the page is used, after a communication protocol standard is determined, the customized interface is opened, and after different games or application terminals are accessed to the software toolkit (SDK), a user-defined sub-protocol can be added according to own service requirements so as to process specific service flows, such as barrage information transparent transmission in a live broadcast room, gift information transparent transmission in the live broadcast room and the like.
Compared with the page communication mode that different interfaces need to be called according to an operating system in the existing mode, the page communication method provided by the embodiment of the application can determine the interaction self protocol of the communication page by aggregating the communication methods in the communication objects mounted on the global object and exposing the unified interface object, can perform compatibility processing aiming at different operating systems, further initiates a data communication request to the native application terminal based on the page jump protocol according to the detected data communication requirement triggered by the unified interface object, so that the native application terminal calls the communication object and obtains the communication data matched with the target callback identifier from the queue pool according to the target callback identifier carried in the data communication request, can be compatible with different operating systems and can realize the information acquisition of the page communication process by using the native application terminal, therefore, the communication between the page and the native application terminal is realized, and the data acquisition efficiency in the page communication process is improved.
Further, as a refinement and an extension of the specific implementation of the above embodiment, in order to fully describe the specific implementation process of the embodiment, the embodiment provides another page communication method, as shown in fig. 2, the method includes:
201. and detecting whether a completion event sent by the native application terminal is received.
The completion event is used to indicate that the native application has mounted the communication object on the global object and has completed initialization of the communication object (i.e. indicate that the communication object can be called), and since the native application may hang on the communication object in the global object according to the device type standard during initialization, once the native application completes initialization, the completion event is sent to the page side to notify the page side.
It is understood that the communication object serves as a communication bridge between the native application code and the page script code, and includes, in addition to the method for calling the handler, a method for registering a local script so that the page side registers some methods for the native application to call, and a method for calling or calling the page side so that the native application calls back or calls the page side by methods. Generally, a page data mutual transmission requirement is basically triggered by a service requirement after a page is completely loaded, when the page loading is completed and the bridge mode initialization is completed, a page end initiates a request to a native application and acquires basic information as required, but sometimes the page loading is too fast, so that a communication object of a corresponding operating system is not yet hung on a global object by the native application, and an error is reported. Specifically, in the actual application, the completion event may be a native tojs method, and after the initialization of the native application is completed, the native tojs method added to the application system by the page is actively called to inform that the bridging mode at the page end can be called at present, and after the page receives a notification that the bridging mode is available, the initialization process is executed.
It should be noted that, while the native application sends the completion event to the page, if the page end receives the completion event, the page end correspondingly feeds back the initialization completion event reminder to the native application, and if the native application does not receive the initialization completion event reminder sent by the page, the native application still continuously sends the completion event to the page.
202. And if so, initializing page logic which needs to interact with the native application terminal in the page.
In the embodiment of the invention, when the page determines that the initialization of the native application is completed, particularly in the process of initializing the page logic which needs to interact with the native application terminal in the page, the code corresponding to at least one page logic in the page that needs to interact with the native application can be put into the callback array corresponding to the target method, and further according to the callback array, sequentially calling back codes corresponding to the page logics in the calling-back array through the target method so as to sequentially execute initialization of at least one page logic, for example, the code logic that the page needs to interact with the native application includes page logic A1-A5, the initialization of page logic A1-A5 is achieved by placing the code of page logic A1-A5 in a callback array to call back the code of page logic A1-A5 in turn by the target method.
Specifically, in the actual application process, the target method may be a ready method, and the code logic to be initialized is placed in the callback of the ready method by adding the ready method, where the code logic to be initialized is a page code to be interacted with the native application, and a page information configuration logic is performed, if the role information embedded in the game and the page logic after the server information is acquired perform page initialization configuration and the like, the ready may be called back for many times, and the callback is maintained by a callback array.
203. If the communication object is not detected in the global object, judging the device type according to the user agent, and monitoring whether the native application end mounts the communication object corresponding to the device type into the global object.
It can be understood that the process of step 201 to step 202 is mainly directed to the global object in which the native application has been initialized and has mounted the communication object to the page, at which time the communication object can be detected in the global object, and if the native application has not been initialized, that is, the situation described in step 203, the communication object cannot be detected in the global object, at which time the device type can be determined according to the user agent, and it can be intercepted whether the native application mounts the communication object corresponding to the device type in the global object.
Specifically, in the process of determining the device type according to a user agent (for example, usergent), different device model user agents carry different attribute values, the attribute values can reflect the model environment (namely, the device type) where the native application is located, and further the page end can identify the model environment where the native application is located according to the attribute values in the user agent, so that the corresponding interface type can be known according to the model environment, and the interface types can be respectively corresponding to different model environments such as ios, android and android simulators.
204. And determining a communication object mounted on the global object by the native application according to the equipment type standard.
It is understood that the bridge mode serves as a communication bridge between the native application code and the script code, and the native application can mount a communication object of a corresponding device standard into the global object, so that a subsequent native application can use the mounted communication object to implement page communication, where the communication object in the global object may include, in addition to a method for calling a handler, a method for registering a local script, so that a page side registers some methods for the native application to call through the method, and may also include calling or calling a page side method, so that the native application calls back or calls the page side through the method.
205. And judging the type of the equipment based on the communication object mounted on the global object.
In the embodiment of the present invention, the communication objects mounted to the global object by the native application terminals of different device types are different, for example, the native application of the ios device type uses a webviewjavascript bridge communication object, the native application of the android device type uses a WVJBCallbacks communication object, and the native application of the low-version android device type actively triggers a WVJBCallbacks response in an iframe-scheme manner. Here, the device type may be determined based on the communication object mounted to the global object.
Furthermore, the method for mounting native applications of different operating systems on the global object has different naming and using modes and different initialization time, and needs to perform unified processing on the points after the device type is determined. Specifically, embedded parameter information formed by the communication method mounted on the global object may be obtained based on the communication method in the communication object mounted on the global object, where the embedded parameter information is equivalent to parameter information mounted on the global object by different operating systems, and the parameter information at least includes interface types, method information, calling time, and the like of the different operating systems, and then the device type is determined by using the interface type object mapped by the embedded parameter information.
206. And after the communication methods mounted in the communication objects on the global object are subjected to aggregation processing, exposing the uniform interface object.
In the embodiment of the present invention, since the parameter information of different operating systems corresponds to the interface types of corresponding operating systems, the unified interface object is only used as a compatible interface exposed on the page, so that in the subsequent calling process, the interface types are selectively called by the unified interface object according to the service requirements, for example, the calling of an interface for monitoring whether the bridge is initialized, a getUserInfo interface, an openlnbroswer interface, and an uploadImg can be realized. In the android operating system, the android native application notifies a page end in the form of an event; and in the ios end operating system, the page end performs polling to judge whether the bridging object exists. The getUserInfo interface can call different methods provided by different native applications and acquire callbacks; exposed part of the interfaces are called when needed, for example, openinbrowser interface for opening pages in an external browser and uploadImg interface for uploading pictures through native applications.
207. A data communication standard is formulated in advance according to communication logic related to communication between the page and the native application terminal;
in order to support different page functions, the page side may set a data communication standard belonging to the page side in advance for a communication logic involved in communication between the page and the native application side, where the communication logic may be a communication requirement triggered by the service side in actual application, for example, obtaining game data, calling a camera, browsing an album, and the like.
Specifically, corresponding multi-level protocol data structures can be formulated for different data communication standards, and when a page terminal transmits communication data to a native application terminal, the communication data carries information of the multi-level protocol data structures which meet a pre-formulated target data communication standard, so that different data communication standards can be represented by being capable of agreeing different multi-level protocol data structures, and the different data communication standards correspond to different page functions, so that various different functions can be realized at the page terminal. The page end can place multi-level information meeting the data communication standard in the communication data, so that the native application can process the communication data according to the data communication standard after acquiring the communication data according to the data communication request. The commands with the master-slave relationship may be defined in the multi-layer protocol data structure, for example, the first layer protocol structure is defined as a master command, the second protocol structure is defined as a sub command, and at this time, the master command needs to be executed first and then the sub command needs to be executed, and the commands with the parallel relationship may also be defined in the multi-layer protocol structure, for example, the first layer protocol structure is defined as an a command, the second layer protocol structure is defined as a B command, and at this time, the a command and the B command need to be executed simultaneously.
Furthermore, in order to improve the flexibility of the page function, a mode of customizing the page function can be provided, at this time, communication logic related to communication between the page and the native application terminal and/or between the page and the service terminal can be expanded through the supplementary protocol interface, and a newly added data communication standard is formulated according to the expanded communication logic, so that the native application terminal and/or the service terminal correspondingly processes data transmitted by the page according to the newly added communication standard. Similarly, the new data communication standard is substantially the same as the data communication standard, and may also have a multi-layer protocol data structure, and the page side may transmit the communication data conforming to the new data communication standard to the native application side, so that the native application side performs a specific operation (for example, processing of target data in the communication data) according to the new data communication standard when page communication is performed.
208. And initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the uniform interface object.
The format of the intra-page jump protocol may be predefined for the page side and the native application side.
It should be noted that, for different device models, the native application terminal has different ways of capturing the intra-page jump protocol, for the android operating system, a preset method may be defined, the preset method may be capable of responding to a hyperlink button in a page, when a certain link is triggered, the preset method is called to capture the intra-page jump protocol triggered by a full object, and for the ios operating system, the native application terminal may obtain a notification in the native application layer through a delegated pointer function, so that the native application may capture the intra-page jump protocol triggered by the full object in the page terminal.
In the embodiment of the invention, after capturing a page jump protocol, a native application terminal firstly calls a communication object and acquires communication data matched with a target callback identifier from a queue pool according to the target callback identifier carried by a data communication request, and then executes corresponding processing and returns a processing result according to a data communication standard corresponding to the communication data in a predefined data communication standard.
209. And receiving a processing result obtained after the native application terminal processes the target data in the communication data according to the target data communication standard.
Wherein, the processing result is a result formed by the native application processing the target data in the communication data, and specifically, the processing result obtained by the native application according to the following manner can be received, because the data communication standard has a multi-level protocol data structure, the information in the first level structure and the information in the second level structure in the information conforming to the multi-level protocol data structure can be firstly combined, and a pre-established data communication standard table is searched according to the combination result, the data communication standard table records the data communication standard agreed in advance by the page end and the native application, each data communication standard has a corresponding multi-level protocol data structure, and further, when the target data communication standard corresponding to the combination result exists in the data communication standard table, the target data is processed according to the operation indicated by the combination result, and obtaining a processing result, wherein the target data is positioned in a third hierarchical structure in the multi-hierarchical protocol data structure. For example, after the information a of the first hierarchical structure and the information B of the second hierarchical structure are combined to form the combined result C, that is, after the native application acquires the communication data, combining the information a and the information B to form the combined result C does not indicate that the operation can be directly performed according to the combined result C, but it is also necessary to determine whether a data communication standard corresponding to the combined result C is agreed between the page side and the native application side in combination with the data communication standard table, and if so, perform the corresponding operation according to the combined result C.
For example, the page side and the native application side have agreed a plurality of data communication standards, the plurality of data communication standards include a target data communication standard, and a multi-level protocol data structure corresponding to the target data communication standard is composed of three parts: a first hierarchy, a second hierarchy, and a third hierarchy. The first hierarchical structure is used for carrying commands, the second hierarchical structure is used for carrying subcommands, and the third hierarchical structure is used for carrying specific data (such as the target data). The communication data transmitted from the page side to the native application side includes information conforming to the multi-level protocol data structure, and the information in the first level structure, the second level structure and the third level structure are respectively: A. b, D are provided. After the native application obtains the communication data in the above manner in this embodiment, A, B combine the information in the first hierarchical structure and the second hierarchical structure respectively to obtain C, and search the data communication standard table according to C, and after finding the data communication standard corresponding to C, execute corresponding operation according to the data communication standard. For example, one data communication standard corresponding to C exists in the data communication table as: and calling the camera to photograph and upload, executing the operation of calling the camera to photograph and upload by the native application terminal, and uploading the photograph to the URL corresponding to the information (namely D) in the third hierarchical structure.
In an actual application scenario, an abnormal situation may exist in the process of processing communication data by the native application end, at this time, the native application end does not return a processing result, but returns an error identifier, specifically, when the error identifier returned by the native application end is received, the error identifier is used for indicating that the communication between the page and the native application end does not support a data communication standard corresponding to the combined result, at this time, it is described that the processing result of the communication data cannot be returned based on the original data communication standard, a new data communication standard is further formulated for a communication logic related to the communication between the page and the native application, and the new data communication standard is updated into the data communication standard table; the page end can transmit new communication data which accords with the newly-added data communication standard to the native application end, the communication object places the new communication data into the queue pool and sets a corresponding callback identifier, the callback identifier corresponding to the new communication data in the queue pool is different from the previous callback identifier, and an updated data communication request is initiated to the native application in a page jump protocol mode, so that the native application end processes the data in the updated communication data according to the updated data communication standard.
In order to facilitate flexible use of the page by the service end, a data communication standard can be formulated for the page and the service end, game data generated by the service end responding to calling of the native application end is received, and the game data is displayed in the page. Specifically, for an application scenario of a service end and a game end, a page end and the game end can specify a data communication standard M, communication data transmitted by the page end can be communication data meeting the data communication standard M, the native application end obtains the communication data based on a data communication request of a page, the game data is further called according to the data communication standard M corresponding to the communication data, and the game data is returned to the page end, so that the game data called by the native application is displayed at the page end.
In this embodiment, the page end may establish a data communication standard with the service end, for example, the page end and the service end need to use the data communication standard M for interaction, the page end notifies the native application end of a request for requesting communication with the service end based on the data communication standard M, the native application end continues to transmit to the service end after identification, after the service end confirms, the native application end returns a confirmation result to the page end, and at the same time, the native application end supplements the data communication standard M in the data communication standard table, so that the page end can subsequently interact with the service end based on the data communication standard M.
Further, as a specific implementation of the method in fig. 1 and fig. 2, an embodiment of the present application provides a page communication apparatus, as shown in fig. 3, the apparatus includes: a determining unit 31, a processing unit 32, an initiating unit 33.
The determining unit 31 may be configured to determine a communication object that a native application is mounted to a global object according to a device type standard, where the communication object is configured to place communication data when a page communicates with the native application in a queue pool, and set a callback identifier for the communication data;
the processing unit 32 may be configured to expose the uniform interface object after performing aggregation processing on the communication methods in the communication objects mounted on the global object;
the initiating unit 33 may be configured to initiate a data communication request to the native application based on a page jump protocol according to the detected data communication requirement triggered by the uniform interface object, so that the native application invokes the communication object and obtains, according to a target callback identifier carried in the data communication request, communication data matched with the target callback identifier from the queue pool.
Compared with the page communication mode that different interfaces need to be called according to an operating system in the existing mode, the page communication device provided by the embodiment of the invention can determine the interaction self protocol of the communication page by aggregating the communication method in the communication object mounted on the global object and exposing the uniform interface object, can perform compatibility processing aiming at different operating systems, further initiates a data communication request to the native application end based on the page jump protocol according to the detected data communication requirement triggered by the uniform interface object, so that the native application end calls the communication object and obtains the communication data matched with the target callback identification from the queue pool according to the target callback identification carried in the data communication request, can be compatible with different operating systems and can utilize the native application end to realize the information acquisition of the page communication process, therefore, the communication between the page and the native application terminal is realized, and the data acquisition efficiency in the page communication process is improved.
In a specific application scenario, as shown in fig. 4, the apparatus further includes:
the determining unit 34 may be configured to, after the determining that the native application is mounted to the communication object on the global object according to the device type standard, determine the device type based on the communication object mounted to the global object.
In a specific application scenario, as shown in fig. 4, the determining unit 34 includes:
an obtaining module 341, configured to obtain embedded parameter information formed by mounting the communication method to the global object based on the communication method in the communication object mounted to the global object;
the determining module 342 may be configured to determine the device type by using the interface type object mapped by the embedded parameter information.
In a specific application scenario, as shown in fig. 4, the apparatus further includes:
the listening unit 35 may be configured to, before determining that the native application is mounted to a communication object on the global object according to the device type standard, determine a device type according to the user agent if the communication object is not detected in the global object, and listen whether the native application mounts the communication object corresponding to the device type to the global object.
In a specific application scenario, as shown in fig. 4, the apparatus further includes:
a detecting unit 36, configured to detect whether a completion event sent by a native application is received before determining that the native application is mounted to a communication object on a global object according to a device type standard, where the completion event is used to indicate that the native application has mounted the communication object on the global object and the initialization of the communication object is completed;
the initializing unit 37 may be configured to initialize a page logic in the page, which needs to interact with the native application, if yes.
In a specific application scenario, as shown in fig. 4, the initialization unit 37 includes:
the releasing module 371 may be configured to release, to a callback array corresponding to a target method, a code corresponding to at least one page logic that needs to interact with the native application in the page;
the callback module 372 may be configured to perform callback on codes corresponding to the page logics in the callback array in sequence by using the target method according to the callback array, so as to sequentially perform initialization on the at least one page logic.
In a specific application scenario, as shown in fig. 4, the apparatus further includes:
the formulating unit 38 may be configured to formulate a data communication standard in advance for a communication logic involved in communication between the page and the native application before initiating a data communication request to the native application based on a page jump protocol;
the communication data carries a multi-level protocol data structure which accords with a preset target data communication standard.
In a specific application scenario, the apparatus further includes:
the receiving unit 39 may be configured to receive a processing result obtained after the native application processes the target data in the communication data according to the target data communication standard after initiating a data communication request to the native application based on a page jump protocol.
In a specific application scenario, the receiving unit 39 may specifically include: receiving the processing result obtained by the native application end according to the following mode:
combining information in a first hierarchical structure and information in a second hierarchical structure in the multi-hierarchical protocol data structure, and searching a pre-established data communication standard table according to a combination result;
and when the target data communication standard corresponding to the combination result exists in the data communication standard table, processing the target data according to the operation indicated by the combination result to obtain the processing result, wherein the target data is located in a third hierarchical structure in the multi-hierarchical protocol data structure.
In a specific application scenario, the apparatus further includes:
an updating unit, configured to update a data communication standard for a communication logic involved in communication between the page and the native application when receiving an error flag returned by the native application, where the error flag is used to indicate that the communication between the page and the native application does not support the data communication standard corresponding to the combination result;
the delivery unit may be configured to deliver updated communication data from the page to the native application based on the updated data communication standard, and initiate an updated data communication request to the native application in a page jump protocol manner, so that the native application processes data in the updated communication data according to the updated data communication standard.
In another embodiment, the apparatus further comprises:
the display unit may be configured to receive, when the communication data indicates a request to acquire game data from a service end, the game data generated by the service end in response to the invocation of the native application end after the data communication request is initiated to the native application end based on a page jump protocol, and display the game data in the page.
In another embodiment, the apparatus further comprises:
the supplementary unit may be configured to, before initiating a data communication request to the native application terminal based on a page jump protocol, expand communication logic related to communication between the page and the native application terminal and/or between the page and a service terminal through a supplementary protocol interface, and formulate a new data communication standard according to the expanded communication logic, so that the native application terminal and/or the service terminal performs corresponding processing on data transmitted by the page according to the new communication standard.
It should be noted that other corresponding descriptions of the functional units related to the page communication apparatus provided in this embodiment may refer to the corresponding descriptions in fig. 1 to fig. 2, and are not described herein again.
Based on the method shown in fig. 1-2, correspondingly, the embodiment of the present application further provides a storage medium, on which a computer program is stored, and the program, when executed by a processor, implements the page communication method shown in fig. 1-2.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the implementation scenarios of the present application.
Based on the method shown in fig. 1-2 and the virtual device embodiment shown in fig. 3-4, to achieve the above object, an embodiment of the present application further provides a physical device for page communication, which may be specifically a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, where the physical device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing a computer program to implement the page communication method as described above with reference to fig. 1-2.
Optionally, the entity device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
In an exemplary embodiment, referring to fig. 5, the entity device includes a communication bus, a processor, a memory, and a communication interface, and may further include an input/output interface and a display device, where the functional units may communicate with each other through the bus. The memory stores computer programs, and the processor is used for executing the programs stored in the memory and executing the painting mounting method in the embodiment.
Those skilled in the art will appreciate that the physical device structure of page communication provided in this embodiment does not constitute a limitation to the physical device, and may include more or less components, or combine some components, or arrange different components.
The storage medium may further include an operating system and a network communication module. The operating system is a program for managing hardware and software resources of the actual device for store search information processing, and supports the operation of the information processing program and other software and/or programs. The network communication module is used for realizing communication among components in the storage medium and communication with other hardware and software in the information processing entity device.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and can also be implemented by hardware. Compared with the prior art, the technical scheme of the application has the advantages that the data communication request is initiated to the native application terminal based on the page jump protocol according to the detected data communication requirement triggered by the unified interface object, so that the native application terminal calls the communication object and obtains the communication data matched with the target callback identifier from the queue pool according to the target callback identifier carried in the data communication request, different operating systems can be compatible, the native application terminal can be used for achieving information obtaining of the page communication process, the communication between the page and the native application terminal is achieved, and the data obtaining efficiency of the page communication process is improved.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.
Claims (15)
1. A method for page communication, comprising:
determining a communication object which is mounted on a global object by a native application end according to a device type standard, wherein the communication object is used for placing communication data when a page is communicated with the native application in a queue pool and setting a callback identifier for the communication data;
aggregating the communication methods in the communication objects mounted on the global object and exposing a uniform interface object;
and initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the uniform interface object, so that the native application terminal calls the communication object and acquires communication data matched with a target callback identifier from the queue pool according to the target callback identifier carried in the data communication request.
2. The method of claim 1, wherein after determining that the native application mounts to the communication object on the global object according to the device type standard, the method further comprises: and judging the type of the equipment based on the communication object mounted on the global object.
3. The method according to claim 2, wherein determining a device type based on the communication object mounted to the global object specifically includes:
acquiring embedded parameter information formed by mounting the communication method on the global object based on the communication method mounted in the communication object on the global object;
and judging the type of the equipment by using the interface type object mapped by the embedded parameter information.
4. The method of claim 1, wherein prior to determining that the native application mounts to the communication object on the global object according to the device type standard, the method further comprises:
if the communication object is not detected in the global object, judging the device type according to the user agent, and monitoring whether the native application end mounts the communication object corresponding to the device type into the global object.
5. The method of claim 1, wherein prior to determining that the native application mounts to the communication object on the global object according to the device type standard, the method further comprises:
detecting whether a completion event sent by the native application terminal is received, wherein the completion event is used for indicating that the native application terminal has mounted the communication object on the global object and the communication object is initialized;
and if so, initializing page logic which needs to interact with the native application terminal in the page.
6. The method according to claim 5, wherein initializing a page logic of the page that needs to interact with the native application, specifically comprises:
placing codes corresponding to at least one page logic needing to interact with the native application end in the page into a callback array corresponding to a target method;
and sequentially calling back codes corresponding to the page logics in the callback array through the target method according to the callback array so as to sequentially execute initialization of the at least one page logic.
7. The method of any of claims 1-6, wherein prior to initiating a data communication request to the native application based on a page jump protocol, the method further comprises:
a data communication standard is formulated in advance according to communication logic related to communication between the page and the native application terminal;
the communication data carries information of a multi-level protocol data structure which accords with a preset target data communication standard.
8. The method of claim 7, wherein after initiating a data communication request to the native application based on a page jump protocol, the method further comprises:
and receiving a processing result obtained after the native application terminal processes the target data in the communication data according to the target data communication standard.
9. The method according to claim 8, wherein the receiving a processing result obtained by the native application processing the target data in the communication data according to the target data communication standard comprises: receiving the processing result obtained by the native application end according to the following mode:
combining the information in the first hierarchical structure and the information in the second hierarchical structure in the information according with the multi-hierarchical protocol data structure, and searching a pre-established data communication standard table according to a combination result;
and when the target data communication standard corresponding to the combination result exists in the data communication standard table, processing the target data according to the operation corresponding to the target data communication standard to obtain the processing result, wherein the target data is located in a third hierarchical structure in the information conforming to the multi-hierarchical protocol data structure.
10. The method of claim 9, further comprising:
when an error identifier returned by the native application terminal is received, wherein the error identifier is used for indicating that the communication between the page and the native application terminal does not support the data communication standard corresponding to the combination result, and the data communication standard is updated according to the communication logic involved in the communication between the page and the native application terminal;
based on the updated data communication standard, transmitting the updated communication data from the page to the native application terminal, and initiating an updated data communication request to the native application terminal in a page jump protocol manner, so that the native application terminal processes the data in the updated communication data according to the updated data communication standard.
11. The method according to any one of claims 1-6, wherein when the communication data indicates a request to obtain game data from a service end, after the initiating a data communication request to the native application end based on a page jump protocol, the method further comprises:
and receiving the game data generated by the service end responding to the calling of the native application end, and displaying the game data in the page.
12. The method of any of claims 1-6, wherein prior to initiating a data communication request to the native application based on a page jump protocol, the method further comprises:
and expanding communication logic related to communication between the page and the native application end and/or between the page and the service end through a supplementary protocol interface, and formulating a newly added data communication standard according to the expanded communication logic so that the native application end and/or the service end correspondingly processes data transmitted by the page according to the newly added communication standard.
13. A page communication apparatus, comprising:
the device comprises a determining unit, a determining unit and a processing unit, wherein the determining unit is used for determining a communication object which is mounted on a global object by a native application end according to a device type standard, the communication object is used for placing communication data when a page is communicated with the native application in a queue pool, and setting a callback identifier for the communication data;
the processing unit is used for exposing a uniform interface object after aggregating the communication methods in the communication objects mounted on the global object;
and the initiating unit is used for initiating a data communication request to the native application terminal based on a page jump protocol according to the detected data communication requirement triggered by the unified interface object, so that the native application terminal calls the communication object and acquires communication data matched with the target callback identifier from the queue pool according to the target callback identifier carried in the data communication request.
14. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of the page communication method according to any of claims 1 to 12.
15. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the page communication method according to any one of claims 1 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110349208.4A CN113032167A (en) | 2021-03-31 | 2021-03-31 | Page communication method, device and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110349208.4A CN113032167A (en) | 2021-03-31 | 2021-03-31 | Page communication method, device and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113032167A true CN113032167A (en) | 2021-06-25 |
Family
ID=76453441
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110349208.4A Pending CN113032167A (en) | 2021-03-31 | 2021-03-31 | Page communication method, device and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113032167A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104461575A (en) * | 2014-12-26 | 2015-03-25 | 北京华电万通科技有限公司 | Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform |
CN108762956A (en) * | 2018-05-31 | 2018-11-06 | 康键信息技术(深圳)有限公司 | Obtain method, server, mobile terminal and the storage medium of Native local datas |
US10296298B1 (en) * | 2018-01-25 | 2019-05-21 | Walmart Apollo, Llc | Systems and methods for cross platform information exchange mechanism for integrating web-based components with a native application |
CN109976831A (en) * | 2019-03-28 | 2019-07-05 | 山东浪潮通软信息科技有限公司 | Data interactive method between a kind of JavaScript and primary APP |
-
2021
- 2021-03-31 CN CN202110349208.4A patent/CN113032167A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104461575A (en) * | 2014-12-26 | 2015-03-25 | 北京华电万通科技有限公司 | Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform |
US10296298B1 (en) * | 2018-01-25 | 2019-05-21 | Walmart Apollo, Llc | Systems and methods for cross platform information exchange mechanism for integrating web-based components with a native application |
CN108762956A (en) * | 2018-05-31 | 2018-11-06 | 康键信息技术(深圳)有限公司 | Obtain method, server, mobile terminal and the storage medium of Native local datas |
CN109976831A (en) * | 2019-03-28 | 2019-07-05 | 山东浪潮通软信息科技有限公司 | Data interactive method between a kind of JavaScript and primary APP |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8843895B2 (en) | Debugger connection | |
CN104965848B (en) | A kind of front end resource loading method and device | |
TWI608416B (en) | Page return method and apparatus, page generation method and apparatus | |
US9386264B2 (en) | Augmenting capabilities of a host device | |
CN103942225A (en) | Method and system for invoking resources of Hybrid App client and client | |
CN113672441B (en) | Method and device for testing intelligent equipment | |
CN110020293B (en) | Multimedia data display method, device and storage medium | |
CN110933075B (en) | Service calling method and device, electronic equipment and storage medium | |
CN110968331A (en) | Method and device for running application program | |
CN109729121B (en) | Cloud storage system and method for realizing custom data processing in cloud storage system | |
CN111338829B (en) | Calling method and device for remote procedure call service | |
CN112422485B (en) | Communication method and device of transmission control protocol | |
CN115237481A (en) | Method, device and equipment for driving external equipment and storage medium | |
CN116701168A (en) | Peripheral interface testing method, device, equipment and storage medium | |
CN106095886B (en) | Data processing method and device | |
CN113032167A (en) | Page communication method, device and equipment | |
CN111338898B (en) | Application state acquisition method and device, electronic equipment and readable storage medium | |
CN115827278A (en) | Cross-module communication method, system, device and storage medium | |
CN111880996B (en) | Bare metal data acquisition method, device, equipment and readable storage medium | |
CN114726905A (en) | Method, device, equipment and storage medium for accessing Tbox network to Android system | |
CN112416698B (en) | Expansion method and device of monitoring system, storage medium and electronic equipment | |
CN112306858A (en) | Test method and device and electronic equipment | |
CN113220296A (en) | Android system interaction method and device | |
CN105119927A (en) | Message sending, receiving method and terminal and message sending system | |
CN112073462A (en) | Positioning method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |