Search This Blog

Saturday 30 January 2016

How cordova works?

Cordova invokes Web-View of your mobile OS.
Its like a web browsers.So it cannot actually directly talk to any of the native features.

But Cordova allows you to talk to most of the native features.
Cordova fills the gap by having a standard JS interface implementation.

In your Cordova plugin under www folder, there will be your JS interface file.
which has a method call cordova.exec()
ex:exports.coolMethod = function(arg0, success, error) {
    exec(success, error, "mytest1", "coolMethod", [arg0]);

where success is the call back for successful cordova plugin call,
           error is the call back for failure call,
           "mytest1" is the native class which plugin will call,
           "coolMethod" is my method name in my interface/class
           [arg0] is the argument array to pass to my method.

So from java script you are making a call to native class mentioned in your exec method.
corodova will do that for you.

platform support for cordova can be found here:
http://cordova.apache.org/docs/en/3.5.0/guide/support/index.html#Platform%20Support


How exactly Cordova does that i couldnt found in google.
http://ishanaba.com/blog/tag/how-cordova-works/

References:
https://blogs.oracle.com/mobile/entry/introduction_to_custom_cordova_plugin

No comments:

Post a Comment