Managing Plugins

Learn how to install, add, remove, and search for Awesome Cordova Plugins.

Installing Cordova plugins

Even though we have a basic set of initial plugins already installed, our app would be pretty limited in functionality if we couldn’t add more plugins.

Adding and making a plugin available to our Ionic app requires us to:

  • Install the actual plugin itself
  • Install an Awesome Cordova Plugins package for that plugin
  • Import the Awesome Cordova Plugins package into the project root module and add that to the providers array

Let’s see how this works by illustrating how we would install the Google Analytics plugin to an Ionic project:

ionic cordova plugin add cordova-plugin-google-analytics

Followed by the installation of the Awesome Cordova Plugins package for that plugin:

npm install --save @awesome-cordova-plugins/google-analytics

Finally, we will need to install the Awesome Cordova Plugins core package - on a once per project basis:

npm install @awesome-cordova-plugins/core

Note: Try running these commands in the terminal provided below! The terminal first creates a new Ionic project called myApp, then changes into the root directory of the newly created app. Please wait for the commands to finish executing and answer the prompts as they appear before copying the commands above.

Important: Make sure you answer “Yes” to the following prompt:

About to integrate your app with Cordova.
Are you sure you want to continue?

Get hands-on with 1200+ tech skills courses.