The Cocoon Native Share plugin is a Cordova plugin for easy sharing with he platform supported sharing methods. It opens a native window to share some text content with an image in any system supported social sharing options. Ie: Twitter, Facebook, SMS, Mail, …


Native share window


To add the Native Share plugin to your project first go to your project configuration and once there go to the Setting  section and click on the “Plugins” tab. You should see something like this:

New Cocoon

If you click on the “Cocoon” category you will see al the Cocoon available plugins.  Over the plugins list you will see a dropdown menu set to “All” by default. Click on the menu to see the available Cocoon plugins categories, you should see a list of plugins with at least the following groups:

Screen Shot 2016-01-05 at 16.40.33

Select the “Share” plugin. Then the Share  plugin should be filtered in the plugins list.

Screen Shot 2016-01-07 at 13.03.04


Now click on install and your project will include the Native Share SDK plugin in the next compilation.

Screen Shot 2016-01-07 at 13.04.20


Now you are ready to compile the Developer App to start testing your Native share support.


This plugins doesn’t need any parameter.


Cordova needs to be specifically loaded in your index.html so it can start the Cordova framework and load the plugins that you have installed in your project. So first thing is to add the “cordova.js” script tag to your index.html.

That’s the only code script you need to include in your index.html for the plugin to be ready to be used. Cordova will do the rest.

Important: Remember to wait for the “deviceready” event before using the plugin as that is the moment when the plugin will be fully initialized.


Let’s see some code snippets showing how to use the Cocoon Native Share plugin in your application.

Sharing content

The only functionality of this plugin is to share a text with an image. You can do it using the share method:

In Android you can expect error to be set in case of error bunt complete will always return “true” regardless of if the user shared the content or just canceled the sharing. In Android the “activity” parameter is never set because of platform limitations.

In iOS the activity type will always be an empty string because of platform limitations.






To test your Native Share plugin integration:

  1. Install the Native Share plugin in your project
  2. Compile a Developer App
  3. Launch you app from the Developer App using a zip or a url options