CN112818265B - Interaction method and mobile terminal - Google Patents
Interaction method and mobile terminal Download PDFInfo
- Publication number
- CN112818265B CN112818265B CN202110199036.7A CN202110199036A CN112818265B CN 112818265 B CN112818265 B CN 112818265B CN 202110199036 A CN202110199036 A CN 202110199036A CN 112818265 B CN112818265 B CN 112818265B
- Authority
- CN
- China
- Prior art keywords
- application layer
- native application
- message
- call message
- credential
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 103
- 230000003993 interaction Effects 0.000 title claims abstract description 62
- 230000006870 function Effects 0.000 claims description 39
- 238000004891 communication Methods 0.000 abstract description 16
- 230000002457 bidirectional effect Effects 0.000 abstract description 5
- 230000008569 process Effects 0.000 description 9
- 230000005540 biological transmission Effects 0.000 description 8
- 230000002093 peripheral effect Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000005484 gravity Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000002349 favourable effect Effects 0.000 description 1
- 230000006698 induction Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 229910044991 metal oxide Inorganic materials 0.000 description 1
- 150000004706 metal oxides Chemical class 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000010076 replication Effects 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 239000000725 suspension Substances 0.000 description 1
- 230000007723 transport mechanism Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
-
- 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
- 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/547—Remote procedure calls [RPC]; Web services
-
- 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/547—Messaging middleware
Abstract
The invention discloses an interaction method, which comprises the following steps: generating a first call message, wherein the first call message comprises a method name and a parameter of a native application layer and a callback function identifier of a Web application layer; generating a corresponding call message credential based on the first call message, and sending the call message credential to a native application layer; receiving a request of acquiring a first call message sent by a native application layer based on the call message credential; sending a first call message corresponding to the call message credential to a native application layer, so that the native application layer executes a corresponding call method based on a method name and parameters in the first call message, and generates a first execution result; and receiving a first execution result returned by the native application layer. The invention also discloses a corresponding mobile terminal. According to the technical scheme of the invention, bidirectional information interaction between the Web application and the native application in the hybrid application can be realized, and the communication efficiency is high.
Description
Technical Field
The present invention relates to the field of interaction technologies, and in particular, to an interaction method for a Web application and a native application in a hybrid application, and a mobile terminal.
Background
The original application has more acquirability and better experience, but because the publishing process is too long and can not be updated to the Web application at any time, in the prior art, a hybrid development mode is generally adopted to develop some application pages with higher updating frequency into the Web application, and a Web page (Web application) loading mode is utilized to realize rapid iterative publishing. And because the method which can be executed by the Web application is limited, the user experience is poor in some application scenes, and the user experience of the original application is difficult to achieve. In addition, in the existing hybrid application, when the Web application and the native application perform information interaction, information can only be transmitted in one direction, and bidirectional information interaction cannot be achieved.
For this reason, an interaction method is needed to solve the problems in the above technical solutions.
Disclosure of Invention
Accordingly, the present invention provides an interaction method and a mobile terminal to solve or at least alleviate the above-mentioned problems.
According to an aspect of the present invention, there is provided an interaction method, which is executed at a Web application layer in a hybrid application of a mobile terminal so that the Web application layer performs information interaction with a native application layer, the method comprising the steps of: generating a first call message, wherein the first call message comprises a method name and a parameter of a native application layer and a callback function identifier of a Web application layer; generating a corresponding call message credential based on the first call message, and sending the call message credential to a native application layer; receiving a request of acquiring a first call message sent by a native application layer based on the call message credential; sending a first call message corresponding to the call message credential to a native application layer, so that the native application layer executes a corresponding call method based on a method name and parameters in the first call message, and generates a first execution result; and receiving a first execution result returned by the native application layer.
Optionally, in the interaction method according to the present invention, the method further comprises the steps of: receiving a second call message generated by the native application layer, wherein the second call message comprises a method name and a parameter of the Web application layer and a callback function identifier of the native application layer; executing a calling method corresponding to the method name of the Web application layer, generating a second execution result, and generating a callback message based on the second execution result and a callback function identifier of the original application layer; generating a corresponding callback message credential based on the callback message, and sending the callback message credential to a native application layer; and receiving a request which is sent by the original application layer based on the callback message credential and used for acquiring the callback message, and returning the callback message to the original application layer so that the original application layer executes a callback function corresponding to the callback function identification in the callback message.
Optionally, in the interaction method according to the present invention, sending the message credential to the native application layer includes: the message credential is sent to a native application layer based on the URL.
Optionally, in the interaction method according to the present invention, the step of receiving the first execution result returned by the native application layer includes: receiving a first execution result returned by a native application layer and a callback function identification of the Web application layer; executing the callback function corresponding to the callback function identification of the Web application layer.
Optionally, in the interaction method according to the present invention, the Web application layer communicates with the native application layer based on UIwebview.
Optionally, in the interaction method according to the present invention, the Web application layer is an H5 page.
Optionally, in the interaction method according to the present invention, the message credential comprises fixed information and a timestamp.
According to one aspect of the present invention, there is provided a mobile terminal comprising a hybrid application comprising the native application layer and a Web application layer adapted to perform an interaction method as described above for information interaction with the native application layer.
According to an aspect of the present invention, there is provided a mobile terminal including: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the interaction method as described above.
According to an aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a mobile terminal, cause the mobile terminal to perform the interaction method as described above.
According to the technical scheme, the interaction method of the Web application and the native application in the mixed application is provided, normal return of forward call logic can be guaranteed in the process of information interaction between the Web application and the native application in the mixed application, asynchronous callback can be processed in the reverse direction, and therefore bidirectional information interaction between the Web application and the native application in the mixed application is achieved, and interaction experience is better. Moreover, based on unified protocol and standard, the interaction method of the invention can be adapted to various types of terminal equipment.
Further, in the technical scheme of the invention, the native application acquires the message credential from the Web application in advance and acquires the call message or the callback message corresponding to the message credential based on the message credential, so that the stability of data transmission between the Web application and the native application in the information interaction process can be improved, the communication efficiency can be improved, a large amount of data can be transmitted, the safety of data transmission can be ensured, and malicious attacks can be effectively prevented.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
Fig. 1 shows a schematic diagram of a mobile terminal 100 according to one embodiment of the invention;
FIG. 2 illustrates a flow chart of an interaction method 200 according to one embodiment of the invention; and
FIG. 3 shows a schematic diagram of the interaction steps of an H5 page with a native application, according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The interaction scheme of the invention can be used for hybrid applications in the mobile terminal, in particular for information interaction between Web applications and native applications in the hybrid applications. According to the interaction scheme provided by the invention, the Web application in the hybrid application can perform bidirectional information interaction with the native application.
Fig. 1 illustrates a block diagram of a mobile terminal 100 according to one embodiment of the present invention.
The mobile terminal 100 may be a mobile phone, a tablet computer, a notebook computer, a multimedia player, a wearable device, etc. configured with a front camera and a display screen, but is not limited thereto. As shown in fig. 1, mobile terminal 100 may include a memory interface 102, a multi-core processor 104, and a peripheral interface 106.
The memory interface 102, the multi-core processor 104, and/or the peripheral interface 106 may be discrete components or may be integrated in one or more integrated circuits. In the mobile terminal 100, various elements may be coupled by one or more communication buses or signal lines. Sensors, devices, and subsystems may be coupled to peripheral interface 106 to facilitate various functions.
For example, the acceleration sensor 110, the magnetic field sensor 112 and the gravity sensor 114 may be coupled to the peripheral interface 106, the acceleration sensor 110 may collect acceleration data in three coordinate axis directions of the machine body coordinate system, the magnetic field sensor 112 may collect magnetic field data (magnetic induction) in three coordinate axis directions of the machine body coordinate system, the gravity sensor 114 may collect gravity data in three coordinate axis directions of the machine body coordinate system, and the above sensor may facilitate functions of step counting, orientation, intelligent switching of horizontal and vertical screens, and the like. Other sensors 116 may also be coupled to the peripheral interface 106, such as a positioning system (e.g., a GPS receiver), a temperature sensor, a biometric sensor, or other sensing device, to facilitate relevant functions.
The camera subsystem 120 and optical sensor 122, which may be, for example, a Charge Coupled Device (CCD) or a Complementary Metal Oxide Semiconductor (CMOS) optical sensor, may be used to facilitate implementation of camera functions such as recording photographs and video clips. Communication functions may be facilitated by one or more wireless communication subsystems 124, which may include radio frequency receivers and transmitters and/or optical (e.g., infrared) receivers and transmitters. The particular design and implementation of the wireless communication subsystem 124 may depend on the one or more communication networks supported by the mobile terminal 100. For example, the mobile terminal 100 may include a communication subsystem 124 designed to support LTE, 3G, GSM networks, GPRS networks, EDGE networks, wi-Fi or WiMax networks, and bluetooth networks.
The audio subsystem 126 may be coupled with a speaker 128 and a microphone 130 to facilitate voice-enabled functions, such as voice recognition, voice replication, digital recording, and telephony functions. The I/O subsystem 140 may include a touch screen controller 142 and/or one or more other input controllers 144. The touch screen controller 142 may be coupled to a touch screen 146. For example, the touch screen 146 and touch screen controller 142 can detect contact and movement or suspension therewith using any of a variety of touch sensing technologies including, but not limited to, capacitive, resistive, infrared and surface acoustic wave technologies. One or more other input controllers 144 may be coupled to other input/control devices 148, such as one or more buttons, rocker switches, thumbwheels, infrared ports, USB ports, and/or pointing devices such as a stylus. The one or more buttons (not shown) may include up/down buttons for controlling the volume of speaker 128 and/or microphone 130.
The memory interface 102 may be coupled with a memory 150. The memory 150 may include an internal memory such as a Static Random Access Memory (SRAM), a non-volatile memory (NVRAM), etc., and an external memory, but is not limited thereto; the external memory may be, for example, a hard disk, a removable hard disk, a usb disk, or the like, but is not limited thereto. Memory 150 may store program instructions, which may include, for example, an operating system 152 and applications 154. The operating system 152 may be, for example, android, iOS, windows Phone, etc., which includes program instructions for handling basic system services and performing hardware dependent tasks. The memory 150 may also store an application 154, and the application 154 may include program instructions for implementing various user-desired functions. The applications 154 may be provided separately from the operating system or may be self-contained with the operating system. In addition, when the application 154 is installed in the mobile terminal 100, a driving module may be added to the operating system. As the mobile device runs, an operating system 152 is loaded from memory 150 and executed by processor 104. The application 154, when running, is also loaded from the memory 150 and executed by the processor 104. Applications 154 run on top of the operating system and utilize interfaces provided by the operating system and underlying hardware to implement various user-desired functions, such as hardware management, instant messaging, web browsing, and the like.
In one embodiment, the various applications 154 described above include one or more hybrid applications that include a plurality of program instructions adapted to be executed by at least one processor of the mobile terminal to cause the mobile terminal 100 to perform the interaction method 200 of the present invention.
The hybrid application includes a Web application layer and a native application layer. According to one embodiment of the invention, the Web application layer of the hybrid application comprises a plurality of program instructions adapted to perform the interaction method 200 of the invention, such that the interaction method 200 of the invention can be performed at the Web application layer of the hybrid application in a mobile terminal. The Web application layer performs information interaction with the native application layer by performing the interaction method 200 of the present invention.
It should be noted that the Web application layer communicates with the native application layer based on UIwebview. UIwebview includes some common methods and attributes for Web application layer and native application layer invocation. In one embodiment, the Web application layer is, for example, but not limited to, an H5 page developed based on an HTML5 framework.
FIG. 2 illustrates a flow chart of an interaction method 200 according to one embodiment of the invention. As shown in fig. 2, the method 200 includes steps S210-S250. According to steps S210-S250, the Web application layer can forward call the method of the original application layer to interact information with the original application layer.
In step S210, the Web application layer generates a first call message, where the first call message includes a method name, a parameter, and a callback function identifier of the Web application layer that need to call the native application layer.
Subsequently, in step S220, the Web application layer generates a corresponding call message credential for uniquely identifying the first call message based on the first call message, and transmits the call message credential to the native application layer. Here, the Web application layer may send the call message credential to the native application layer by way of URL reporting.
It should be noted that, in order to obtain good experience in mobile terminals of various models, in the embodiment of the present invention, the implementation manner of reporting by the android system and the IOS system through the URL is different, where the android system reports the URL through the img tag, and the IOS system reports the URL through the iframe tag.
In one embodiment, after acquiring the call message credential of the first call message, the native application layer may send a request message to the Web application layer by invoking a public communication method of the Web application layer, where the call message credential is carried in the request message. That is, the native application layer sends a request message to the Web application layer based on the call message credential to obtain a first call message corresponding to the call message credential.
Accordingly, in step S230, the Web application layer receives a request sent by the native application layer based on the call message credential to obtain the first call message. Here, the Web application layer may obtain the call message credential from the request message by parsing the request message.
Subsequently, in step S240, the Web application layer transmits a first call message corresponding to the call message credential (i.e., the first call message generated in step S210) to the native application layer. The native application layer may obtain, from the first call message, a method name and a parameter of the Web application layer that requests to call the native application layer, and a callback function identifier of the Web application layer. Then, the native application layer executes a calling method corresponding to the method name of the native application layer based on the method name and parameters of the native application layer, generating a first execution result.
In the invention, the Web application layer generates the call message credential corresponding to the call message, and the native application layer can only acquire the call message corresponding to the call message based on the message credential transmitted by the Web application layer, so that the stability of data transmission between the Web application layer and the native application layer in the interaction process can be improved, the communication efficiency can be improved, a large amount of data can be transmitted, and the safety of data transmission can be ensured.
Finally, in step S250, a first execution result returned by the native application layer is received. In one embodiment, after generating the first execution result, the native application layer returns the first execution result to the Web application layer together with the callback function identifier of the Web application layer obtained from the first call message. That is, the native application layer calls back to the Web application layer after executing the corresponding calling method. The Web application layer then executes a callback function corresponding to the callback function identification of the Web application layer. In this way, normal return of forward call logic is achieved when the Web application layer interacts with the native application layer.
Here, the native application layer may also return the first execution result to the Web application layer together with the callback function identification of the Web application layer by calling the public communication method of the Web application layer.
According to one embodiment, as shown in FIG. 2, the method 200 further includes steps S260-S290. According to steps S260-S290, the native application layer can call the method of the Web application layer to interact information with the Web application layer. It should be noted that steps S260 to S290 are also performed in the Web application layer.
In step S260, the Web application layer receives a second call message generated by the native application layer. Here, the second call message is generated at the native application layer, and includes a name of a method, a parameter, and a callback function identifier of the native application layer that the native application layer requests to call the Web application layer.
In one embodiment, the native application layer may send the second invocation message to the Web application layer, for example, by invoking a public communication method of the Web application layer.
Subsequently, in step S270, the Web application layer acquires the method name, the parameter and the callback function identifier of the native application layer of the Web application layer from the second call message, and executes the call method corresponding to the method name of the Web application layer based on the method name and the parameter of the Web application layer, so as to generate a second execution result. Further, the Web application layer generates a callback message based on the second execution result and the callback function identification of the native application layer.
Subsequently, in step S280, the Web application layer generates a corresponding callback message credential for uniquely identifying the callback message based on the callback message, and sends the callback message credential to the native application layer. Here, the Web application layer may send the callback message credential to the native application layer by way of URL reporting.
After the native application layer acquires the callback message credential, the native application layer may request the Web application layer to acquire the corresponding callback message based on the callback message credential. For example, the native application layer may send a request to the Web application layer to obtain the callback message by invoking a public communication method of the Web application layer.
Finally, in step S290, a request for obtaining a callback message sent by the native application layer based on the callback message credential is received, the callback message corresponding to the callback message credential is returned to the native application layer, and then the native application layer obtains a callback function identifier of the native application layer from the callback message, and executes a callback function corresponding to the callback function identifier in the callback message. Thus, the invention realizes the reverse processing of asynchronous callback when the Web application layer and the native application layer interact.
It should be noted that, in the embodiment according to the present invention, the native application layer obtains the call message corresponding thereto based on the call message credential, and the native application layer obtains the callback message corresponding thereto based on the callback message credential. The method for acquiring the call message can promote the stability of data transmission of the Web application and the native application in the information interaction process, is favorable for transmitting a large amount of data, and can ensure the safety of data transmission.
In one embodiment, the call message credential and the callback message credential are both in the form of a combination of fixed information (keywords) and a timestamp.
Further, FIG. 3 shows a schematic diagram of the interaction steps of an H5 page with a native application according to one embodiment of the invention. As shown in fig. 3, the interaction step of the method for calling the native application by the H5 page is included, and the interaction step of the method for calling the H5 page by the native application is also included.
It will be appreciated that the interaction of the H5 page with the native application is actually the interaction of JavaScript scripts in the H5 page with the native development language used by the native application.
It should be noted that, the interaction step of the H5 page with the native application shown in fig. 3 corresponds to the interaction step of the Web application layer with the native application layer in the interaction method 200, and the specific method is described in detail in steps S210 to S290 of the interaction method 200, which is not described herein again.
In summary, according to the interaction method provided by the invention, in the process of information interaction between the Web application and the native application in the hybrid application, normal return of forward call logic can be ensured, and asynchronous callback can be processed in the reverse direction, so that bidirectional information interaction between the Web application and the native application in the hybrid application is realized, and interaction experience is better. Moreover, based on unified protocol and standard, the interaction method of the invention can be adapted to various types of terminal equipment.
Furthermore, the original application acquires the message credential from the Web application in advance and acquires the call message or the callback message corresponding to the message credential based on the message credential, so that the stability of data transmission between the Web application and the original application in the information interaction process can be improved, the communication efficiency can be improved, a large amount of data can be transmitted, the safety of data transmission can be ensured, and malicious attacks can be effectively prevented.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the interaction method of the present invention in accordance with instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.
Claims (9)
1. An interaction method executed at a Web application layer in a hybrid application of a mobile terminal so that the Web application layer performs information interaction with a native application layer, the method comprising the steps of:
generating a first call message, wherein the first call message comprises a method name and a parameter of a native application layer and a callback function identifier of a Web application layer;
generating a corresponding call message credential based on the first call message, and sending the call message credential to a native application layer;
receiving a request of acquiring a first call message sent by a native application layer based on the call message credential;
sending a first call message corresponding to the call message credential to a native application layer, so that the native application layer executes a corresponding call method based on a method name and parameters in the first call message, and generates a first execution result;
receiving a first execution result returned by the native application layer;
receiving a second call message generated by the native application layer, wherein the second call message comprises a method name and a parameter of the Web application layer and a callback function identifier of the native application layer;
executing a calling method corresponding to the method name of the Web application layer, generating a second execution result, and generating a callback message based on the second execution result and a callback function identifier of the original application layer;
generating a corresponding callback message credential based on the callback message, and sending the callback message credential to a native application layer;
and receiving a request which is sent by the original application layer based on the callback message credential and used for acquiring the callback message, and returning the callback message to the original application layer so that the original application layer executes a callback function corresponding to the callback function identification in the callback message.
2. The method of claim 1, wherein sending the message credential to a native application layer comprises:
the message credential is sent to a native application layer based on the URL.
3. The method of claim 1, wherein receiving the first execution result returned by the native application layer comprises:
receiving a first execution result returned by a native application layer and a callback function identification of the Web application layer;
executing the callback function corresponding to the callback function identification of the Web application layer.
4. The method of any of claims 1-3, wherein the Web application layer communicates with a native application layer based on UIwebview.
5. A method according to any one of claims 1-3, wherein the Web application layer is an H5 page.
6. The method of any one of claim 1 to 3, wherein,
the message credential includes fixed information and a timestamp.
7. A mobile terminal comprising a hybrid application, the hybrid application comprising the native application layer and a Web application layer, the Web application layer being adapted to perform the interaction method of any of claims 1-6 for information interaction with the native application layer.
8. A mobile terminal, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-6.
9. A readable storage medium storing program instructions which, when read and executed by a mobile terminal, cause the mobile terminal to perform the method of any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110199036.7A CN112818265B (en) | 2021-02-22 | 2021-02-22 | Interaction method and mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110199036.7A CN112818265B (en) | 2021-02-22 | 2021-02-22 | Interaction method and mobile terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112818265A CN112818265A (en) | 2021-05-18 |
CN112818265B true CN112818265B (en) | 2023-11-10 |
Family
ID=75864806
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110199036.7A Active CN112818265B (en) | 2021-02-22 | 2021-02-22 | Interaction method and mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112818265B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8595752B1 (en) * | 2011-06-13 | 2013-11-26 | Google Inc. | Hybrid application message passing |
CN107102904A (en) * | 2017-03-29 | 2017-08-29 | 腾讯科技(深圳)有限公司 | Exchange method and device based on mixed application |
CN109062626A (en) * | 2018-07-09 | 2018-12-21 | 北京奇艺世纪科技有限公司 | Exchange method, device and the equipment of Web page component and Native component |
CN109309712A (en) * | 2018-09-07 | 2019-02-05 | 平安科技(深圳)有限公司 | Data transmission method, server and the storage medium called based on interface asynchronous |
CN109901827A (en) * | 2019-03-13 | 2019-06-18 | 厦门美图之家科技有限公司 | Using exchange method, device, electronic equipment and readable storage medium storing program for executing |
CN111950001A (en) * | 2020-07-31 | 2020-11-17 | 银盛支付服务股份有限公司 | Authority control method and system based on H5 application in APP |
-
2021
- 2021-02-22 CN CN202110199036.7A patent/CN112818265B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8595752B1 (en) * | 2011-06-13 | 2013-11-26 | Google Inc. | Hybrid application message passing |
CN107102904A (en) * | 2017-03-29 | 2017-08-29 | 腾讯科技(深圳)有限公司 | Exchange method and device based on mixed application |
CN109062626A (en) * | 2018-07-09 | 2018-12-21 | 北京奇艺世纪科技有限公司 | Exchange method, device and the equipment of Web page component and Native component |
CN109309712A (en) * | 2018-09-07 | 2019-02-05 | 平安科技(深圳)有限公司 | Data transmission method, server and the storage medium called based on interface asynchronous |
CN109901827A (en) * | 2019-03-13 | 2019-06-18 | 厦门美图之家科技有限公司 | Using exchange method, device, electronic equipment and readable storage medium storing program for executing |
CN111950001A (en) * | 2020-07-31 | 2020-11-17 | 银盛支付服务股份有限公司 | Authority control method and system based on H5 application in APP |
Non-Patent Citations (1)
Title |
---|
基于Cloud Native全融合5G UDM 应用研究;郑航帅;《邮电设计技术》(第9期);第86-92页 * |
Also Published As
Publication number | Publication date |
---|---|
CN112818265A (en) | 2021-05-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102481065B1 (en) | Application function implementation method and electronic device | |
CN105100059A (en) | Method, device and system for processing high-concurrent requests | |
US11204681B2 (en) | Program orchestration method and electronic device | |
CN108496198B (en) | Image processing method and device | |
EP3445019B1 (en) | Vehicle-based communication method and system | |
CN108833585B (en) | Information interaction method and device and storage medium | |
CN113038434B (en) | Device registration method and device, mobile terminal and storage medium | |
WO2015176352A1 (en) | Android system-based method and device for information exchange between applications | |
CN108090345B (en) | Linux system external command execution method and device | |
CN103763112A (en) | User identity protection method and apparatus | |
WO2019047708A1 (en) | Resource configuration method and related product | |
CN113837939A (en) | Image processing method and device | |
CN110765398A (en) | Page content display method and mobile terminal | |
CN114489896B (en) | Content display method and device, storage medium and electronic equipment | |
EP3805938A1 (en) | Server node selection method and terminal device | |
CN106506364A (en) | A kind of cut-in method, client and routing server | |
US11368531B2 (en) | Method and apparatus for file management | |
CN112818265B (en) | Interaction method and mobile terminal | |
US20220304080A1 (en) | Method and apparatus for processing data | |
KR102095666B1 (en) | Information input methods, devices, programs and storage media | |
CN105208203A (en) | Mobile terminal, and data information management system and method | |
CN115269077A (en) | Picture display method, module, mobile terminal and storage medium | |
CN113642010B (en) | Method for acquiring data of extended storage device and mobile terminal | |
US11327845B2 (en) | Image synchronization method and device, and server | |
EP3163475A1 (en) | Electronic device and method of searching data records |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |