CN104461575B - The device and method that a kind of across Mobile operating system platform native interface of page script language is called - Google Patents

The device and method that a kind of across Mobile operating system platform native interface of page script language is called Download PDF

Info

Publication number
CN104461575B
CN104461575B CN201410834506.2A CN201410834506A CN104461575B CN 104461575 B CN104461575 B CN 104461575B CN 201410834506 A CN201410834506 A CN 201410834506A CN 104461575 B CN104461575 B CN 104461575B
Authority
CN
China
Prior art keywords
module
data exchange
exchange carrier
interface
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.)
Active
Application number
CN201410834506.2A
Other languages
Chinese (zh)
Other versions
CN104461575A (en
Inventor
方宝友
饶英俊
李建中
马春宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING HUADIAN WANGTONG S&T CO LTD
Original Assignee
BEIJING HUADIAN WANGTONG S&T CO LTD
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by BEIJING HUADIAN WANGTONG S&T CO LTD filed Critical BEIJING HUADIAN WANGTONG S&T CO LTD
Priority to CN201410834506.2A priority Critical patent/CN104461575B/en
Publication of CN104461575A publication Critical patent/CN104461575A/en
Application granted granted Critical
Publication of CN104461575B publication Critical patent/CN104461575B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses the apparatus and method that a kind of across the Mobile operating system platform native interface of page script language is called, the device includes:Yaw guy, the data exchange carrier of page script program to be delivered to the native interface of mobile terminal;And reverse system, the data exchange carrier that mobile terminal native interface returns is delivered to page script program by it by way of synchronously performing local service or asynchronous execution local service;Wherein, yaw guy includes:Unified call interface module, call reminding module, kernel encapsulation generic module, plug-in management module;Wherein, reverse submodule includes:Callback module, and readjustment server module.

Description

The device that a kind of across Mobile operating system platform native interface of page script language is called And method
Technical field
The present invention relates to native interface calling device, more particularly to a kind of across Mobile operating system platforms of JavaScript are former The device of raw interface interchange.
Background technology
The development course of Mobile operating system, it is of flowing rhythm.From earliest Linux finally dominance Symbian, then the iOS and Android of unlimited opportunities, Mobile operating system are increasingly perfect by now.As operating system is being produced Industry chain core status highlights, and the competition between the ecosystem has been developed into the competition of terminal and application aspect in each large enterprises. Mobile solution market has preliminarily formed tri- big camps of iOS, Android and Windows Phone at present, certainly remaining biography System camp (Symbian and RIM etc.) also should not be underestimated by historical reasons and huge user base number.
With the fast development in Mobile solution market and enterprise's application demand of explosive growth, increasing developer It also is intended to be added in the main forces of Mobile solution exploitation.But at present, Android applications are developed based on Java language , the iOS applications of Apple Inc. are that the Windows Phone applications of Microsoft are then based on Objective-C language developments It is to be developed based on C# language.If the application that developer writes will be run on different mobile devices simultaneously, then must A variety of development languages must be grasped, but this certainly will will have a strong impact on software development progress and project on-line time, and have become The a great problem of development teams.
In the prior art, each Mobile operating system native applications are packaged into Web applications, by browser access, so Web there is cross-platform advantage, but these applications based on browser can not calling system API realize some advanced work( Can, it is also not suitable for the occasions of high performance requirements, viewing experience can not also overload native applications in a short time, not support off-line mode, Message push is not prompt enough, calls the ability of local file system weak.
Found by the retrieval to prior art, one kind disclosed in Chinese patent application CN201110029661.3 should With the method and apparatus of program development, this method can realize the cross-platform calling native interfaces of web, however, this kind of device transmission Data mode is single, underaction causes data to be easily lost, and Information Security is low.
Due to the above problems, the present inventor carries out research and analysis to existing mobile technology, to make Go out a kind of apparatus and method that therefrom access native interface can be broken through for browser, and the device transmits the peace of data Quan Xinggao, the mode for transmitting data are flexible.
The content of the invention
In order to solve the above problems, present inventor has performed studying with keen determination, as a result find:By local ridge method complete from Javascript ends are to the mutual transmission of the data between native interface, and the local ridge method is by positive module and reversely Module realizes that local ridge method makes up the defects of primary exploitation develops two kinds of application and development patterns with pure Web, passes through synchronous execution The mode of local service or asynchronous execution local service arrives the JSON data information transfers that mobile terminal native interface returns JavaScript ends so that the device data transfer mode is various, flexibly, data it is safe.So as to complete the present invention.
It is an object of the invention to provide following aspect:
The device that across the Mobile operating system platform native interface of first aspect, a kind of page script language is called, its feature It is, the device includes:
Yaw guy, the data exchange carrier page script program to be spread out of are delivered to the primary of mobile terminal and connect Mouthful;With
Reverse system, it is primary by mobile terminal by way of synchronously performing local service or asynchronous execution local service The data exchange carrier of interface passback is delivered to page script program;
Wherein, the yaw guy includes:
Unified call interface module 001, it is used for the data exchange carrier for receiving page script program transmission, data is handed over Change carrier and be delivered to calling reminding module 002, be additionally operable to the data exchange carrier transmission for returning following calling reminding modules 002 To page script program;
Reminding module 002 is called, it receives the data exchange carrier that unified call interface module 001 is transmitted, and data are handed over Change carrier and be delivered to kernel encapsulation generic module 003, also to receive data exchange carrier that following callback modules 005 return or under The data exchange carrier that readjustment server module 006 returns is stated, and the data exchange carrier of passback is delivered to unified call and connect Mouth mold block 001,
Kernel encapsulates generic module 003, and it receives the data exchange carrier for calling reminding module 002 to transmit, to data exchange Carrier is parsed, and the parameter information included in data exchange carrier is separated from data exchange carrier, and by parameter Information transmission to plug-in management module 004,
Plug-in management module 004, it receives the parameter information that kernel encapsulation generic module 003 transmits, according to the data of reception Exchange carrier calls the native interface of mobile terminal;
Wherein, reverse module includes:
Callback module 005, its data exchange carrier by native interface passback in a manner of synchronously performing local service pass It is delivered to and calls reminding module 002;
Server module 006 is adjusted back, one or both of it is in a manner of polling mode and XHR mode returns native interface The data exchange carrier of biography, which is delivered to, to be called in reminding module 002 and callback module 005.
Second aspect, across the Mobile operating system platform native interface of the page script language according to above-mentioned first aspect The device of calling, it is characterised in that
The native interface of mobile terminal includes gravitometer interface, address list interface and the utilizing camera interface of mobile device.
The third aspect, across the Mobile operating system platform native interface of the page script language according to above-mentioned first aspect The device of calling, it is characterised in that
After the polling mode is calls reminding module 002 to call readjustment server module 006, server module is adjusted back 006 transmits the data exchange carrier of passback to calling reminding module 002.
Fourth aspect, across the Mobile operating system platform native interface of the page script language according to above-mentioned first aspect The device of calling, it is characterised in that
The XHR modes comprise the following steps:
(1) server is set inside readjustment server module 006, the tune of the reminding module 002 to be called such as the server With;
(2) server is after the calling for calling reminding module 002 is received, if without waiting for the number of passback in server According to exchange carrier, then server can be kept for the several seconds, server timeout after the several seconds, and HTTP/1.1404 is delivered into calling prompting mould Block (002);
If there is the data exchange carrier for waiting and returning in server, by the data exchange vector encoded of passback into UTF- It is delivered to after 8 and calls reminding module 002.
The method that 5th aspect, a kind of across the Mobile operating system platform native interface of page script language are called, its feature It is, the device includes:
Positive transmission step, the data exchange carrier page script program to be spread out of are delivered to the primary of mobile terminal Interface;With
Back transfer step, it is by way of synchronously performing local service or asynchronous execution local service by mobile terminal The data exchange carrier of native interface passback is delivered to page script program;
Wherein, the positive transmission step includes:
Step (1), unified call interface module 001 are used for the data exchange carrier for receiving page script program transmission, will Data exchange carrier, which is delivered to, calls reminding module 002, is additionally operable to carry the data exchange that following calling reminding modules 002 return Body is delivered to page script program;
Step (2), reminding module 002 is called to receive the data exchange carrier that unified call interface module 001 is transmitted, by number Kernel encapsulation generic module 003 is delivered to according to exchange carrier, also receiving the data exchange carrier that following callback modules 005 return Or the data exchange carrier that following readjustment server modules 006 return, and the data exchange carrier of passback is delivered to unified tune With interface module 001,
Step (3), kernel encapsulation generic module 003 receive the data exchange carrier for calling reminding module 002 to transmit, to data Exchange carrier is parsed, and the parameter information included in data exchange carrier is separated from data exchange carrier, and will 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, according to reception Data exchange carrier calls the native interface of mobile terminal;
Wherein, back transfer step includes:
The data exchange of step (1), callback module 005 by native interface passback in a manner of synchronously performing local service carries Body, which is delivered to, calls reminding module 002;
Step (2), mode will be primary one or both of in a manner of polling mode and XHR for readjustment server module 006 The data exchange carrier of interface passback, which is delivered to, to be called in reminding module 002 and callback module 005.
6th aspect, across the Mobile operating system platform native interface of page script language according to the above-mentioned 5th aspect The method of calling, it is characterised in that
The native interface of mobile terminal includes gravitometer interface, address list interface and the utilizing camera interface of mobile device.
7th aspect, across the Mobile operating system platform native interface of page script language according to the above-mentioned 5th aspect The method of calling, it is characterised in that
After the polling mode is calls reminding module 002 to call readjustment server module 006, server module is adjusted back 006 transmits the data exchange carrier of passback to calling reminding module 002.
Eighth aspect, across the Mobile operating system platform native interface of page script language according to the above-mentioned 5th aspect The method of calling, it is characterised in that
The XHR modes comprise the following steps:
(1) server is set inside readjustment server module 006, the tune of the reminding module 002 to be called such as the server With;
(2) server is after the calling for calling reminding module 002 is received, if without waiting for the number of passback in server According to exchange carrier, then server can be kept for the several seconds, server timeout after the several seconds, and HTTP/1.1404 is delivered into calling prompting mould Block (002);
If there is the data exchange carrier for waiting and returning in server, by the data exchange vector encoded of passback into UTF- It is delivered to after 8 and calls reminding module 002.
The device that is called according to a kind of across the Mobile operating system platform native interfaces of JavaScript provided by the invention and Method, it has the advantages that:
Firstth, the device makes up the defects of primary exploitation and pure Web two kinds of application and development patterns of exploitation and given birth to.
Secondth, identical code, which only needs to be compiled for different platform, can be achieved with multi-platform distribution, significantly Improve the efficiency of multi-platform exploitation.And applied compared to pure Web, developer can also across Mobile operating system platform calling original Raw interface, realizes more preferable Consumer's Experience and function.
3rd, the device returns JSON data messages by two ways so that the device data transfer mode is flexible, together When also improve the security of data transfer so that the data of passback are not susceptible to lose.
Brief description of the drawings
Fig. 1 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention The structural representation for the device that native interface is called;
Fig. 2 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention Positive modular structure schematic diagram in the device that native interface is called;
Fig. 3 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention Reverse modular structure schematic diagram in the device that native interface is called;
Fig. 4 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention Reverse modular structure schematic diagram in the device that native interface is called;
Fig. 5 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention Reverse modular structure schematic diagram in the device that native interface is called;
Fig. 6 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention The flow chart of unified call interface module in the device that native interface is called;
Fig. 7 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention The flow chart of reminding module is called in the device that native interface is called;
Fig. 8 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention The flow chart of plug-in management module in the device that native interface is called;
Fig. 9 is shown according to a kind of a kind of across Mobile operating system platform of page script language of preferred embodiment of the present invention The flow chart of kernel encapsulation generic module in the device that native interface is called;
Figure 10 shows to be put down across Mobile operating system according to a kind of a kind of page script language of preferred embodiment of the present invention The flow chart of callback module in the device that platform native interface is called;
Figure 11 shows to be put down across Mobile operating system according to a kind of a kind of page script language of preferred embodiment of the present invention The flow chart of server module is adjusted back in the device that platform native interface is called.
Drawing reference numeral explanation:
001- unified call interface modules
002- calls reminding module
003- kernels encapsulate generic module
004- plug-in management modules
005- callback modules
006- adjusts back server module
Embodiment
Below by the present invention is described in detail, the features and advantages of the invention will become more with these explanations To be clear, clear and definite.
Special word " exemplary " is meant " being used as example, embodiment or illustrative " herein.Here as " exemplary " Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.Although each of embodiment is shown in the drawings In terms of kind, but unless otherwise indicated, it is not necessary to accompanying drawing drawn to scale.
In a preferred embodiment according to the present invention, as shown in Fig. 1-11, the present invention passes through local bridge joint Method causes across the Mobile operating system platform of page script language (page script language is JavaScript) to call native interface, institute State what local ridge method was realized by positive module and reverse module, local ridge method makes up primary exploitation and pure Web exploitations two The defects of kind application and development pattern, identical code, which only needs to be compiled for different platform, can be achieved with multi-platform point Hair, substantially increase the efficiency of multi-platform exploitation.And applied compared to pure Web, developer can also put down across Mobile operating system Platform calls native interface, realizes more preferable Consumer's Experience and function.With the technology of the present invention, can effectively realize simple quick Exploitation Mobile solution.
In one preferred embodiment, page script program of the present invention is javascript ends, described Data exchange carrier is JSON data messages.
In one preferred embodiment, as in Fig. 1-5, the positive module includes:Unified call interface module 001, reminding module 002, kernel encapsulation generic module 003 and plug-in management module 004 are called,
Wherein, unified call interface module 001 receives the JSON data messages at javascript ends and by the information transmission To calling reminding module 002, and the JSON data information transfers that reminding module 002 returns will be called to javascript ends, system One calling interface module 001 is the unified call module towards browser, and all bridge joint requests all pass through this standardization Module is called, and the complicated call operation realized details, simplify user, improves the device inside the module shield mobile terminal The efficiency of data transfer so that the device can adapt to various mobile platforms.
Wherein, unified call interface module 001 can realize that execute functions are as follows by execute functions: Execute (success, failure, service, actionID, arguments), wherein success are that operation runs succeeded Call back function afterwards, failure are that operation performs the call back function after failure, and service, which is that the local to be called is primary, to be connect Mouth method name, actionID are the concrete operations for the service that to be performed, and arguments is the required design parameter of operation.
In one preferred embodiment, as shown in figs. 1-2, the calling reminding module 002 can pass through The realization of message functions, wherein, message functions are as follows:
Var r=message (JSON.stringify (arguments), JSON.stringify ([service, actionID,callbackID,true]));Wherein parameter true is that the native interface of instruction mobile terminal is with synchronous execution The mode of local service or asynchronous execution local service returns JSON data messages, if if asynchronous, then message () function returns to null character string;If can only synchronously, then message () function returns to JSON formatted datas information (such as Shown in Fig. 2).
In one preferred embodiment, as shown in figs. 1-2, kernel encapsulation generic module (003) module is one Self defined class file, cover onJsAlert () under mobile browser kernel file WebChromeClient, OnJsConfirm (), onJsPrompt () method, the resume module call reminding module 002 request, the module utilize and The transformation mobile browser primary module that carries meets bridging requirement, is easy to the maintenance in later stage, wherein, onJsAlert (), OnJsConfirm (), onJsPrompt () method signature difference are as follows:
public boolean onJsAlert(WebView view,String url,String message,final JsResult result);
public boolean onJsConfirm(WebView view,String url,String message, final JsResult result)
public boolean onJsPrompt(WebView view,String url,String message, String defaultValue,final JsPromptResult result);
The JSON data messages passed over before can be parsed according to defaultValue, the module is adjusted after parsing With plug-in management module 004.
In the present invention, the parsing is to be separated the parameter information in JSON data messages, the parameter information Including:Success is the call back function after operation runs succeeded, and failure is that operation performs the call back function after failure, Service is the native interface method name for the mobile terminal to be called, and actionID is the specific behaviour for the service that to be performed Make, arguments is the required design parameter of operation.
In one preferred embodiment, as shown in fig. 1, plug-in management module 004 calls local native interface, should Mode of the module based on plug-in management, finally realize that JavaScript layers call the primary service interface of mobile terminal.Wherein, insert Part management module 004 can realize that PluginManager includes following methods by PluginManager classes:
PluginManager.execute (service, actionID, callbackID, message, async),
The module call mobile terminal native interface, such as gravitometer, address list and shooting it is first-class,
Plug-in management module 004 is called to the bottom of mobile device and is all based on plug-in type management, and reason is that movement is set The uncertainty of standby hardware information, before such as calling can detection device whether with camera, whether with gravity sensor, be somebody's turn to do Module realizes loose formula and the freestanding management of intermodule.
In one preferred embodiment, the native interface of mobile terminal passes through synchronization to JavaScript communication Perform the mode of local service or asynchronous execution local service and native interface returned into JSON data transfers to Javascript ends, Pass through two ways return data so that device flexibility increase;Cause that data are not easy to be lost simultaneously, and then ensure that data Security and integrality.
In a preferred embodiment, callback module is in a manner of synchronously performing local service by the JSON data of passback It is delivered to and calls reminding module 002, readjustment server module 006 is returned native interface in a manner of asynchronous execution local service JSON data information transfers to calling in reminding module 002 and callback module 005,
Wherein, adjust back server module 006 server of queue that can preserve JSON data messages is provided and ring The request of the http protocol of reminding module (002) should be called, finally ensures next JavaScript language of successful asynchronous execution Sentence.
In one preferred embodiment, when the callback module of the device will be returned in a manner of synchronously performing local service For the JSON data transfers of biography to when calling reminding module 002, callback module can pass through JsResult or JsPromptResult Class realizes that message () method passes JSON data messages back message () function in class, and passes through message () function Transfer back to JavaScript ends.JavaScript ends can parse return value, and readjustment success incoming before is gone according to analysis result Or the call back function of failure, so as to perform using logic (whole invoked procedure is summarized as shown in Figure 3).
In one preferred embodiment, as shown in figs. 4-5, the asynchronous execution result of local service needs to pass through back Server module (006) is adjusted to realize,
Readjustment server module (006) can realize that this interface can preserve one by CallbackContext interfaces It is sent to the JavaScript sentence queues at JavaScript ends, these sentences contain the success or failure that defines before The asynchronous execution result of call back function information and local service.Since CallbackContext is a server, naturally will not Active response is, it is necessary to which JavaScript ends one sentence of transmission is obtained by CallbackContext.getQueue () method Take, there is poll and XHR two ways to realize on traffic model.Pass through two ways return data so that the device passes Delivery data mode is flexible, adds the security and integrality of data.
In one preferred embodiment, called in polling mode by means of message () method CallbackContext.getQueue () obtains the next JavaScript to be performed sentence and is transmitted to return value JavaScript ends.
In one preferred embodiment, in XHR modes, a simple clothes are realized on CallbackContext It is engaged in device, waits asynchronous XHR to call, this connection can be always maintained at after connection is received until 10 seconds time-out for server or have will The JavaScript sentences of transmission.Overtime then response HTTP/1.1404 is to client;If the JavaScript languages to be sent Sentence, then be encoded into UTF-8 and can cross http response returning 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]));
Kernel encapsulates generic module 003, onJsAlert, onJsConfirm or onJsPrompt in ChromeClient Method.
Plug-in management module 004,
PluginManager.execute(service,actionID,callbackID,message,async);
Callback module 005, the message () under JsResult or JsPromptResult classes.
Adjust back server module 006, CallbackContext classes;
Wherein, Javascript ends are to the process of native interface transfer data information:Execute function calls Message functions, message function calls onJsAlert, onJsConfirm or onJsPrompt methods, message methods PluginManager.execute methods are called, PluginManager.execute calls native interface;
The process of native interface to Javascript ends transfer data information is:
(1) the synchronous mode for performing local service:Native interface passes through under JsResult or JsPromptResult classes Message methods to message function return data information,
(2) mode of asynchronous execution local service:Message functions are called by way of poll and XHR CallbackContext.getQueue (), the next JavaScript sentence to be performed is obtained by getQueue ().
(2-1) polling mode:Message function call CallbackContext.getQueue () want to obtain next Return value is simultaneously transmitted to JavaScript ends by the JavaScript sentences of execution.
(2-2) XHR modes:The server of one is realized on CallbackContext, waits asynchronous XHR to call, clothes Business device can be always maintained at this connection until 10 seconds time-out after connection is received or have the JavaScript sentences to be sent.It is super When then respond HTTP/1.1404 to client;If the JavaScript sentences to be sent, then UTF-8 energy is encoded into Cross http response and return to mobile terminal.
In one preferred embodiment, reminding module 002 is called to realize polling request or XHR requests:
Polling request:Realization principle is still based on message functions, and message functions directly pass through after taking result Eval functions come call JavaScript ends set call back function (whole polling procedure such as Fig. 4 institutes of transmitting terminal and receiving terminal Show).
XHR modes.JavaScript ends can construct XMLHttpRequest objects and initiate asynchronous AJAX GET requests, After request meets with a response, returned text msg is encoded by decodeURIComponent () method UTF-8, then recalled Eval (msg) is performed.In order to prevent other applications from accessing this readjustment server by XHR modes to disturb normally Returning result is asked, JavaScript returns at end request and adds security token, and token is present in request with character string forms In URL, only holding the request of the token can just be handled, otherwise return HTTP/1.1403 (transmitting terminal and receiving terminal it is whole Individual XHR processes are as shown in Figure 5).
The device that is called according to a kind of across the Mobile operating system platform native interfaces of JavaScript provided by the invention and Method, it has the advantages that:
Firstth, the device makes up the defects of primary exploitation and pure Web two kinds of application and development patterns of exploitation and given birth to.
Secondth, identical code, which only needs to be compiled for different platform, can be achieved with multi-platform distribution, significantly Improve the efficiency of multi-platform exploitation.And applied compared to pure Web, developer can also across Mobile operating system platform calling original Raw interface, realizes more preferable Consumer's Experience and function.With the technology of the present invention, it can effectively realize that simple quickly exploitation moves Dynamic application.
The present invention is described in detail for engagement embodiment and exemplary example above, but these explanations are simultaneously It is not considered as limiting the invention.It will be appreciated by those skilled in the art that without departing from the spirit and scope of the invention, A variety of equivalencing, modification or improvement can be carried out to technical solution of the present invention and embodiments thereof, these each fall within the present invention In the range of.Protection scope of the present invention is determined by the appended claims.

Claims (7)

  1. A kind of 1. device that across Mobile operating system platform native interface of page script language is called, it is characterised in that the device Including:
    Yaw guy, the data exchange carrier page script program to be spread out of are delivered to the native interface of mobile terminal;With
    Reverse system, it is by way of synchronously performing local service or asynchronous execution local service by mobile terminal native interface The data exchange carrier of passback is delivered to page script program;
    Described page script program is javascript ends, and described data exchange carrier is JSON data messages;
    Wherein, the yaw guy includes:
    Unified call interface module (001), it is used for the data exchange carrier for receiving page script program transmission, by data exchange Carrier, which is delivered to, calls reminding module (002), is additionally operable to pass in the data exchange carrier of following calling reminding module (002) passbacks It is delivered to page script program;
    Unified call interface module (001) realizes that execute functions are as follows by execute functions: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 after failure, and service is the local native interface method name to be called, ActionID is the concrete operations for the service that to be performed, and arguments is the required design parameter of operation;
    Reminding module (002) is called, it receives the data exchange carrier that unified call interface module (001) is transmitted, and data are handed over Change carrier be delivered to kernel encapsulation generic module (003), also to receive following callback modules (005) passback data exchange carrier Or the data exchange carrier of following readjustment server module (006) passbacks, and the data exchange carrier of passback is delivered to unification Calling interface module (001),
    It is described to call reminding module (002) to be realized by message functions, wherein, message functions are as follows:Var r= message(JSON.stringify(arguments),JSON.stringify([service,actionID, callbackID,true]));Wherein parameter true be indicate mobile terminal native interface be with it is synchronous perform local service or The mode return data exchange carrier of asynchronous execution local service, if if asynchronous, then message () function returns Null character string;If can only synchronously, then message () function returned data exchange carrier;
    Kernel encapsulation generic module (003), it receives the data exchange carrier for calling reminding module (002) to transmit, to data exchange Carrier is parsed, and the parameter information included in data exchange carrier is separated from data exchange carrier, and by parameter Information transmission to plug-in management module (004),
    Kernel encapsulation generic module (003) is a self defined class file, covers mobile browser kernel file OnJsAlert (), onJsConfirm (), onJsPrompt () method under WebChromeClient;
    Plug-in management module (004), it receives the parameter information that kernel encapsulation generic module (003) transmits, according to the data of reception Exchange carrier calls the native interface of mobile terminal,
    Plug-in management module (004) realizes that PluginManager includes following methods by PluginManager classes: PluginManager.execute(service,actionID,callbackID,message,async);
    Wherein, reverse module includes:
    Callback module (005), its data exchange carrier transmission for being returned native interface in a manner of synchronously performing local service To calling reminding module (002);
    Server module (006) is adjusted back, one or both of it is in a manner of polling mode and XHR mode returns native interface Data exchange carrier be delivered to call reminding module (002) and callback module (005) in,
    The XHR modes comprise the following steps:
    (1) tune of the reminding module to be called such as server, the server (002) is set inside readjustment server module (006) With;
    (2) server is after the calling for calling reminding module (002) is received, if without waiting for the data of passback in server Exchange carrier, then server can be kept for the several seconds, server timeout after the several seconds, HTTP/1.1 404 is delivered to calling reminding module (002);
    If there is the data exchange carrier for waiting and returning in server, by the data exchange vector encoded of passback into after UTF-8 It is delivered to and calls reminding module (002).
  2. 2. the device that across the Mobile operating system platform native interface of page script language according to claim 1 is called, its It is characterised by,
    The native interface of mobile terminal includes gravitometer interface, address list interface and the utilizing camera interface of mobile device.
  3. 3. the device that across the Mobile operating system platform native interface of page script language according to claim 1 is called, its It is characterised by,
    After the polling mode is calls reminding module (002) to call readjustment server module (006), server module is adjusted back (006) to the data exchange carrier for calling reminding module (002) to transmit passback.
  4. 4. a kind of across Mobile operating system platform native interface of page script language using described in one of claims 1 to 33 is adjusted Device carries out the method that across the Mobile operating system platform native interface of page script language is called, it is characterised in that the party Method includes:
    Positive transmission step, the data exchange carrier page script program to be spread out of are delivered to the primary of mobile terminal and connect Mouthful;With
    Back transfer step, it is primary by mobile terminal by way of synchronously performing local service or asynchronous execution local service The data exchange carrier of interface passback is delivered to page script program;
    Wherein, the positive transmission step includes:
    Step (1), unified call interface module (001) are used for the data exchange carrier for receiving page script program transmission, by number It is delivered to according to exchange carrier and calls reminding module (002), is additionally operable to the data exchange of following calling reminding module (002) passbacks Carrier is delivered to page script program;
    Step (2), reminding module (002) is called to receive the data exchange carrier that unified call interface module (001) is transmitted, by number According to exchange carrier be delivered to kernel encapsulation generic module (003), also to receive following callback modules (005) passback data exchange Carrier or the data exchange carrier of following readjustment server module (006) passbacks, and the data exchange carrier of passback is delivered to Unified call interface module (001),
    Step (3), kernel encapsulation generic module (003) receive the data exchange carrier for calling reminding module (002) to transmit, to data Exchange carrier is parsed, and the parameter information included in data exchange carrier is separated from data exchange carrier, and will 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, according to reception Data exchange carrier calls the native interface of mobile terminal;
    Wherein, back transfer step includes:
    The data exchange carrier that step (1), callback module (005) are returned native interface in a manner of synchronously performing local service It is delivered to and calls reminding module (002);
    Step (2), readjustment server module (006) mode one or both of in a manner of polling mode and XHR connect primary The data exchange carrier of mouth passback, which is delivered to, to be called in reminding module (002) and callback module (005).
  5. 5. the method that across the Mobile operating system platform native interface of page script language according to claim 4 is called, its It is characterised by,
    The native interface of mobile terminal includes gravitometer interface, address list interface and the utilizing camera interface of mobile device.
  6. 6. the method that across the Mobile operating system platform native interface of page script language according to claim 4 is called, its It is characterised by,
    After the polling mode is calls reminding module (002) to call readjustment server module (006), server module is adjusted back (006) to the data exchange carrier for calling reminding module (002) to transmit passback.
  7. 7. the method that across the Mobile operating system platform native interface of page script language according to claim 4 is called, its It is characterised by,
    The XHR modes comprise the following steps:
    (1) tune of the reminding module to be called such as server, the server (002) is set inside readjustment server module (006) With;
    (2) server is after the calling for calling reminding module (002) is received, if without waiting for the data of passback in server Exchange carrier, then server can be kept for the several seconds, server timeout after the several seconds, HTTP/1.1 404 is delivered to calling reminding module (002);
    If there is the data exchange carrier for waiting and returning in server, by the data exchange vector encoded of passback into after UTF-8 It is delivered to and calls reminding module (002).
CN201410834506.2A 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 Active CN104461575B (en)

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 CN104461575A (en) 2015-03-25
CN104461575B true CN104461575B (en) 2017-11-10

Family

ID=52907686

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410834506.2A Active 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)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
CN106095886B (en) * 2016-06-03 2020-10-09 腾讯科技(深圳)有限公司 Data processing method and device
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
CN108874554B (en) * 2017-05-09 2020-11-10 腾讯科技(深圳)有限公司 Information communication method and device
CN108804243B (en) * 2018-05-23 2022-11-25 北京五八信息技术有限公司 Interaction method, interaction device, computer equipment and computer-readable storage medium
CN109634751B (en) * 2018-10-19 2022-11-29 深圳市网旭科技有限公司 Method for realizing communication between application layer and bottom layer by utilizing electron framework
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
CN110134386B (en) * 2019-04-04 2023-04-18 成都娄外科技有限公司 Program editing method and device
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
CN110908646B (en) * 2019-11-29 2021-02-26 苏州精易会信息技术有限公司 Building block type callback function block construction method and device, storage medium and processor
CN112035097B (en) * 2020-08-25 2023-10-13 华东计算技术研究所(中国电子科技集团公司第三十二研究所) C++ adaptation layer device based on Galaxy Ruihua operating system
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
CN115185712B (en) * 2022-09-08 2022-12-27 中化现代农业有限公司 Data interaction method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN104461575A (en) 2015-03-25

Similar Documents

Publication Publication Date Title
CN104461575B (en) The device and method that a kind of across Mobile operating system platform native interface of page script language is called
CN102377814B (en) Remote assistance service method aiming at embedded operation system
EP3731161A1 (en) Model application method and system, and model management method and server
CN107179697A (en) A kind of intelligent home equipment control method, apparatus and system
CN102006616B (en) Test system and test method
US10635436B2 (en) Compatibility method based on hybrid, adapter, operation device, system and computer-readable storage medium
EP2418825A1 (en) Method and system for generating open telecommunication service based on internet
CN101980152A (en) Mobile middleware system and implementation method thereof
WO2019184658A1 (en) Profile switching method and apparatus, and mobile terminal
CN109547162B (en) Data communication method based on two sets of one-way boundaries
CN101968745A (en) Development system and development method for application programs of mobile terminal
US20190114183A1 (en) Terminal Configuration Method and Terminal Based on Provision Protocol for Transmission
CN111782306A (en) Interface calling information processing method and device, electronic equipment and storage medium
CN111857658A (en) Method, device, medium and electronic equipment for rendering dynamic component
CN113207194B (en) Multi-mode communication implementation method and device based on kylin mobile operating system
EP1213875A3 (en) Network node emulator and method of node emulation
CN102315981B (en) Equipment and method for testing evolved packet core network equipment
CN110290139B (en) Message transmission method and device
CN107077378B (en) Communication method, device, electronic equipment and program product
CN105224214B (en) A kind of method for controlling dialing and smartwatch
CN104796458A (en) Information fusion method for Android system
CN102377243A (en) Collocation method of 101 protocol parameter, collocation device thereof and collocation system thereof
US20200286012A1 (en) Model application method, management method, system and server
EP2683148A1 (en) Agent system, agent system client terminal and processing method
CN105554571A (en) Firefox-OS-based TV system realization method and apparatus

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