adding social share links to phonegap app

user3262344 picture user3262344 · Nov 6, 2014 · Viewed 11.4k times · Source

i have an app that is using jquery mobile and it outputs and image.

now i have displayed the image in a preview page and i have added links below to share them on facebook and twitter and other platforms

how do i go about coding it...

when the user click on the share button the default share pannel should pop up like this

https://cdn.tutsplus.com/mobile/uploads/legacy/Android-SDK_Share-Activity/android_share_chooser.png

when the user select for example twitter the twitter app opens and the image should be attached.

How can this be achived..should i be looking in the apis of the social site or android api or phonegap api

Answer

Ved picture Ved · Nov 6, 2014

PhoneGap Social Sharing plugin for Android, iOS and Window

Install with the CLI

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

Add in your page

<button onclick="window.plugins.socialsharing.share('Message, image and link', null, 'https://www.google.nl/images/srpr/logo4w.png', 'http://www.x-services.nl')">message, image and link</button>
<button onclick="window.plugins.socialsharing.share('Message, subject, image and link', 'The subject', 'https://www.google.nl/images/srpr/logo4w.png', 'http://www.x-services.nl')">message, subject, image and link</button>

More...