How to add Social Sharing in Intel XDK apps ?

Why add Social sharing in your app?

Social sharing is important to make your apps viral.As an app developer you should also focus on ways to make your app more popular.Social sharing is one of the way.You can yourself share the apps on various social networking sites.This is first part of self promotion or make the world aware of your new apps. But you can not do it all the time.Too much self sharing might turn off your users.

The other way to have your app shared on social networks is let the users of app share it.For example your app is interesting or user finds it useful.Then the user will be tempted to share the app with his friends or family.User may use word of mouth approach of recommending your app.You can also make it easier by placing a social share button in your app.

That way it is easier to increase your app popularity.Each satisfied user will share the app on social circle and that in turn will create if not more one new user.Initially when I launched the app it did not had social share capability built in.But in recent release of the app I added the feature.After that I saw increase in app download.Based on my experience I would say it is good to add social button in your app.

Adding Social sharing in your app?

Intel XDK supports third-party cordova plugin.We will be using third-party cordova plugin to add social sharing feature in the app.I have tested the plugin on Android as well as Windows phone.It works great on both the devices.The plugin is developed by Eddyverbruggen and is free to use in your apps.

READ  How to create your first mobile app with Intel XDK?

The plugin supports Android (version 2.3.3 and above),iOS (version 6 and above) and Windows phone 8.The process to add this plugin in your Intel XDK is same as that of any other plugin.I have reproduced the steps for your reference below

Step 1

On the Intel XDK start-up screen click on the Projects option on top left hand corner.After that select the project to which you want to add social share plugin.On the right hand side you will see Plugins option under Cordova hybrid mobile app setting.Click on the plugins option.You will get two sub options Included plugins and Third party plugins.

Click on the third-party plugin option.You will see two buttons Import local plugin and Get plugin from web.If you have followed all the steps mentioned then you should see something like below image

Intel XDK third party plugin

Step 2

Now click on the button Get plugin from the web.You must be connected to Internet as well.On the pop up you should enter below values

  • Name – You can enter anything.I preferred socialShare.
  • Plugin ID – You can get the plugin ID from Github plugin.xml file. In this field enter nl.x-services.plugins.socialsharing
  • Repo URL – Enter the Github URL of the plugin. In this field enter

Your pop up windows should look like below image.After making above mentioned changes click on Import button.Now the adding plugin to your app is complete.In next steps we will see how to code for this plugin.

Intel XDK Social share plugin

Step 3

Now you can go to develop tab and paste below piece of code with in <script> and </script> tags.

            // Show the share dialog to user
                        function shareButton() {
                            window.plugins.socialsharing.share("Your App Name","Your App description",null,"App Store URL",function(result){
            }, function(result){

In above code replace the place holders Your App Name and Your App description with right values. The App Store URL should be replaced with URL you want the user to share.Ideally I choose the App store URL of the app.For Android app it should be Google play URL of the app.For Windows app it should be Windows phone store URL of the app.The piece of code remains the same for Android,iOS and Windows phone.You can change the URL to share in each case.

READ  How to add Rate this App in Intel XDK?

Step 4

Now the code above is a function.You can call this function in onclick event.For example if use clicks on a button then this function will be called and social share dialog will be presented to the user.You can use image as well.
Below code displays a button with text share with friends.When user clicks it the share dialog is displayed as per mobile operating system.

From that screen user can share the app.


The code shared above is being used by me in my apps live on Android as well as Windows phone store.The button code is bit different thoug.I am using Topcoat and button code has Topcoat related CSS declarations.Apart from that everything mentioned here is used in my app.You can test the flow of the plugin by installing any one of app listed on this link and make your decision.

I have not tested it on iPhone.Apart from that it is well-tested on other two operating systems.So you can test how it works on iPhone.I have not used any other Cordova social sharing plugin. In case you have tested any and found it better or useful do share.

Feel free to share your queries and opinions using comment form below.

Leave a Reply

Your email address will not be published. Required fields are marked *