Social sharing with native iOS sheet in Phonegap
Posted By : Avilash Choudhary | 18-Dec-2014
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
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Avilash Choudhary
Avilash has excellent experience in developing mobile and web applications using jQuery , Javascript and PhoneGap. His hobbies are watching and playing cricket.