Join Chris Griffith for an in-depth discussion in this video Adding a plugin, part of Building Mobile Apps with the PhoneGap Command-Line Interface.
- Starting with PhoneGap 3. The framework was split into the core framework and many of the additional features moved into external plugins. For example, if your application needs to access the device's contact list, your PhoneGap application will need to use contacts plugin in order to to this. Similarly, if you want to access the camera, you will need to install the camera plugin. Here's a list of the core plugin that are available for both the Android and iOS. For additional platforms, please consult PhoneGap.com and the platform specific installation guides to see the current state of which plugins are available for each specific platform.
Since PhoneGap is an open platform, many other developers have create custom plugins that can be used in your project. These include Facebook Connect, In-App purchases, iBeacon support, and more. To add a plugin use "phonegap plugin add" then the path to the plugin. For the core plugins, this will be the plugin ID. Such as, "org.apache.cordova.device" So, "phonegap plugin add org.apache.cordove.device" Now, this will add the plugin to our application.
If it is a third party plugin, you can use it's full URL. Probably, a GitHub address. If you are using the Cordova-cli you only need to replace PhoneGap with the word Cordova. There are no other changes. With PhoneGap Build, you're only allowed a vetted set of third party plugins. You can find the current list here at build.phonegap.com/plugins. In addition, you are free to develop your own and include them in your project. If you would like to learn more about this, there's a development guide available here.
If you ever need to see what plugins are currently installed in your project, simply use the "phonegap plugin list" to view a listing of your plugins. And we only have the device plugin installed for this sample app.
- Installing the PhoneGap and Cordova CLIs
- Creating a new project
- Building an app
- Testing apps
- Adding and removing plugins
- Using hooks
- Compiling apps remotely