CN108833585B - Information interaction method and device and storage medium - Google Patents
Information interaction method and device and storage medium Download PDFInfo
- Publication number
- CN108833585B CN108833585B CN201810718218.9A CN201810718218A CN108833585B CN 108833585 B CN108833585 B CN 108833585B CN 201810718218 A CN201810718218 A CN 201810718218A CN 108833585 B CN108833585 B CN 108833585B
- Authority
- CN
- China
- Prior art keywords
- request
- operating system
- target application
- webpage
- application
- 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
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The disclosure relates to an information interaction method, an information interaction device and a storage medium, and relates to the technical field of networks. The method comprises the following steps: the method comprises the steps that an operating system receives a request from a webpage, the request comprises an application identifier of a target application and request content, the request content is used for indicating an event that the webpage needs to request the target application, the operating system forwards the request content to the target application corresponding to the application identifier, the operating system obtains response information fed back by the target application based on the request content, and the operating system sends the response information to the webpage. The embodiment of the disclosure realizes interaction between the webpage and the application through information interaction, and achieves the purpose of directly calling the application through the webpage.
Description
Technical Field
The disclosed embodiments relate to the field of network technologies, and in particular, to an information interaction method, an information interaction device, and a storage medium.
Background
Currently, with the rapid development of network technologies, the functions carried by web pages are increasing, for example, web pages can provide browsing contents for users. In addition, in the related art, how a webpage can realize more information interaction becomes a research hotspot.
Disclosure of Invention
The embodiment of the disclosure provides an information interaction method, an information interaction device and a storage medium, which can call an application installed in a mobile terminal through a webpage.
According to a first aspect of the embodiments of the present disclosure, there is provided an information interaction method, the method including:
an operating system receives a request from a webpage, wherein the request comprises an application identifier of a target application and request content, and the request content is used for indicating an event that the webpage needs to request the target application;
the operating system forwards the request content to a target application corresponding to the application identifier;
the operating system acquires response information fed back by the target application based on the request content;
and the operating system sends the response information to the webpage.
Optionally, before the operating system forwards the request content to the target application corresponding to the application identifier, the method further includes:
the operating system inquires whether a target application corresponding to the application identifier is in a running state currently;
when the target application is in a running state currently, the operating system executes the operation of forwarding the request content to the target application corresponding to the application identifier; and when the target application is not in the running state currently, the operating system calls and runs the target application.
Optionally, the request further includes a request identifier, and the request identifier is used for uniquely identifying the request.
Optionally, the response information includes the request identification and an event result executed by the target application for the request content.
Optionally, before the operating system receives the request from the web page, the operating system further includes:
the operating system establishes a long connection with a server, and the server is used for realizing communication between the operating system and the webpage;
accordingly, the operating system receives a request from a web page, comprising:
and the operating system receives the request from the webpage forwarded by the server through the long connection established between the operating system and the server.
Optionally, before the operating system receives the request from the web page, the operating system further includes:
the operating system obtains the request from the webpage from a clipboard, wherein the request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for realizing communication between the operating system and the webpage.
According to a second aspect of the embodiments of the present disclosure, there is provided an information interaction apparatus, configured in an operating system, the apparatus including:
the receiving module is configured to receive a request from a webpage, wherein the request comprises an application identifier of a target application and request content, and the request content is used for indicating an event that the webpage needs to request from the target application;
a forwarding module configured to forward the request content to a target application corresponding to the application identifier;
an obtaining module configured to obtain response information fed back by the target application based on the request content;
a sending module configured to send the response information to the web page.
Optionally, the apparatus further comprises:
the query module is configured to query whether the target application corresponding to the application identifier is currently in a running state;
the forwarding module is further configured to forward the request content to a target application corresponding to the application identifier when the target application is currently in a running state;
and the calling module is configured to call and run the target application when the target application is not in a running state currently.
Optionally, the request further includes a request identifier, and the request identifier is used for uniquely identifying the request.
Optionally, the response information includes the request identification and an event result executed by the target application for the request content.
Optionally, the apparatus further comprises:
the establishing module is configured to establish a long connection with a server, and the server is used for realizing communication between the operating system and the webpage;
the receiving module is configured to: and receiving the request from the webpage forwarded by the server through the long connection established between the server and the webpage.
Optionally, the receiving module is further configured to:
and acquiring the request from the webpage from a clipboard, wherein the request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for realizing communication between the operating system and the webpage.
According to a third aspect of the embodiments of the present disclosure, there is provided an information interaction apparatus, the apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the information interaction method of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the information interaction method of the first aspect described above.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product containing instructions, which when run on a computer, causes the computer to execute the information interaction method of the first aspect.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the embodiment of the disclosure, an operating system receives a request from a web page, where the request includes an application identifier of a target application and request content, the target application is an application that the web page wants to call, and the request content is used to indicate an event that the web page wants to request from the target application. The operating system forwards the request content to the target application, then obtains response information fed back by the target application based on the request content, and forwards the response information to the webpage, so that interaction between the webpage and the application is realized through information interaction, and the purpose of directly calling the application through the webpage is achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a schematic diagram illustrating an implementation environment in accordance with an example embodiment;
FIG. 2 is a flow diagram illustrating a method of information interaction in accordance with an exemplary embodiment;
FIG. 3 is a flow chart illustrating a method of information interaction in accordance with another exemplary embodiment;
FIG. 4 is a block diagram illustrating an information interaction device, according to an example embodiment;
FIG. 5 is a block diagram illustrating an information interaction device, according to another example embodiment;
FIG. 6 is a block diagram illustrating an information interaction device, according to another example embodiment;
FIG. 7 is a block diagram illustrating an information interaction device, according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure.
Before describing the information interaction method provided by the embodiment of the present disclosure in detail, the application scenario and the implementation environment related to the embodiment of the present disclosure are briefly described.
First, a brief description is given of an application scenario related to an embodiment of the present disclosure.
At present, with the rapid development of network technology, more and more functions can be carried by web pages. For example, a web page needs to interact with an application, that is, during the web page display process, some information may need to be acquired from the application installed in the mobile terminal, so that the web page is loaded and displayed according to the acquired information. Therefore, how to call the application through the web page to realize information interaction between the web page and the application is studied in the implementation. Therefore, in the embodiment of the present disclosure, an information interaction method is provided, where the information interaction method may implement an operation of invoking an application by a web page, and the specific implementation of the information interaction method is described in the embodiment shown in fig. 2 or fig. 3 below.
Next, a brief description will be given of an implementation environment related to the embodiments of the present disclosure.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an implementation environment according to an exemplary embodiment, where the implementation environment mainly includes a mobile terminal 110 and a server 120, and a long connection is established between the mobile terminal 110 and the server 120.
The mobile terminal 110 is mainly used for implementing the information interaction method provided by the embodiment of the present disclosure, here, the mobile terminal 110 implements the information interaction method through an operating system, where the operating system may include, but is not limited to, an android operating system, an IOS operating system, or another operating system that is customized and developed based on the android operating system. Further, the mobile terminal 110 may also be installed with at least one application.
The server 120 is mainly used for establishing communication between the operating system of the mobile terminal 110 and the web page, that is, a bidirectional communication channel can be established between the operating system of the mobile terminal 110 and the web page through the server 120, so as to implement communication between the operating system and the web page.
To this end, a long connection needs to be established between the operating system of the mobile terminal 110 and the server 120, and in one possible implementation, the long connection between the server 120 and the operating system of the mobile terminal 110 may be a long connection that the operating system of the mobile terminal 110 establishes with the server 120 when detecting that the web page starts running. Alternatively, it may be a long connection established by the operating system of the mobile terminal 110 with the server 120 upon completion of the booting. The long connection may be a TCP (Transmission Control Protocol) connection. That is, the operating system of mobile terminal 110 may send a connection request to server 120 when the operating system of mobile terminal 110 is started or when a web page in mobile terminal 110 starts running. When the server 120 receives the connection request, a long connection is established with the operating system of the mobile terminal 110.
Further, since the server 120 may have long connections established with the operating systems of a plurality of mobile terminals, the server 120 may assign a connection identification to each long connection in order to distinguish the long connection between the server 120 and the operating system of each mobile terminal. That is, after the server 120 establishes a long connection with the operating system of the mobile terminal 110, the long connection may be assigned a connection identifier for uniquely identifying the long connection. Further, after the server 120 assigns the connection identifier for the established long connection, in order to associate each mobile terminal with the corresponding long connection, so that the server 120 can find the long connection corresponding to the mobile terminal 110 when subsequently receiving the request of the mobile terminal 110. The server 120 may determine a Media Access Control (MAC) address of the mobile terminal 110 according to a connection request sent by an operating system of the mobile terminal 110, and further store the MAC address of the mobile terminal 110 and a connection identifier of the established long connection in a mapping relationship. Wherein, the mapping relation includes MAC addresses of a plurality of mobile terminals and corresponding connection identifiers. Thus, the server 120 can implement information interaction between the operating system and the web page based on the mapping relationship.
In some embodiments, the server 120 may provide multiple types of services at the same time, and therefore, in order to distinguish different connections corresponding to different services, the operating system of the mobile terminal 110 may further send a service registration request to the server 120 after establishing a long connection with the server 120, where the service registration request carries a service name. After the server 120 receives the service registration request, it may register the service name based on the service registration request, and store the service name, the MAC address of the mobile terminal 110, and the connection identifier of the established long connection in a mapping relationship, where the mapping relationship is a mapping relationship among the service name, the MAC address, and the connection identifier. Thus, the server 120 can also implement information interaction between the operating system and the web page based on the mapping relationship.
In some embodiments, the server 120 may generally be an application server for providing a service for an application in a mobile terminal, and the server 120 may be one server, or may also be a server cluster composed of several servers, or one cloud computing service center, which is not limited in this disclosure.
The implementation environment related to the embodiment of the present disclosure is not limited to the implementation environment shown in fig. 1, and for example, a bidirectional communication channel between the operating system and the web page may also be established through the clipboard. In this embodiment, the operating system (or the web page) encodes the message to be delivered through the cut-out into a preset format, and processes the message in the preset format when the web page (or the operating system) correctly identifies the message. Therefore, the messages to be transmitted between the operating system and the webpage through the clipboard are subjected to preset coding, and information interaction between the webpage and the operation is established.
However, the implementation environment related to the embodiment of the present disclosure is not limited to the implementation environment shown in fig. 1, and the two-way communication channel between the operating system and the web page is established through the clipboard, and may also include other implementation environments that can establish an interaction channel between the web page and the operating system.
After the application scenarios and the implementation environments related to the embodiments of the present disclosure are introduced, the information interaction method provided by the embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
Fig. 2 is a flowchart illustrating an information interaction method according to an exemplary embodiment, and as shown in fig. 2, the information interaction method is applied in the implementation environment, and the information interaction method may include the following implementation steps.
In step 201, the operating system receives a request from a web page, where the request includes an application identifier of a target application and request content, and the request content is used to indicate an event that the web page needs to be requested from the target application.
Optionally, the request further includes a request identifier, and the request identifier is used for uniquely identifying the request.
In some embodiments, prior to the operating system receiving a request from a web page, the operating system establishes a long connection with a server that is used to enable communication between the operating system and the web page. At this time, the operating system receives the request from the web page forwarded by the server through the long connection established with the server.
In another embodiment, before the os receives a request from a web page, the request is obtained from a clipboard, where the request is request information in a predetermined format that can be recognized by the os and sent to the clipboard by the web page, and the clipboard is used to implement communication between the os and the web page.
In step 202, the operating system forwards the requested content to the target application corresponding to the application identification.
In a possible implementation manner, before forwarding the request content to the target application corresponding to the application identifier, the operating system queries whether the target application corresponding to the application identifier is currently in a running state. And when the target application is not in the running state currently, the operating system calls and runs the target application.
In step 203, the operating system obtains response information fed back by the target application based on the requested content.
Optionally, the response information includes the request identification and an event result executed by the target application for the requested content.
In step 204, the operating system sends the response message to the web page.
In the embodiment of the disclosure, an operating system receives a request from a web page, where the request includes an application identifier of a target application and request content, the target application is an application that the web page wants to call, and the request content is used to indicate an event that the web page wants to request from the target application. The operating system forwards the request content to the target application, then obtains response information fed back by the target application based on the request content, and forwards the response information to the webpage, so that interaction between the webpage and the application is realized through information interaction, and the purpose of directly calling the application through the webpage is achieved.
Fig. 3 is a flowchart illustrating an information interaction method according to an exemplary embodiment, where the information interaction method is applied to the implementation environment, and the information interaction method may include the following implementation steps, as shown in fig. 3.
In step 301, the operating system receives a request from a web page, where the request includes an application identifier of a target application and request content indicating an event that the web page needs to be requested from the target application.
In some embodiments, applications installed in the terminal may be divided into browsing applications and non-browsing applications according to whether interaction with a web page is possible, where the browsing applications include browsers or other applications including browser cores, and may be used for browsing web pages. In addition, other applications besides the browsing application can be called non-browsing applications, and currently, interaction between the non-browsing applications and the web page is generally impossible. In the embodiment of the present disclosure, as described above, since a bidirectional communication channel is established between the web page and the operating system, the call can be made by the web page regardless of whether the web page is directed to a browsing application or a non-browsing application.
In order to facilitate the operating system to know which application in the mobile terminal is to be called by the web page, the web page adds the application identifier of the target application to be called in the request. The application identifier may be used to uniquely identify an application, and for example, the application identifier may be an APP ID.
In addition, in order to facilitate the target application to know the event to be requested by the webpage, the webpage also adds the requested content to the request. For example, the request content may be a Get Account number, i.e., a login Account number is obtained. In some embodiments, a web page may want to acquire recommendation information of a certain website, however, the website may require that information recommendation can be performed only after logging in an Account, at this time, the web page needs to acquire a login Account of the website, and for this reason, the web page may directly request a target application that once logs in the website through the login Account to acquire the login Account, so the web page packs Get Account number request content in the request.
For another example, in some possible application scenarios, the web page wants to call a Camera in the mobile terminal to take a picture, at this time, the web page may package a Calling Camera request content in the request, and the request content may be used to request the Camera in the mobile terminal to start a Camera to take a picture.
Further, the request may further include a request identifier. In some embodiments, there may be a case where multiple web page requests all call the same target application in the mobile terminal, and at this time, the operating system may receive multiple requests, and in order to clearly distinguish which web page each request in the multiple requests comes from, the web page may add a request identifier to the request, where the request identifier is used to uniquely identify the request. In this way, the operating system of the mobile terminal can distinguish the requests from different web pages according to the request identification.
Further, before receiving a request from a web page, the operating system establishes a long connection with a server, where the server is used to implement communication between the operating system and the web page, and at this time, the operating system receives the request from the web page forwarded by the server through the long connection established with the server.
That is, in order to enable the web page to directly call the application, the operating system may establish a long connection with the server, so as to implement interaction between the web page and the operating system through the server, thereby implementing interaction between the web page and the application in the mobile terminal.
In the implementation process, a DNS address may be configured in the server in advance, and when the application of the mobile terminal needs to be called, the web page may automatically obtain the configured DNS address of the server, and send the request to the server according to the DNS address. When the server receives the request, the request is sent to the operating system of the mobile terminal over a long connection with the operating system of the mobile terminal.
Based on the foregoing, in a possible implementation manner, after the server establishes the long connection with the operating system of the mobile terminal in the above manner, if the server stores the MAC address of the mobile terminal and the connection identifier of the established long connection in the mapping relationship, since the mapping relationship does not have a service name, the web page of the mobile terminal is not configured with the service name, and thus, the request sent by the web page of the mobile terminal to the server does not include the service name. In this case, when the server receives the request, since the server establishes long connections with each of the plurality of mobile terminals, the server may determine a long connection with the operating system of the mobile terminal from among the plurality of long connections according to the request, and transmit the request to the operating system of the mobile terminal through the determined long connection.
In another possible implementation manner, after the server establishes the long connection with the operating system of the mobile terminal in the above manner, if the server stores the service name, the MAC address of the mobile terminal, and the connection identifier of the established long connection in a mapping relationship according to a received service registration request sent by the operating system of the mobile terminal, then the service name exists in the mapping relationship, and therefore, the service name is also configured in the web page of the mobile terminal, so that when the web page of the mobile terminal sends a request to the server due to information interaction with the operating system, the request includes the service name. In this case, the server may determine a long connection with the operating system of the mobile terminal from among a plurality of long connections according to the request when receiving the request, and thus transmit the request to the operating system of the mobile terminal through the determined long connection.
It should be noted that, the long connection between the operating system and the server is only set up here, and the bidirectional communication channel between the operating system and the web page is set up as an example, in some embodiments, the bidirectional communication channel between the operating system and the web page may also be set up in other ways. For example, the bidirectional communication channel may be established through a clipboard, and at this time, the web page may preprocess the request, convert the request into a request in a predetermined format that can be recognized by the operating system, and then send the request to the clipboard of the mobile terminal. At this time, the operating system obtains a request from the web page from a clipboard, where the request is request information in a preset format that can be recognized by the operating system and is sent from the web page to the clipboard, and the clipboard is used to implement communication between the operating system and the web page.
Furthermore, in addition to the above implementation, a bidirectional communication channel between the operating system and the web page may be established in other ways. For example, since software such as a browser can interact information with a web page, the two-way communication channel can be established by means of a browser component, so as to interact between the web page and an operating system. In some embodiments, the web page may send the request to a preset domain name, where the preset domain name may be set in advance, and when the mobile terminal receives the request sent by the web page to the preset domain name through the browser component, the preset domain name is resolved into an assigned access address, and the assigned access address is used as a target address to send the request. When the target address of the request is detected to be the designated access address through the firewall, the request is redirected to the local webpage service, and the operating system acquires the request from the local webpage service. The local webpage service is used for carrying out information interaction with the terminal operating system.
It is worth mentioning that when the mobile terminal receives a request sent by a webpage to a preset domain name, the mobile terminal redirects a target address of the request to a local webpage service capable of interacting with the terminal operating system through a firewall, and the local webpage service completes the interaction with the terminal operating system, so that the limit of the interaction function of a browser and the operating system can be avoided, the development cost is low, and the universality is high.
In step 302, the operating system queries whether the target application corresponding to the application identifier is currently running.
After receiving the request from the web page, the operating system may parse the request to obtain the application identifier and the request content included in the request. And then, the operating system determines a corresponding target application from all the installed applications according to the application identification in the request.
In some embodiments, the target application to be invoked by the web page may not be started, that is, the target application is not in a running state, and at this time, information interaction between the web page and the target application cannot be realized. Therefore, in order to successfully implement information interaction between the web page and the target application, after the operating system obtains the application identifier and the request content included in the request, it is required to query whether the target application corresponding to the application identifier is currently in a running state.
In step 303, when the target application is currently in a running state, the operating system forwards the request content to the target application corresponding to the application identifier.
When the operating system determines that the target application is currently in a running state, request content retrieved from the request may be forwarded to the target application.
Further, the operating system calls and runs the target application when the target application is not currently in a running state.
That is, in some embodiments, when the target application is not currently in a running state, in order to ensure normal interaction of information, the operating system calls the target application and runs the target application, so that the target application is in a running state. And then, the operating system forwards the acquired request content to the running target application.
In step 304, the operating system obtains response information fed back by the target application based on the requested content.
In the implementation process, after receiving the request content, the target application executes corresponding operation according to the request content, and generates the response information based on the execution result. For example, if the request content is Get Account number, the target application acquires a login Account, and then generates the response information based on the acquired login Account. The operating system acquires response information generated by the target application based on the request content.
In some embodiments, the response information includes the request identification and the result of the event executed by the target application with respect to the requested content.
As described above, in some application scenarios, there may be a case where multiple web pages all want to call the same target application in the mobile terminal, and in order to facilitate the operating system to know which web page request the response message generated by the target application responds to, the target application may add the request identifier for uniquely identifying the request in the response message, so that after the operating system acquires the response message, the operating system may query the request corresponding to the request identifier according to the request identifier in the response message, thereby determining which web page the request originates from, and thus, determining which web page the response message responds to.
In step 305, the operating system sends the response message to the web page.
And after acquiring response information fed back by the target application based on the request content, the operating system forwards the response information to the webpage. In some embodiments, the operating system sends the response message to the web page over a long pre-established connection with the server.
As described above, in some embodiments, a long connection may be established between the operating system and the server, in which case the operating system may send the response message to the server, and the server may forward the response message to the web page after receiving the response message. Therefore, interaction between the webpage and the application is realized, and the purpose that the application installed in the mobile terminal can be directly called through the webpage is achieved.
It is worth mentioning that the method provided by the embodiment of the present disclosure can implement interaction between a web page and an application, whether for a browsing application or a non-browsing application.
In the embodiment of the disclosure, an operating system receives a request from a web page, where the request includes an application identifier of a target application and request content, the target application is an application that the web page wants to call, and the request content is used to indicate an event that the web page wants to request from the target application. The operating system forwards the request content to the target application, then obtains response information fed back by the target application based on the request content, and forwards the response information to the webpage, so that interaction between the webpage and the application is realized through information interaction, and the purpose of directly calling the application through the webpage is achieved.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
FIG. 4 is a block diagram illustrating an information interaction device, according to an example embodiment. The apparatus has functions of implementing the above method examples, and the functions may be implemented by hardware or hardware executing corresponding software, and referring to fig. 4, the apparatus may include:
a receiving module 410 configured to receive a request from a web page, where the request includes an application identifier of a target application and request content, and the request content is used to indicate an event that the web page needs to be requested from the target application;
a forwarding module 420 configured to forward the request content to a target application corresponding to the application identifier;
an obtaining module 430 configured to obtain response information fed back by the target application based on the request content;
a sending module 440 configured to send the response information to the webpage.
Optionally, referring to fig. 5, the apparatus further includes:
the query module 450 is configured to query whether the target application corresponding to the application identifier is currently in a running state;
a forwarding module 420, further configured to forward the request content to a target application corresponding to the application identifier when the target application is currently in a running state;
and the calling module 470 is configured to call and run the target application when the target application is not currently in the running state.
Optionally, the request further includes a request identifier, and the request identifier is used for uniquely identifying the request.
Optionally, the response information includes the request identification and an event result executed by the target application for the requested content.
Optionally, referring to fig. 6, the apparatus further includes:
an establishing module 480 configured to establish a long connection with a server for enabling communication between the operating system and the web page;
the receiving module 410 is configured to: and receiving the request from the webpage forwarded by the server through the long connection established between the server and the server.
Optionally, the receiving module 410 is further configured to:
and acquiring the request from the webpage from a clipboard, wherein the request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for realizing communication between the operating system and the webpage.
In the embodiment of the disclosure, an operating system receives a request from a web page, where the request includes an application identifier of a target application and request content, the target application is an application that the web page wants to call, and the request content is used to indicate an event that the web page wants to request from the target application. The operating system forwards the request content to the target application, then obtains response information fed back by the target application based on the request content, and forwards the response information to the webpage, so that interaction between the webpage and the application is realized through information interaction, and the purpose of directly calling the application through the webpage is achieved.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the above functional modules is illustrated, and in practical applications, the above functions may be distributed by different functional modules according to actual needs, that is, the content structure of the device is divided into different functional modules, so as to complete all or part of the functions described above.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 7 is a block diagram illustrating an apparatus 700 for information interaction in accordance with an example embodiment. For example, the apparatus 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 7, apparatus 700 may include one or more of the following components: a processing component 702, a memory 704, a power component 706, a multimedia component 708, an audio component 710, an input/output (I/O) interface 712, a sensor component 714, and a communication component 716.
The processing component 702 generally controls overall operation of the device 700, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 702 may include one or more processors 720 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 702 may include one or more modules that facilitate interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate interaction between the multimedia component 708 and the processing component 702.
The memory 704 is configured to store various types of data to support operations at the apparatus 700. Examples of such data include instructions for any application or method operating on device 700, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 704 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 706 provides power to the various components of the device 700. The power components 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power supplies for the apparatus 700.
The multimedia component 708 includes a screen that provides an output interface between the device 700 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 700 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 710 is configured to output and/or input audio signals. For example, audio component 710 includes a Microphone (MIC) configured to receive external audio signals when apparatus 700 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 704 or transmitted via the communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.
The I/O interface 712 provides an interface between the processing component 702 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 714 includes one or more sensors for providing status assessment of various aspects of the apparatus 700. For example, sensor assembly 714 may detect an open/closed state of device 700, the relative positioning of components, such as a display and keypad of device 700, sensor assembly 714 may also detect a change in position of device 700 or a component of device 700, the presence or absence of user contact with device 700, orientation or acceleration/deceleration of device 700, and a change in temperature of device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 716 is configured to facilitate wired or wireless communication between the apparatus 700 and other devices. The apparatus 700 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the method of information interaction provided by the embodiments shown in fig. 2 or 3 and described above.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 704 comprising instructions, executable by the processor 720 of the device 700 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium, wherein instructions of the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to perform the method for information interaction provided by the embodiment shown in fig. 2 or fig. 3.
A computer program product containing instructions which, when run on a computer, cause the computer to perform the method of information interaction provided by the embodiments of fig. 2 or fig. 3 described above.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof.
Claims (12)
1. An information interaction method, characterized in that the method comprises:
the operating system establishes a two-way communication channel with a webpage through a browser component, wherein the browser component is used for receiving a request sent by the webpage to a preset domain name;
the operating system performs information interaction with a local web service, acquires the request from the local web service, the local web service is used for redirecting the request through a firewall to acquire the request, the request comprises an application identifier of a target application and request content, and the request content is used for indicating an event that the web page needs to request the target application;
the operating system forwards the request content to a target application corresponding to the application identifier;
the operating system acquires response information fed back by the target application based on the request content;
and the operating system sends the response information to the webpage.
2. The method of claim 1, wherein prior to the operating system forwarding the requested content to the target application to which the application identification corresponds, further comprising:
the operating system inquires whether a target application corresponding to the application identifier is in a running state currently;
when the target application is in a running state currently, the operating system executes the operation of forwarding the request content to the target application corresponding to the application identifier; and when the target application is not in the running state currently, the operating system calls and runs the target application.
3. The method of claim 1, further comprising a request identification in the request, the request identification for uniquely identifying the request.
4. The method of claim 3, wherein the response information includes the request identification and an event result of the target application executing for the requested content.
5. The method of any of claims 1 to 4, wherein the operating system performs information interaction with a local web service, and obtaining the request from the local web service comprises:
the operating system obtains the request from the webpage from a clipboard, wherein the request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for realizing communication between the operating system and the webpage.
6. An information interaction device, the device being configured in an operating system, the device comprising:
the establishing module is configured to establish a bidirectional communication channel between an operating system and a webpage through a browser component, wherein the browser component is used for receiving a request sent by the webpage to a preset domain name;
the receiving module is configured to perform information interaction between the operating system and a local web service, and acquire the request from the local web service, wherein the local web service is used for redirecting the request through a firewall to acquire the request, the request comprises an application identifier of a target application and request content, and the request content is used for indicating an event that the web page needs to request the target application;
a forwarding module configured to forward the request content to a target application corresponding to the application identifier;
an obtaining module configured to obtain response information fed back by the target application based on the request content;
a sending module configured to send the response information to the web page.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the query module is configured to query whether the target application corresponding to the application identifier is currently in a running state;
the forwarding module is further configured to forward the request content to a target application corresponding to the application identifier when the target application is currently in a running state;
and the calling module is configured to call and run the target application when the target application is not in a running state currently.
8. The apparatus of claim 6, wherein the request further comprises a request identification, the request identification to uniquely identify the request.
9. The apparatus of claim 8, wherein the response information comprises the request identification and an event result of the target application executing for the requested content.
10. The apparatus of any of claims 6 to 9, wherein the receiving module is further configured to:
and acquiring the request from the webpage from a clipboard, wherein the request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for realizing communication between the operating system and the webpage.
11. An information interaction apparatus, the apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of any of the methods of claims 1-5.
12. A non-transitory computer readable storage medium, having stored thereon a computer program, characterized in that the computer program, when being executed by a processor, realizes the steps of any one of the methods of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810718218.9A CN108833585B (en) | 2018-07-03 | 2018-07-03 | Information interaction method and device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810718218.9A CN108833585B (en) | 2018-07-03 | 2018-07-03 | Information interaction method and device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108833585A CN108833585A (en) | 2018-11-16 |
CN108833585B true CN108833585B (en) | 2021-06-29 |
Family
ID=64135371
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810718218.9A Active CN108833585B (en) | 2018-07-03 | 2018-07-03 | Information interaction method and device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108833585B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109739662A (en) * | 2018-12-29 | 2019-05-10 | 北京小米移动软件有限公司 | Communication means and device |
CN109714425A (en) * | 2018-12-29 | 2019-05-03 | 北京小米移动软件有限公司 | Communication means and device |
CN109815030B (en) * | 2019-01-10 | 2021-07-23 | 北京小米移动软件有限公司 | Communication method and device |
CN110007982B (en) * | 2019-03-05 | 2022-09-30 | 北京小米移动软件有限公司 | Communication method and device |
CN110602172B (en) * | 2019-08-20 | 2022-09-30 | 网宿科技股份有限公司 | Link identification generation method and device |
CN110602171B (en) * | 2019-08-20 | 2022-09-30 | 网宿科技股份有限公司 | Interaction method and device |
CN112417355B (en) * | 2020-11-27 | 2023-09-05 | 深圳市和讯华谷信息技术有限公司 | Data interaction method, device, equipment and storage medium based on long connection single channel |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106503134A (en) * | 2016-10-19 | 2017-03-15 | 广东欧珀移动通信有限公司 | Browser jumps to the method for data synchronization and device of application program |
CN108156221A (en) * | 2017-12-04 | 2018-06-12 | 北京小米移动软件有限公司 | Communication means, device and electronic equipment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10635505B2 (en) * | 2015-06-30 | 2020-04-28 | Coursera, Inc. | Automated batch application programming interfaces |
-
2018
- 2018-07-03 CN CN201810718218.9A patent/CN108833585B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106503134A (en) * | 2016-10-19 | 2017-03-15 | 广东欧珀移动通信有限公司 | Browser jumps to the method for data synchronization and device of application program |
CN108156221A (en) * | 2017-12-04 | 2018-06-12 | 北京小米移动软件有限公司 | Communication means, device and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN108833585A (en) | 2018-11-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108833585B (en) | Information interaction method and device and storage medium | |
CN106603667B (en) | Screen information sharing method and device | |
CN108965413B (en) | Information interaction method and device and storage medium | |
JP6228676B2 (en) | Connection state prompting method and apparatus | |
CN108390944B (en) | Information interaction method and device | |
CN108600529B (en) | Information interaction method and device and computer readable storage medium | |
CN113783774B (en) | Cross-cluster network configuration method and device, communication equipment and storage medium | |
CN108702763B (en) | Method and device for sending lead code and scheduling request | |
CN109525652B (en) | Information sharing method, device, equipment and storage medium | |
US11805562B2 (en) | User device pairing method and apparatus | |
CN107395624B (en) | Information processing method and device | |
CN115208873A (en) | File transmission method, device and storage medium | |
CN104572230B (en) | Script file loading method and device and script file generating method and device | |
CN104618987B (en) | Access the method and device of network | |
CN109885360B (en) | Data processing method, device and storage medium | |
CN110008668B (en) | Data processing method, device and storage medium | |
CN109976872B (en) | Data processing method and device, electronic equipment and storage medium | |
CN111782997A (en) | Method and device for loading webpage and storage medium | |
CN114430410B (en) | System access method, device and equipment based on virtual domain name | |
CN111079040A (en) | Resource sniffing method, device, terminal, server and storage medium | |
CN107070816B (en) | Application identification method and device and mobile terminal | |
CN112929271B (en) | Route configuration method and device for configuring route | |
JP6441385B2 (en) | Information input method, apparatus, program, and recording medium | |
CN114422472A (en) | Network address conversion method and device and electronic equipment | |
CN110278228B (en) | Data processing method and device for data processing |
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 |