An Explanation of Cordova Plugins for Ionic 2
One of the downsides of creating a web based mobile application is that you don't have access to all of the device functionality that a native application does, and you can't submit your application to app stores.
Cordova solves this problem. Cordova is commonly used to wrap a web-based mobile application inside of a native wrapper, which allows the application to access native device functionality, and it also allows the application to be submitted to native app stores.
However, there is often confusion between what Cordova is, what a plugin is, and how you can use them in an Ionic 2 application. In this video tutorial, I walk through these basic concepts right from the beginning in order to give you the "full picture" of how it all works.
Here's the video:
- Ionic applications can be packaged with Cordova. Cordova creates a native wrapper for your browser based Ionic application to live in, which allows it to be submitted to native app stores.
- A Cordova plugin creates an interface for your browser based code to access native device functionality
- A Cordova plugin can be used the same way in any Cordova application, regardless of the framework (e.g. Ionic) that is used
- The Ionic Native service is not required to use Cordova plugins, but it does make Cordova plugins easier to use in Ionic applications.
- You must make sure to install any Cordova plugins that you want to use through the command line, using:
ionic plugin add the-plugin-name