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.2
- Plugin ID/package name:
cordova-plugin-actionsheet
- Tested version:
2.3.3
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.
- 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.
This section describes some of the main functions used in the Demo. For complete API references, please refer to the repository.
Share to Facebook.
window.plugins.socialsharing.shareViaFacebook(message, image, url)
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
window.plugins.socialsharing.shareViaFacebook(
'Sharing via Facebook',
img.src,
"www.monaca.io"
);
Share to Twitter.
window.plugins.socialsharing.shareViaTwitter(message, image, url)
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
window.plugins.socialsharing.shareViaTwitter(
'Message and link via Twitter',
img.src,
"www.monaca.io"
);
Share to Instagram.
window.plugins.socialsharing.shareViaInstagram(message, image)
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
window.plugins.socialsharing.shareViaInstagram(
'Message via Instagram',
img.src
);
Last modified 1yr ago