Monaca Docs
Search…
Cordova Social Sharing Plugin
This Cordova plugin is used to share text, files, images, and links via social networks, sms, and email.
To check the third party Cordova plugins, you need to create a custom build debugger (Android version or iOS version).
To use the plugin with the android custom build debugger, you need to import the cordova-plugin-androidx-adapter.

Demo

Enable the plugin in Monaca IDE

    1.
    From the IDE menu, go to Config → Manage Cordova Plugins .
    2.
    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.
1
window.plugins.socialsharing.shareViaFacebook(message, image, url)
Copied!
A valid authentication on the Facebook app on the device is required in order to use this function.
Parameter
Name
Type
Description
message
String
Message
image
String
Image's source
url
String
website url
Return Value
    Promise
Example
1
window.plugins.socialsharing.shareViaFacebook(
2
'Sharing via Facebook',
3
img.src,
4
"www.monaca.io"
5
);
Copied!

shareViaTwitter()

Share to Twitter.
1
window.plugins.socialsharing.shareViaTwitter(message, image, url)
Copied!
A valid authentication on the Twitter app on the device is required in order to use this function.
Parameter
Name
Type
Description
message
String
Message
image
String
Image's source
url
String
website url
Return Value
    Promise
Example
1
window.plugins.socialsharing.shareViaTwitter(
2
'Message and link via Twitter',
3
img.src,
4
"www.monaca.io"
5
);
Copied!

shareViaInstagram()

Share to Instagram.
1
window.plugins.socialsharing.shareViaInstagram(message, image)
Copied!
A valid authentication on the Instagram app on the device is required in order to use this function. This function does not work on iOS.
Parameter
Name
Type
Description
message
String
Message
image
String
Image's source
Return Value
    Promise
Example
1
window.plugins.socialsharing.shareViaInstagram(
2
'Message via Instagram',
3
img.src
4
);
Copied!
Last modified 2mo ago