Social sharing with native iOS sheet in Phonegap

Posted By : Avilash Choudhary | 18-Dec-2014

ios app in phonegap

Building iOS app in phonegap with native sharing sheet to share on facebook,twitter etc. you need to paste the below code to your terminal. This will install the social sharing plugin. This plugin will allow you to use native sharing sheet.

 

phonegap plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

 var text = “text to share”;
var imageurl = “url of image”;
 window.plugins.socialsharing.share(text,null,imageurl,null,function(result){
   if(result)
   {
      // result contains true or false
   }
                                       
 });

 

 

 

Native sheet will contain most of the social apps that you have installed on your device. You can share the text with image and url. The share function is common for all social networking apps, it has options to pass the image url or the link of any website that you want to share. All depends on your requirement. The content you share it likes you have created a post on facebook.

But if you are using native sheet for sharing then it is not possible to dectect where user has shared content.


if you want to share on particular social website i.e. facebook
 window.plugins.socialsharing.shareViaFacebook('text', null, “image”, function() {	
              console.log('share ok')
                                                                                                                                            
        }, function(error){
              console.log(error)
                                                                                     
        });

 

Thanks

About Author

Author Image
Avilash Choudhary

Avilash has excellent experience in developing mobile and web applications using jQuery , Javascript and PhoneGap. His hobbies are watching and playing cricket.

Request for Proposal

Name is required

Comment is required

Sending message..