Social Sharing
$ ionic plugin add cordova-plugin-x-socialsharing
Repo: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
Share text, files, images, and links via social networks, sms, and email.
Supported platforms
- iOS
- Android
- Windows Phone
Usage
import {SocialSharing} from 'ionic-native';
...
// TODO add usage info
Static Methods
share(message, subject, file, url)
Shares using the share sheet
Param | Type | Details |
---|---|---|
message |
string
|
The message you would like to share. |
subject |
string
|
The subject |
file |
string |Array.<string>
|
URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone. |
url |
string
|
A URL to share |
canShareVia(appName)
Platforms:
iOS
Android
Checks if you can share via a specific app.
Param | Type | Details |
---|---|---|
appName |
App name or package name. Examples: instagram or com.apple.social.facebook |
shareViaTwitter(message, image, url)
Platforms:
iOS
Android
Shares directly to Twitter
Param | Type | Details |
---|---|---|
message | ||
image | ||
url |
shareViaFacebook(message, image, url)
Platforms:
iOS
Android
Shares directly to Facebook
Param | Type | Details |
---|---|---|
message |
string
|
|
image |
string
|
|
url |
string
|
shareViaFacebookWithPasteMessageHint(message, image, url, pasteMessageHint)
Platforms:
iOS
Android
Shares directly to Facebook with a paste message hint
Param | Type | Details |
---|---|---|
message |
string
|
|
image |
string
|
|
url |
string
|
|
pasteMessageHint |
string
|
shareViaInstagram(message, image)
Platforms:
iOS
Android
Shares directly to Instagram
Param | Type | Details |
---|---|---|
message |
string
|
|
image |
string
|
shareViaWhatsApp(message, image, url)
Platforms:
iOS
Android
Shares directly to WhatsApp
Param | Type | Details |
---|---|---|
message |
string
|
|
image |
string
|
|
url |
string
|
shareViaWhatsAppToReceiver(receiver, message, image, url)
Platforms:
iOS
Android
Shares directly to a WhatsApp Contact
Param | Type | Details |
---|---|---|
receiver |
string
|
Pass phone number on Android, and Addressbook ID (abid) on iOS |
message |
string
|
Message to send |
image |
string
|
Image to send (does not work on iOS |
url |
string
|
Link to send |
shareViaSMS(messge, number)
Platforms:
iOS
Android
Share via SMS
Param | Type | Details |
---|---|---|
messge |
string
|
message to send |
number |
string
|
Number or multiple numbers seperated by commas |
shareViaEmail(message, subject, to, cc, bcc, files)
Platforms:
iOS
Android
Share via Email
Param | Type | Details |
---|---|---|
message |
string
|
|
subject |
string
|
|
to |
Array<string>
|
|
cc |
Array<string>
|
|
bcc |
Array<string>
|
|
files |
string |Array.<string>
|
URL or local path to file(s) to attach |