CN104461575A - Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform - Google Patents
Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform Download PDFInfo
- Publication number
- CN104461575A CN104461575A CN201410834506.2A CN201410834506A CN104461575A CN 104461575 A CN104461575 A CN 104461575A CN 201410834506 A CN201410834506 A CN 201410834506A CN 104461575 A CN104461575 A CN 104461575A
- Authority
- CN
- China
- Prior art keywords
- module
- exchanges data
- data carrier
- calling
- server
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 48
- 238000005538 encapsulation Methods 0.000 claims abstract description 18
- 238000012546 transfer Methods 0.000 claims description 44
- 230000005540 biological transmission Effects 0.000 claims description 7
- 230000001360 synchronised effect Effects 0.000 claims description 6
- 239000000969 carrier Substances 0.000 abstract 2
- 230000006870 function Effects 0.000 description 27
- 230000018109 developmental process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 10
- 238000011161 development Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 9
- 230000007547 defect Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 239000002360 explosive Substances 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000008140 language development Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000033764 rhythmic process Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
The invention discloses a device and method for JavaScript native interface calling conducted by crossing a mobile operating system platform. The device comprises a forward system and a reverse system, wherein the forward system is used for transferring data exchange carriers of web script programs to a native interface of a mobile terminal, and the reverse system is used for transferring the data exchange carriers returned by the native interface of the mobile terminal to the web script programs in the mode that local services are executed synchronously or asynchronously. The forward system comprises a unified interface calling module, a calling prompt module, a kernel encapsulation class module and a plug-in management module. The reverse system comprises a call-back module and a call-back server module.
Description
Technical field
The present invention relates to native interface calling device, particularly the device that calls across Mobile operating system platform native interface of a kind of JavaScript.
Background technology
The development course of Mobile operating system is of flowing rhythm.From the Symbian of the dominance finally of Linux the earliest, then iOS and Android of unlimited opportunities by now, Mobile operating system is day by day perfect.Along with operating system highlighting in industrial chain core status, the competition between the ecosystem has been developed in the competition of terminal and application aspect in each large enterprises.Current Mobile solution market has begun to take shape the large camp of iOS, Android and Windows Phone tri-, and remaining traditional camp (Symbian and RIM etc.) also should not be underestimated by means of historical reasons and huge user base number certainly.
Along with the fast development in Mobile solution market and enterprise's application demand of explosive growth, increasing developer also wishes can join in the main forces of Mobile solution exploitation.But at present, Android application is developed based on Java language, the iOS application of Apple is based on Objective-C language development, and the Windows Phone application of Microsoft is then developed based on C# language.If the application that developer writes is wanted to run on different mobile devices simultaneously, then must grasp multiple development language, but this certainly will will have a strong impact on software development progress and project on-line time, and become a great problem of development teams.
In prior art, each Mobile operating system native applications is packaged into Web application, pass through browser access, such web has cross-platform advantage, but these application based on browser cannot realize some Premium Features by calling system API, are also not suitable for the occasion of high performance requirements, viewing experience also cannot overload native applications in a short time, do not support off-line mode, message push is not prompt enough, and the ability calling local file system is weak.
Through finding the retrieval of prior art, the method and apparatus of a kind of application development disclosed in Chinese patent application CN201110029661.3, the method can realize that web is cross-platform calls native interface, but, this kind of device transmission data mode is single, underaction makes data easily lose, and data security is low.
Due to the existence of the problems referred to above, the present inventor carries out research and analysis to existing mobile technology, can produce a kind of apparatus and method that can be used for browser to break through platform limiting access native interface, and the security that this device transmits data is high, the mode transmitting data is flexible.
Summary of the invention
In order to solve the problem, present inventor has performed and study with keen determination, found that: by local ridge method complete from Javascript hold the data between native interface mutual transmission, described local ridge method is realized by forward module and reverse module, local ridge method makes up the defect that primary exploitation and pure Web develop two kinds of application and development patterns, by the mode synchronously performing local service or asynchronous execution local service, the JSON data information transfer that mobile terminal native interface returns is held to JavaScript, make this device data transfer mode various, flexibly, the security of data is high.Thus complete the present invention.
The object of the present invention is to provide following aspect:
The device that first aspect, a kind of page script language call across Mobile operating system platform native interface, it is characterized in that, this device comprises:
Yaw guy, in order to the exchanges data carrier transfer that page script program the spread out of native interface to mobile terminal; With
Reverse system, the exchanges data carrier transfer that mobile terminal native interface returns by its mode passing through synchronous execution local service or asynchronous execution local service is to page script program;
Wherein, described yaw guy comprises:
Unified call interface module 001, its exchanges data carrier transmitted for receiving page script program, by exchanges data carrier transfer to calling reminding module 002, also for calling exchanges data carrier transfer that reminding module 002 returns to page script program by following;
Call reminding module 002, it receives the exchanges data carrier that unified call interface module 001 is transmitted, by exchanges data carrier transfer to kernel encapsulation generic module 003, also in order to receive following callback module 005 passback exchanges data carrier or following readjustment server module 006 passback exchanges data carrier, and by the exchanges data carrier transfer of passback to unified call interface module 001
Kernel encapsulation generic module 003, it receives the exchanges data carrier calling reminding module 002 and transmit, and resolves, separated from exchanges data carrier the parameter information comprised in exchanges data carrier data exchange carrier, and parameter information is delivered to plug-in management module 004
Plug-in management module 004, it receives the parameter information that kernel encapsulation generic module 003 transmits, and calls the native interface of mobile terminal according to the exchanges data carrier received;
Wherein, reverse module comprises:
Callback module 005, its exchanges data carrier transfer native interface returned in the mode synchronously performing local service is to calling reminding module 002;
Readjustment server module 006, its exchanges data carrier transfer native interface returned in one or both modes in polling mode and XHR mode is to calling in reminding module 002 and callback module 005.
The device that second aspect, page script language according to above-mentioned first aspect call across Mobile operating system platform native interface, is characterized in that,
The native interface of mobile terminal comprises the gravitometer interface of mobile device, address list interface and utilizing camera interface.
The device that the third aspect, page script language according to above-mentioned first aspect call across Mobile operating system platform native interface, is characterized in that,
Described polling mode for call reminding module 002 call readjustment server module 006 after, readjustment server module 006 to call reminding module 002 transmit passback exchanges data carrier.
The device that fourth aspect, page script language according to above-mentioned first aspect call across Mobile operating system platform native interface, is characterized in that,
Described XHR mode comprises the following steps:
(1) in readjustment server module 006 inside, server is set, calling of the reminding modules 002 to be called such as this server;
(2) server is after receiving and calling the calling of reminding module 002, if do not wait for the exchanges data carrier of passback in server, then server can keep the several seconds, server timeout after the several seconds, is delivered to by HTTP/1.1404 and calls reminding module (002);
If there is the exchanges data carrier waiting for passback in server, is then delivered to after the exchanges data vector encoded of passback being become UTF-8 and calls reminding module 002.
A kind of method that 5th aspect, page script language call across Mobile operating system platform native interface, it is characterized in that, this device comprises:
Forward transmission step, in order to the exchanges data carrier transfer that page script program the spread out of native interface to mobile terminal; With
Back transfer step, the exchanges data carrier transfer that mobile terminal native interface returns by its mode passing through synchronous execution local service or asynchronous execution local service is to page script program;
Wherein, described forward transmission step comprises:
The exchanges data carrier that step (1), unified call interface module 001 are transmitted for receiving page script program, by exchanges data carrier transfer to calling reminding module 002, also for calling exchanges data carrier transfer that reminding module 002 returns to page script program by following;
Step (2), call reminding module 002 receive unified call interface module 001 transmit exchanges data carrier, by exchanges data carrier transfer to kernel encapsulation generic module 003, also in order to receive following callback module 005 passback exchanges data carrier or following readjustment server module 006 passback exchanges data carrier, and by the exchanges data carrier transfer of passback to unified call interface module 001
Step (3), kernel encapsulation generic module 003 receives the exchanges data carrier calling reminding module 002 and transmit, data exchange carrier is resolved, the parameter information comprised in exchanges data carrier is separated from exchanges data carrier, and parameter information is delivered to plug-in management module 004
Step (4), plug-in management module 004 receive the parameter information that kernel encapsulation generic module 003 transmits, and call the native interface of mobile terminal according to the exchanges data carrier received;
Wherein, back transfer step comprises:
The exchanges data carrier transfer that native interface returns in the mode synchronously performing local service by step (1), callback module 005 is to calling reminding module 002;
The exchanges data carrier transfer that native interface returns in one or both modes in polling mode and XHR mode by step (2), readjustment server module 006 is to calling in reminding module 002 and callback module 005.
The method that 6th aspect, page script language according to above-mentioned 5th aspect call across Mobile operating system platform native interface, is characterized in that,
The native interface of mobile terminal comprises the gravitometer interface of mobile device, address list interface and utilizing camera interface.
The method that 7th aspect, page script language according to above-mentioned 5th aspect call across Mobile operating system platform native interface, is characterized in that,
Described polling mode for call reminding module 002 call readjustment server module 006 after, readjustment server module 006 to call reminding module 002 transmit passback exchanges data carrier.
The method that eighth aspect, page script language according to above-mentioned 5th aspect call across Mobile operating system platform native interface, is characterized in that,
Described XHR mode comprises the following steps:
(1) in readjustment server module 006 inside, server is set, calling of the reminding modules 002 to be called such as this server;
(2) server is after receiving and calling the calling of reminding module 002, if do not wait for the exchanges data carrier of passback in server, then server can keep the several seconds, server timeout after the several seconds, is delivered to by HTTP/1.1404 and calls reminding module (002);
If there is the exchanges data carrier waiting for passback in server, is then delivered to after the exchanges data vector encoded of passback being become UTF-8 and calls reminding module 002.
According to the device and method that a kind of JavaScript provided by the invention calls across Mobile operating system platform native interface, it has following beneficial effect:
The first, this device makes up primary exploitation and pure Web develops the defect of two kinds of application and development patterns and gives birth to.
The second, identical code only needs to carry out compiling for different platform and just can realize in multi-platform distribution, substantially increases the efficiency of multi-platform exploitation.And apply compared to pure Web, developer across Mobile operating system platform invoke native interface, can also realize better Consumer's Experience and function.
Three, this device returns JSON data message by two kinds of modes, makes this device data transfer mode flexible, also improves the security that data are transmitted simultaneously, and the data returned not easily are lost.
Accompanying drawing explanation
Fig. 1 illustrates the structural representation of the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Fig. 2 illustrates direct die block structure schematic diagram in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Fig. 3 to illustrate in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention oppositely modular structure schematic diagram;
Fig. 4 to illustrate in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention oppositely modular structure schematic diagram;
Fig. 5 to illustrate in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention oppositely modular structure schematic diagram;
Fig. 6 illustrates the process flow diagram of unified call interface module in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Fig. 7 illustrates the process flow diagram calling reminding module in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Fig. 8 illustrates the process flow diagram of plug-in management module in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Fig. 9 illustrates the process flow diagram of kernel encapsulation generic module in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Figure 10 illustrates the process flow diagram of callback module in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention;
Figure 11 illustrates the process flow diagram of adjusting back server module in the device called across Mobile operating system platform native interface according to a kind of page script language of a kind of preferred implementation of the present invention.
Drawing reference numeral illustrates:
001-unified call interface module
002-calls reminding module
003-kernel encapsulation generic module
004-plug-in management module
005-callback module
006-adjusts back server module
Embodiment
Below by the present invention is described in detail, the features and advantages of the invention will illustrate along with these and become more clear, clear and definite.
Word " exemplary " special here means " as example, embodiment or illustrative ".Here need not be interpreted as being better than or being better than other embodiment as any embodiment illustrated by " exemplary ".Although the various aspects of embodiment shown in the drawings, unless otherwise indicated, accompanying drawing need not be drawn in proportion.
According to of the present invention one preferred embodiment in, as as shown in Fig. 1-11, the present invention makes page script language (page script language is JavaScript) across Mobile operating system platform invoke native interface by local ridge method, described local ridge method is realized by forward module and reverse module, local ridge method makes up the defect that primary exploitation and pure Web develop two kinds of application and development patterns, identical code only needs to carry out compiling for different platform and just can realize in multi-platform distribution, substantially increases the efficiency of multi-platform exploitation.And apply compared to pure Web, developer across Mobile operating system platform invoke native interface, can also realize better Consumer's Experience and function.Use the technology of the present invention, can effectively realize simply developing Mobile solution fast.
In one preferred embodiment, page script program of the present invention is javascript end, and described exchanges data carrier is JSON data message.
In one preferred embodiment, as in Fig. 1-5, described forward module comprises: unified call interface module 001, calls reminding module 002, kernel encapsulation generic module 003 and plug-in management module 004,
Wherein, unified call interface module 001 receives the JSON data message of javascript end and this information is delivered to and calls reminding module 002, and hold calling the JSON data information transfer that reminding module 002 returns to javascript, unified call interface module 001 is the unified call module towards browser, all bridge joint requests are all called by this normalized module, what this module shield mobile terminal inside was complicated realizes details, simplify the call operation of user, improve the efficiency that these device data are transmitted, make this device can adapt to various mobile platform.
Wherein, unified call interface module 001 can be realized by execute function, execute function is as follows: execute (success, failure, service, actionID, arguments), wherein success is the call back function after operation runs succeeded, failure is that operation performs the call back function unsuccessfully, service is the local native interface method name that will call, and actionID is the concrete operations that will perform service, and arguments is the design parameter required for operation.
In one preferred embodiment, as shown in figs. 1-2, described in call reminding module 002 and can be realized by message function, wherein, message function is as follows:
Var r=message (JSON.stringify (arguments), JSON.stringify ([service, actionID, callbackID, true])); Wherein parametric t rue is the native interface of indicating mobile terminal is that the mode synchronously performing local service or asynchronous execution local service returns JSON data message, if asynchronous, so message () function returns null character string; If can only be synchronous, so message () function returns JSON formatted data information (as shown in Figure 2).
In one preferred embodiment, as shown in figs. 1-2, kernel encapsulation generic module (003) this module is a self defined class file, cover the onJsAlert () under mobile browser kernel file WebChromeClient, onJsConfirm (), onJsPrompt () method, this resume module calls the request of reminding module 002, the primary module that this module utilizes and transformation mobile browser carries is to meet bridging requirement, be convenient to the maintenance in later stage, wherein, onJsAlert (), onJsConfirm (), onJsPrompt () method signature is as follows respectively:
public boolean onJsAlert(WebView view,String url,Stringmessage,final JsResult result);
public boolean onJsConfirm(WebView view,String url,String message,final JsResult result)
public boolean onJsPrompt(WebView view,String url,Stringmessage,String defaultValue,final JsPromptResult result);
The JSON data message passed over before can be parsed according to defaultValue, after parsing, this module calls plug-in management module 004.
In the present invention, described parsing is separated by the parameter information in JSON data message, described parameter information comprises: success is the call back function after operation runs succeeded, failure is that operation performs the call back function unsuccessfully, service is the native interface method name of the mobile terminal that will call, actionID is the concrete operations that will perform service, and arguments is the design parameter required for operation.
In one preferred embodiment, as shown in fig. 1, plug-in management module 004 calls local native interface, and this module, based on the mode of plug-in management, finally realizes the primary service interface that JavaScript layer calls mobile terminal.Wherein, plug-in management module 004 can be realized by PluginManager class, and PluginManager comprises following method:
PluginManager.execute(service,actionID,callbackID,message,async),
This module calls the native interface of mobile terminal, as first-class in gravitometer, address list and shooting,
The bottom of plug-in management module 004 pair of mobile device calls and all manages based on plug-in type, reason is the uncertainty of mobile device hardware information, whether can have camera, whether have gravity sensor etc. by checkout equipment before calling, this module realizes loose formula and the freestanding management of intermodule.
In one preferred embodiment, the native interface of mobile terminal is to the communication of JavaScript, by the mode synchronously performing local service or asynchronous execution local service, native interface is returned JSON data and be delivered to Javascript end, by two kinds of mode return data, this device dirigibility is increased; Make data not easily lose simultaneously, and then ensure that security and the integrality of data.
At one preferred embodiment, the JSON data of passback to be delivered in the mode synchronously performing local service and to call reminding module 002 by callback module, the JSON data information transfer that native interface returns in the mode of asynchronous execution local service by readjustment server module 006 is to calling in reminding module 002 and callback module 005
Wherein, the server that readjustment server module 006 provides can preserve the queue of JSON data message responds the request of the http protocol calling reminding module (002), finally ensures next JavaScript statement of successful asynchronous execution.
In one preferred embodiment, when this device callback module with the mode synchronously performing local service the JSON data of passback are delivered to call reminding module 002 time, callback module can be realized by JsResult or JsPromptResult class, in class, message () method passes JSON data message back message () function, and transfers back to JavaScript end by message () function.JavaScript end can resolve rreturn value, the success of importing into before going to adjust back according to analysis result or the call back function of failure, thus performs applied logic (whole invoked procedure is summed up as shown in Figure 3).
In one preferred embodiment, as shown in figs. 4-5, the asynchronous execution result of local service needs to be realized by readjustment server module (006),
Readjustment server module (006) can pass through CallbackContext Interface realization, this interface can preserve a JavaScript statement queue that JavaScript will be sent to hold, the success of definition before these statements contain or the call back function information of failure and the asynchronous execution result of local service.Since CallbackContext is a server, nature can not active response, need JavaScript to hold transmission statement to be obtained by CallbackContext.getQueue () method, traffic model has poll and XHR two kinds of modes can realize.By two kinds of mode return data, make this device transmit data mode flexible, add security and the integrality of data.
In one preferred embodiment, by means of message () method in polling mode, call CallbackContext.getQueue () to obtain next JavaScript statement that will perform and rreturn value passed to JavaScript end.
In one preferred embodiment, in XHR mode, CallbackContext achieves a simple server, waits for that asynchronous XHR calls, server can keep after receiving connection always this connect until 10 seconds time-out or have the JavaScript statement that will send.Time-out then responds HTTP/1.1404 to client; If there is the JavaScript statement that will send, is then encoded into UTF-8 and excessively http response can be returned to client.
Embodiment:
Unified call interface module 001:
execute(success,failure,service,actionID,arguments);
Call reminding module 002:
var r=message(JSON.stringify(arguments),JSON.stringify([service,actionID,callbackID,true]));
OnJsAlert, onJsConfirm or onJsPrompt method in kernel encapsulation generic module 003, ChromeClient.
Plug-in management module 004,
PluginManager.execute(service,actionID,callbackID,message,async);
Message () under callback module 005, JsResult or JsPromptResult class.
Readjustment server module 006, CallbackContext class;
Wherein, Javascript end to the process of native interface transfer data information is: execute function call message function, message function call onJsAlert, onJsConfirm or onJsPrompt method, message method call PluginManager.execute method, PluginManager.execute calls native interface;
Native interface to the process of Javascript end transfer data information is:
(1) the synchronous mode performing local service: under native interface passes through JsResult or JsPromptResult class, message method is to message function return data information,
(2) mode of asynchronous execution local service: message function calls CallbackContext.getQueue () by the mode of poll and XHR, obtains next JavaScript statement that will perform by getQueue ().
(2-1) polling mode: message function call CallbackContext.getQueue () obtains next JavaScript statement that will perform and rreturn value is passed to JavaScript end.
(2-2) XHR mode: the server achieving on CallbackContext, waits for that asynchronous XHR calls, server can keep after receiving connection always this connect until 10 seconds time-out or have the JavaScript statement that will send.Time-out then responds HTTP/1.1404 to client; If there is the JavaScript statement that will send, is then encoded into UTF-8 and excessively http response can be returned to mobile terminal.
In one preferred embodiment, call reminding module 002 and realize polling request or XHR request:
Polling request: realize principle still based on message function, directly calls the call back function (the whole polling procedure of transmitting terminal and receiving end as shown in Figure 4) of JavaScript end setting by eval function after message function takes result.
XHR mode.JavaScript end can construct XMLHttpRequest object and initiate asynchronous AJAX GET and ask, after request meets with a response, to be encoded returned text msg by decodeURIComponent () method UTF-8, and then call eval (msg) and perform.Normal request is disturbed to return results in order to prevent other application programs from accessing this readjustment server by XHR mode, JavaScript holds the request of returning to add security token, token is present in the URL of request with character string forms, the request only holding this token just can be processed, otherwise returns HTTP/1.1403 (the whole XHR process of transmitting terminal and receiving end as shown in Figure 5).
According to the device and method that a kind of JavaScript provided by the invention calls across Mobile operating system platform native interface, it has following beneficial effect:
The first, this device makes up primary exploitation and pure Web develops the defect of two kinds of application and development patterns and gives birth to.
The second, identical code only needs to carry out compiling for different platform and just can realize in multi-platform distribution, substantially increases the efficiency of multi-platform exploitation.And apply compared to pure Web, developer across Mobile operating system platform invoke native interface, can also realize better Consumer's Experience and function.Use the technology of the present invention, can effectively realize simply developing Mobile solution fast.
More than joint embodiment and exemplary example are to invention has been detailed description, but these explanations can not be interpreted as limitation of the present invention.It will be appreciated by those skilled in the art that when not departing from spirit and scope of the invention, can carry out multiple equivalencing, modification or improvement to technical solution of the present invention and embodiment thereof, these all fall within the scope of the present invention.Protection scope of the present invention is as the criterion with claims.
Claims (8)
1. the device that calls across Mobile operating system platform native interface of page script language, it is characterized in that, this device comprises:
Yaw guy, in order to the exchanges data carrier transfer that page script program the spread out of native interface to mobile terminal; With
Reverse system, the exchanges data carrier transfer that mobile terminal native interface returns by its mode passing through synchronous execution local service or asynchronous execution local service is to page script program;
Wherein, described yaw guy comprises:
Unified call interface module (001), its exchanges data carrier transmitted for receiving page script program, by exchanges data carrier transfer to calling reminding module (002), also for calling exchanges data carrier transfer that reminding module (002) returns to page script program by following;
Call reminding module (002), it receives the exchanges data carrier that unified call interface module (001) transmits, by exchanges data carrier transfer to kernel encapsulation generic module (003), also in order to receive exchanges data carrier that following callback module (005) returns or the exchanges data carrier that following readjustment server module (006) returns, and by the exchanges data carrier transfer of passback to unified call interface module (001)
Kernel encapsulation generic module (003), it receives the exchanges data carrier calling reminding module (002) and transmit, data exchange carrier is resolved, the parameter information comprised in exchanges data carrier is separated from exchanges data carrier, and parameter information is delivered to plug-in management module (004)
Plug-in management module (004), it receives the parameter information that kernel encapsulation generic module (003) transmits, and calls the native interface of mobile terminal according to the exchanges data carrier received;
Wherein, reverse module comprises:
Callback module (005), its exchanges data carrier transfer native interface returned in the mode synchronously performing local service is to calling reminding module (002);
Readjustment server module (006), its exchanges data carrier transfer native interface returned in one or both modes in polling mode and XHR mode is to calling in reminding module (002) and callback module (005).
2. the device that calls across Mobile operating system platform native interface of page script language according to claim 1, is characterized in that,
The native interface of mobile terminal comprises the gravitometer interface of mobile device, address list interface and utilizing camera interface.
3. the device that calls across Mobile operating system platform native interface of page script language according to claim 1, is characterized in that,
Described polling mode is for after calling reminding module (002) and calling readjustment server module (006), and readjustment server module (006) transmits the exchanges data carrier of passback to calling reminding module (002).
4. the device that calls across Mobile operating system platform native interface of page script language according to claim 1, is characterized in that,
Described XHR mode comprises the following steps:
(1) in readjustment server module (006) inside, server is set, calling of this server etc. reminding module to be called (002);
(2) server is after receiving and calling the calling of reminding module (002), if do not wait for the exchanges data carrier of passback in server, then server can keep the several seconds, server timeout after several seconds, is delivered to HTTP/1.1404 and calls reminding module (002);
If there is the exchanges data carrier waiting for passback in server, is then delivered to after the exchanges data vector encoded of passback being become UTF-8 and calls reminding module (002).
5. the method called across Mobile operating system platform native interface of page script language, it is characterized in that, the method comprises:
Forward transmission step, in order to the exchanges data carrier transfer that page script program the spread out of native interface to mobile terminal; With
Back transfer step, the exchanges data carrier transfer that mobile terminal native interface returns by its mode passing through synchronous execution local service or asynchronous execution local service is to page script program;
Wherein, described forward transmission step comprises:
The exchanges data carrier that step (1), unified call interface module (001) are transmitted for receiving page script program, by exchanges data carrier transfer to calling reminding module (002), also for calling exchanges data carrier transfer that reminding module (002) returns to page script program by following;
Step (2), call reminding module (002) and receive unified call interface module (001) the exchanges data carrier that transmits, by exchanges data carrier transfer to kernel encapsulation generic module (003), also in order to receive exchanges data carrier that following callback module (005) returns or the exchanges data carrier that following readjustment server module (006) returns, and by the exchanges data carrier transfer of passback to unified call interface module (001)
Step (3), kernel encapsulation generic module (003) receive the exchanges data carrier calling reminding module (002) and transmit, data exchange carrier is resolved, the parameter information comprised in exchanges data carrier is separated from exchanges data carrier, and parameter information is delivered to plug-in management module (004)
Step (4), plug-in management module (004) receive the parameter information that kernel encapsulation generic module (003) transmits, and call the native interface of mobile terminal according to the exchanges data carrier received;
Wherein, back transfer step comprises:
The exchanges data carrier transfer that native interface returns in the mode synchronously performing local service by step (1), callback module (005) is to calling reminding module (002);
The exchanges data carrier transfer that native interface returns in one or both modes in polling mode and XHR mode by step (2), readjustment server module (006) is to calling in reminding module (002) and callback module (005).
6. the method called across Mobile operating system platform native interface of page script language according to claim 5, is characterized in that,
The native interface of mobile terminal comprises the gravitometer interface of mobile device, address list interface and utilizing camera interface.
7. the method called across Mobile operating system platform native interface of page script language according to claim 5, is characterized in that,
Described polling mode is for after calling reminding module (002) and calling readjustment server module (006), and readjustment server module (006) transmits the exchanges data carrier of passback to calling reminding module (002).
8. the method called across Mobile operating system platform native interface of page script language according to claim 5, is characterized in that,
Described XHR mode comprises the following steps:
(1) in readjustment server module (006) inside, server is set, calling of this server etc. reminding module to be called (002);
(2) server is after receiving and calling the calling of reminding module (002), if do not wait for the exchanges data carrier of passback in server, then server can keep the several seconds, server timeout after several seconds, is delivered to HTTP/1.1404 and calls reminding module (002);
If there is the exchanges data carrier waiting for passback in server, is then delivered to after the exchanges data vector encoded of passback being become UTF-8 and calls reminding module (002).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410834506.2A CN104461575B (en) | 2014-12-26 | 2014-12-26 | The device and method that a kind of across Mobile operating system platform native interface of page script language is called |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410834506.2A CN104461575B (en) | 2014-12-26 | 2014-12-26 | The device and method that a kind of across Mobile operating system platform native interface of page script language is called |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104461575A true CN104461575A (en) | 2015-03-25 |
CN104461575B CN104461575B (en) | 2017-11-10 |
Family
ID=52907686
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410834506.2A Expired - Fee Related CN104461575B (en) | 2014-12-26 | 2014-12-26 | The device and method that a kind of across Mobile operating system platform native interface of page script language is called |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104461575B (en) |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105138340A (en) * | 2015-09-15 | 2015-12-09 | 北京齐尔布莱特科技有限公司 | Interaction method and system for Native and Web pages |
CN105138399A (en) * | 2015-10-20 | 2015-12-09 | 深圳天源迪科信息技术股份有限公司 | Cross-platform mobile Web application runtime engine |
CN105468369A (en) * | 2015-11-19 | 2016-04-06 | 深圳联友科技有限公司 | Method and system for calling native function by JavaScript on mobile platform |
CN105718512A (en) * | 2016-01-13 | 2016-06-29 | 北京齐尔布莱特科技有限公司 | Method for calling native language by using JS language in Ios system |
CN106095886A (en) * | 2016-06-03 | 2016-11-09 | 腾讯科技(深圳)有限公司 | A kind of data processing method and device thereof |
CN106325948A (en) * | 2016-08-27 | 2017-01-11 | 飞天诚信科技股份有限公司 | Method and device for supporting existing Web applications through mobile platform |
CN106339229A (en) * | 2016-08-31 | 2017-01-18 | 虎扑(上海)文化传播股份有限公司 | Hybrid development method and hybrid development system for mobile platform |
CN108804243A (en) * | 2018-05-23 | 2018-11-13 | 北京五八信息技术有限公司 | A kind of exchange method, device, computer equipment and computer readable storage medium |
CN108874554A (en) * | 2017-05-09 | 2018-11-23 | 腾讯科技(深圳)有限公司 | Information communicating method and device |
CN109634751A (en) * | 2018-10-19 | 2019-04-16 | 深圳市网旭科技有限公司 | A method of application layer and bottom communication are realized using electron frame |
CN109656466A (en) * | 2019-03-14 | 2019-04-19 | 北京小米移动软件有限公司 | System information transmission method, device and computer readable storage medium |
CN109976831A (en) * | 2019-03-28 | 2019-07-05 | 山东浪潮通软信息科技有限公司 | Data interactive method between a kind of JavaScript and primary APP |
CN110134386A (en) * | 2019-04-04 | 2019-08-16 | 成都娄外科技有限公司 | A kind of program editing method and device |
CN110275738A (en) * | 2019-06-30 | 2019-09-24 | 浪潮卓数大数据产业发展有限公司 | A kind of Android bidirectional interaction method based on JsBridge |
CN110908646A (en) * | 2019-11-29 | 2020-03-24 | 苏州精易会信息技术有限公司 | Building block type callback function block construction method and device, storage medium and processor |
CN111684420A (en) * | 2019-06-12 | 2020-09-18 | 深圳市大疆创新科技有限公司 | Method and device for calling functional module and computer readable storage medium |
CN112035097A (en) * | 2020-08-25 | 2020-12-04 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | C + + adaptation layer based on Yinhua operation system of Galaxy |
CN113032167A (en) * | 2021-03-31 | 2021-06-25 | 完美世界(北京)软件科技发展有限公司 | Page communication method, device and equipment |
CN113778566A (en) * | 2021-01-29 | 2021-12-10 | 北京京东拓先科技有限公司 | Native application calling method and device, electronic equipment and computer readable medium |
CN115103116A (en) * | 2022-06-16 | 2022-09-23 | 北京字跳网络技术有限公司 | Camera data acquisition method, device, equipment, storage medium and program product |
CN115185712A (en) * | 2022-09-08 | 2022-10-14 | 中化现代农业有限公司 | Data interaction method and device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090307260A1 (en) * | 2006-09-22 | 2009-12-10 | Roemerman Steven D | System-of-Systems Knowledge Management System and Method of Operating the Same |
CN102200909A (en) * | 2010-07-30 | 2011-09-28 | 深圳市融创天下科技发展有限公司 | Mobile terminal uniform interface method and system |
CN103106102A (en) * | 2013-01-14 | 2013-05-15 | 百度在线网络技术(北京)有限公司 | Running method of Web application program and mobile terminal |
CN103677843A (en) * | 2013-12-19 | 2014-03-26 | 深圳市迈桥科技有限公司 | Native capacity development method and device across mobile terminals |
-
2014
- 2014-12-26 CN CN201410834506.2A patent/CN104461575B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090307260A1 (en) * | 2006-09-22 | 2009-12-10 | Roemerman Steven D | System-of-Systems Knowledge Management System and Method of Operating the Same |
CN102200909A (en) * | 2010-07-30 | 2011-09-28 | 深圳市融创天下科技发展有限公司 | Mobile terminal uniform interface method and system |
CN103106102A (en) * | 2013-01-14 | 2013-05-15 | 百度在线网络技术(北京)有限公司 | Running method of Web application program and mobile terminal |
CN103677843A (en) * | 2013-12-19 | 2014-03-26 | 深圳市迈桥科技有限公司 | Native capacity development method and device across mobile terminals |
Cited By (31)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105138340A (en) * | 2015-09-15 | 2015-12-09 | 北京齐尔布莱特科技有限公司 | Interaction method and system for Native and Web pages |
CN105138340B (en) * | 2015-09-15 | 2019-04-02 | 北京齐尔布莱特科技有限公司 | A kind of exchange method and system of Native and Web page |
CN105138399A (en) * | 2015-10-20 | 2015-12-09 | 深圳天源迪科信息技术股份有限公司 | Cross-platform mobile Web application runtime engine |
CN105468369A (en) * | 2015-11-19 | 2016-04-06 | 深圳联友科技有限公司 | Method and system for calling native function by JavaScript on mobile platform |
CN105468369B (en) * | 2015-11-19 | 2019-03-26 | 深圳联友科技有限公司 | JavaScript calls the method and system of primary function on mobile platform |
CN105718512A (en) * | 2016-01-13 | 2016-06-29 | 北京齐尔布莱特科技有限公司 | Method for calling native language by using JS language in Ios system |
CN106095886A (en) * | 2016-06-03 | 2016-11-09 | 腾讯科技(深圳)有限公司 | A kind of data processing method and device thereof |
CN106095886B (en) * | 2016-06-03 | 2020-10-09 | 腾讯科技(深圳)有限公司 | Data processing method and device |
CN106325948A (en) * | 2016-08-27 | 2017-01-11 | 飞天诚信科技股份有限公司 | Method and device for supporting existing Web applications through mobile platform |
CN106325948B (en) * | 2016-08-27 | 2019-07-26 | 飞天诚信科技股份有限公司 | A kind of mobile platform supports the method and device of existing Web application |
CN106339229A (en) * | 2016-08-31 | 2017-01-18 | 虎扑(上海)文化传播股份有限公司 | Hybrid development method and hybrid development system for mobile platform |
CN108874554A (en) * | 2017-05-09 | 2018-11-23 | 腾讯科技(深圳)有限公司 | Information communicating method and device |
CN108804243A (en) * | 2018-05-23 | 2018-11-13 | 北京五八信息技术有限公司 | A kind of exchange method, device, computer equipment and computer readable storage medium |
CN109634751A (en) * | 2018-10-19 | 2019-04-16 | 深圳市网旭科技有限公司 | A method of application layer and bottom communication are realized using electron frame |
CN109634751B (en) * | 2018-10-19 | 2022-11-29 | 深圳市网旭科技有限公司 | Method for realizing communication between application layer and bottom layer by utilizing electron framework |
CN109656466A (en) * | 2019-03-14 | 2019-04-19 | 北京小米移动软件有限公司 | System information transmission method, device and computer readable storage medium |
CN109656466B (en) * | 2019-03-14 | 2019-05-24 | 北京小米移动软件有限公司 | System information transmission method, device and computer readable storage medium |
CN109976831A (en) * | 2019-03-28 | 2019-07-05 | 山东浪潮通软信息科技有限公司 | Data interactive method between a kind of JavaScript and primary APP |
CN110134386A (en) * | 2019-04-04 | 2019-08-16 | 成都娄外科技有限公司 | A kind of program editing method and device |
CN110134386B (en) * | 2019-04-04 | 2023-04-18 | 成都娄外科技有限公司 | Program editing method and device |
CN111684420A (en) * | 2019-06-12 | 2020-09-18 | 深圳市大疆创新科技有限公司 | Method and device for calling functional module and computer readable storage medium |
WO2020248172A1 (en) * | 2019-06-12 | 2020-12-17 | 深圳市大疆创新科技有限公司 | Functional module invoking method, device and computer readable storage medium |
CN110275738A (en) * | 2019-06-30 | 2019-09-24 | 浪潮卓数大数据产业发展有限公司 | A kind of Android bidirectional interaction method based on JsBridge |
CN110908646A (en) * | 2019-11-29 | 2020-03-24 | 苏州精易会信息技术有限公司 | Building block type callback function block construction method and device, storage medium and processor |
CN112035097A (en) * | 2020-08-25 | 2020-12-04 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | C + + adaptation layer based on Yinhua operation system of Galaxy |
CN112035097B (en) * | 2020-08-25 | 2023-10-13 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | C++ adaptation layer device based on Galaxy Ruihua operating system |
CN113778566A (en) * | 2021-01-29 | 2021-12-10 | 北京京东拓先科技有限公司 | Native application calling method and device, electronic equipment and computer readable medium |
CN113032167A (en) * | 2021-03-31 | 2021-06-25 | 完美世界(北京)软件科技发展有限公司 | Page communication method, device and equipment |
CN115103116A (en) * | 2022-06-16 | 2022-09-23 | 北京字跳网络技术有限公司 | Camera data acquisition method, device, equipment, storage medium and program product |
CN115185712A (en) * | 2022-09-08 | 2022-10-14 | 中化现代农业有限公司 | Data interaction method and device, electronic equipment and storage medium |
CN115185712B (en) * | 2022-09-08 | 2022-12-27 | 中化现代农业有限公司 | Data interaction method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN104461575B (en) | 2017-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104461575A (en) | Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform | |
US11716264B2 (en) | In situ triggered function as a service within a service mesh | |
CN103309660B (en) | Mobile solution cross-platform development method | |
CN104967644B (en) | Information push method, apparatus and system | |
US20190095200A1 (en) | Compatibility method based on hybrid, adapter, operation device, system and computer-readable storage medium | |
CN105721512A (en) | Remote process calling system and method thereof | |
US20230388385A1 (en) | Connection processing method and apparatus, electronic device, and computer-readable storage medium | |
CN111786939B (en) | Method, device and system for testing management platform of Internet of things | |
CN113746683B (en) | Interconnection, intercommunication and interoperation simulation method under cross-domain environment | |
CN113114535A (en) | Network fault detection method and device and electronic equipment | |
CN109462659A (en) | Embedded device remote access control system, method and storage medium | |
CN103684913B (en) | Method of testing, physical equipment, terminal and the system of protocol stack | |
CN110764983A (en) | Test method, device, medium and electronic equipment | |
CN104636249A (en) | Generation system and method of debugging information of application program | |
CN102315981B (en) | Equipment and method for testing evolved packet core network equipment | |
CN110290139B (en) | Message transmission method and device | |
CN202798801U (en) | Universal communication system for achieving distributed data interaction | |
CN103152216B (en) | The method of testing of system and device in a kind of the Internet | |
CN106302432A (en) | A kind of communicator based on car networking and control method | |
CN104796458A (en) | Information fusion method for Android system | |
CN106534602B (en) | A kind of terminal and information processing method | |
US9361191B2 (en) | Methods and apparatus for data recovery following a service interruption at a central processing station | |
CN110489249B (en) | Message processing method and system | |
CN108712373A (en) | One-way communication method, apparatus, user terminal and computer readable storage medium | |
JP6218937B2 (en) | Service scheduling method, system, terminal, and storage medium based on clustering system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20171110 |