cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <agri...@chromium.org>
Subject Re: Phonegap/Cordova's exec function's internals are unclear?
Date Wed, 24 Dec 2014 18:28:47 GMT
+dev@

On Android, the exec() bridge uses addJavascriptInterface() to send
messages from JS<->Java. This boils down to JNI with some string
serialization.
On iOS, it uses stringByEvaluatingJavaScriptFromString, which is AFAIK the
fastest way.

A local server is doable, but you can run into trouble on Android if the
user has a proxy set (
https://code.google.com/p/android/issues/detail?id=37031)

On Wed, Dec 24, 2014 at 11:55 AM, Super SpaceMarines <
superspacemarines@gmail.com> wrote:

>
>
> On Wed, Dec 24, 2014 at 11:50 AM, Super SpaceMarines <
> superspacemarines@gmail.com> wrote:
>
>> We have a web-app for android/ios with c++ code embedded as DLL, and we
>> want the javascript to communicate to the c++'s DLL and there seems to be
>> two main ways of doing it:
>>
>> 1) Write a cordova plugin to interact with java/obj-c and write adapters
>> in java/obj-c to talk to DLL and relay the info back to javascript.
>>
>>  cordova.exec(function(winParam) {},
>>              function(error) {},
>>              "service",
>>              "action",
>>              ["firstArgument", "secondArgument", 42, false]);
>>
>> 2) Spawn a local webserver in c++ and make the javascript AJAX directly
>> to the c++, thus cutting out the middle-man.
>>
>> //c++ local webserver with boost.asio
>>
>> It is quite unclear how in (1) exec.js does the js to native bridge
>> internally, does it use XHR itself or does it use some other faster method.
>> Is using local webserver (2) to communicate with js using sockets
>> relatively slower than using (1) ?
>>
>> Thank you for your help.
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message