How to Share Your Custom PhoneGap Plugin

February 26, 2014By 3 Comments

Plugin (1)If you’ve built your own custom PhoneGap plugin for a mobile application and want to publish it to the official Cordova Plugin Repository so others can benefit from it (and you should!!), you may not find it to be as obvious as you might think initially.

There’s a tool called plugman that is used to do this and actually also underlies the phonegap/cordova CLIs for installing/removing plugins used by your projects. Prior to PhoneGap version 3.0 this was the primary means of adding plugins, so if you’ve been working on apps since then you will be familiar with it.

As you’ll see in the README there are a lot of different options on the tool, but if you’re using the CLI then you really don’t need to worry about using it to install or uninstall plugins for your project unless you want to install a certain plugin to only one platform. See the docs here for more details on installing to a specific platform.

If you’re ready to share your plugin with the world however :), you’ll need to use plugman specifically to publish your plugin to the repository. It’s pretty easy to do. First, after you’ve installed plugman (like any other node module), ensure you have your custom plugin set up in a directory with the structure described here under Plugin Directory Structure. Next, simply run the following command to publish it from that directory into the default repository:

$ plugman publish myPluginDirectoryPath

There’s a lot of documentation provided in the README if you’re curious about other things you can do with plugman. Also, more documentation on how to share your own 3rd party plugin will be added to the cordova plugin repository soon to make this more obvious…

Filed in: CordovaMobile DevelopmentPhoneGap Tags:

About the Author ()

Comments (3)

Trackback URL | Comments RSS Feed

  1. Betty Wright says:

    Hi Holly,

    Great to see a female in tech! I am a new entrepreneur needing to get a mobile app built with phonegap. Can I reach out to you to get some contacts? I have all the screen shots, a patent pending, TM, business plan etc. Ive been working very hard on this venture and really need some help finding a developer that can bring the app to life.

    Please reach out if possible.

    Thank you,

    Betty Wright

  2. Ross Martin says:

    I would like to publish a PhoneGap plugin I made for the Dropbox Sync API on Android. I shared it with Dropbox and they provide a link to it on their 3rd-party Sync SDK page –

    Is it possible to publish an Android PhoneGap plugin that requires adding code to your app’s ‘Main Activity’? The Dropbox Sync API requires this, or I just haven’t found a way around it to make all the code contained in the plugin class.

    Also, this plugin requires a Dropbox ‘APP_KEY’ and ‘APP_SECRET’ for your app. Right now these are set in my plugin class (DropboxPlugin.Java). It would be ideal to put these in the config.xml file as a preference and read the values in the plugin class. Is this possible and can you share a way on how to read values from the config.xml in your plugin?

    Thank you for all the infos :~)

Leave a Reply