Cordova Plugin

Plugina allow applications developed with Cordova to access the device's functionality. Plugins are written in JavaScript and native libraries. All the cordova main features are implemented as plugins. If we don't use plugin then we can't use any of the native features.


Why we use plugin?

Let us suppose you want to access Gallery or Contacts of the device, in such a situation we need plugins, which will communicate with device and request device to grant the required permission.

NOTE: You can also create your own plugin.

For example:

Suppose you want to pick a contact from the contact list, then how will you do this through your app, so here we need plugin which communicate with native feature of device and request to grant permission.

Like, if you want a mango from tree, but tree is not yours, then what you do, you first ask the owner of the tree, if he grants permission then only you can pick the mango, but if he dowsn't allow you, then you can't go ahead and pick the mango. In the same way plugin ask for permission and also provides a way to act on the permissions.


Types of Plugins

There are many types of plugin, some are:

  1. Camera Plugin (To open camera)
  2. Geoloation Plugin (It captures your location cordinates → latitude, longitude)
  3. File Transfer Plugin (It transfers the file from your storage to somewhere else → say to the server)
  4. Contact List Plugin
  5. Push Notification Plugin