Custom Cordova plugin

Cordova plugin ?

Cordova provides a bridge between JavaScript and native code, enabling you to write native code that gets exposed to your app via a common JavaScript interface.

Each method exposed by a plugin’s JavaScript interface is mapped to a method in the plugin’s native code via the Cordova bridge, which also enables you to pass parameters back and forth between the JavaScript and native methods.


A Cordova plugin typically consists of:
  •     Native code for each supported platform
  •     A common JavaScript interface
  •     A manifest file called plugin.xml

The conventional structure for a Cordova plugin supporting both Android and iOS is:

- Plugin top-level folder
     - plugin.xml
     - src/
        - android/
           - <Java source code>
        - ios/
           - <Objective-C source code>
     - www/
        - <JavaScript interface>
     - Plugin.xml

 A plugin may also include additional native resources and these are identified in the plugin.xml manifest file. This manifest file is read by the plugman command-line tool, which is used by the Cordova command-line interface.

For more detailed information about the plugin.xml manifest file, refer to the Cordova Plugin Specification.
       
How do I create my own custom Cordova plugin?

To create your own custom Cordova plugin, you must write:
  • JavaScript that provides the interface for calling your plugin from within a Cordova-based app.
  • Native code that provides the functionality you need. You should write native code for all native supported platforms.
  • A plugin.xml manifest file that defines your plugin and how plugman should incorporate it into any Cordova-based app.

More details..
http://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html

Comments

Popular posts from this blog

Understanding Top line and Bottom line?

How to activate PF UAN account

Scrum Master vs Product Owner