Apache 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.
Corodova: 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.
Cordova: Types of Plugins
There are many types of plugin, some are:
- Camera Plugin (To open camera)
- Geoloation Plugin (It captures your location cordinates → latitude, longitude)
- File Transfer Plugin (It transfers the file from your storage to somewhere else → say to the server)
- Contact List Plugin
- Push Notification Plugin