Cordova Social Sharing Plugin
This Cordova plugin is used to share text, files, images, and links via social networks, sms, and email.
Plugin ID/package name:
cordova-plugin-x-socialsharing
Tested version:
6.0.4
Plugin ID/package name:
cordova-plugin-actionsheet
Tested version:
2.3.3
Demo
Import the Social sharing demo to your Monaca account
Enable the plugin in Monaca IDE
From the IDE menu, go to Config → Manage Cordova Plugins .
Click the Import Cordova Plugin button. Then, you can choose to import the plugin using a ZIP file or a URL/package name.
API references
This section describes some of the main functions used in the Demo. For complete API references, please refer to the repository.
shareViaFacebook()
Share to Facebook.
window.plugins.socialsharing.shareViaFacebook(message, image, url)
Parameter
Name
Type
Description
message
String
Message
image
String
Image's source
url
String
website url
Return Value
Promise
Example
window.plugins.socialsharing.shareViaFacebook(
'Sharing via Facebook',
img.src,
null
);
shareViaTwitter()
Share to Twitter.
window.plugins.socialsharing.shareViaTwitter(message, image, url)
Parameter
Name
Type
Description
message
String
Message
image
String
Image's source
url
String
website url
Return Value
Promise
Example
window.plugins.socialsharing.shareViaTwitter(
'Message and link via Twitter',
img.src,
"www.monaca.io"
);
shareViaInstagram()
Share to Instagram.
window.plugins.socialsharing.shareViaInstagram(message, image)
Parameter
Name
Type
Description
message
String
Message
image
String
Image's source
Return Value
Promise
Example
window.plugins.socialsharing.shareViaInstagram(
'Message via Instagram',
img.src
);
Last updated
Was this helpful?