• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    Objective-C
  • Created over 11 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cordova / PhoneGap Social Message Plugin for Apache Cordova >= 3.0.0

Social Message Plugin for Apache Cordova npm version

Cordova Plugin to utilise native share features. Developed for Apache Cordova CLI >= 3.0.0. Share text, images and urls to Facebook, Twitter and more.

Install

Latest published version on npm (with Cordova CLI >= 5.0.0)

cordova plugin add cordova-plugin-social-message

Latest version from GitHub

cordova plugin add https://github.com/leecrossley/cordova-plugin-social-message.git

Usage

You do not need to reference any JavaScript, the Cordova plugin architecture will add a socialmessage object to your root automatically when you build.

Ensure you use the plugin after your deviceready event has been fired.

Share some text

Pass a message object with a "text" property as an argument to the send function:

var message = {
    text: "This is a test message"
};
window.socialmessage.send(message);

This example will allow the message to be shared with all built in activity types.

Specify activity types (iOS only)

To specify activity types to include as options for the user, add an "activityTypes" array to your message:

var message = {
    text: "This is a test message",
    activityTypes: ["PostToFacebook", "PostToTwitter"]
};
window.socialmessage.send(message);

This example will only allow the user to post the message to Facebook or Twitter.

A complete list of activity types can be found here. You should omit the "UIActivityType" prefix when adding to your array.

NB: Some activity types will only show as an option when they have accounts configured in the iOS settings on the device (e.g. Facebook and Twitter). This is different from having the apps installed.

Share a message with a subject

To add a subject to your message, use the "subject" property (used with activity types such as Mail):

var message = {
    subject: "Test Subject",
    text: "This is a test message",
    activityTypes: ["Mail"]
};
window.socialmessage.send(message);

Share a message with a url

To add a link to your message, use the "url" property:

var message = {
    text: "Link test",
    url: "http://ilee.co.uk"
};
window.socialmessage.send(message);

Share a message with an image

To add an image to your message, use the "image" property:

var message = {
    text: "Image test",
    image: "http://cordova.apache.org/images/cordova_bot.png"
};
window.socialmessage.send(message);

Platforms

iOS and Android.

Android quirk

Facebook does not permit you to share pre-filled text on Android, however images and urls will work.

License

MIT License

More Repositories

1

cordova-plugin-apple-watch

Cordova / PhoneGap Apple Watch Plugin for Apache Cordova
Objective-C
264
star
2

cordova-plugin-native-transitions

Cordova / PhoneGap Native Transitions Plugin for Apache Cordova >= 3.0.0
Objective-C
143
star
3

cordova-plugin-touchid

Cordova / PhoneGap Touch ID Plugin for Apache Cordova >= 3.0.0
Objective-C
100
star
4

cordova-plugin-shake

Cordova / PhoneGap Plugin to detect when a physical device performs a shake gesture
JavaScript
94
star
5

cordova-plugin-game-center

Cordova / PhoneGap Game Center Plugin for Apache Cordova >= 3.0.0
Objective-C
78
star
6

cordova-plugin-transport-security

Cordova / PhoneGap Plugin to bypass the iOS 9 App Transport Security (NSAppTransportSecurity)
74
star
7

cordova-plugin-pedometer

Cordova / PhoneGap Core Motion Pedometer Plugin for Apache Cordova >= 3.0.0
Java
60
star
8

cordova-plugin-jailbreak-detection

Cordova / PhoneGap Jailbreak Detection Plugin for Apache Cordova >= 3.0.0
Objective-C
37
star
9

cordova-plugin-background-task

Cordova / PhoneGap Background Task Plugin for Apache Cordova >= 3.0.0
Objective-C
31
star
10

cordova-plugin-directions

Cordova / PhoneGap Map Directions Plugin for Apache Cordova >= 3.0.0
Java
29
star
11

hexo-generator-cname

Github pages CNAME generator plugin for Hexo
JavaScript
24
star
12

cordova-plugin-dynamic-update

Cordova / PhoneGap Dynamic Update Plugin
Java
20
star
13

grunt-timer

Time the execution of each of your grunt tasks automatically
JavaScript
14
star
14

cordova-plugin-progress

Cordova Plugin for Progress HUD Notifications (via KVNProgress)
Objective-C
11
star
15

cordova-plugin-boot-launcher

Cordova / PhoneGap Boot Launcher Plugin for Apache Cordova >= 3.0.0
Java
9
star
16

hexo-generator-robotstxt

Basic robots.txt generator plugin for Hexo
JavaScript
8
star
17

isNumeric

Determine if a JavaScript object is numeric
JavaScript
8
star
18

replaceall

Replace all instances in a JavaScript string
JavaScript
8
star
19

cordova-plugin-datetime-picker

Cordova / PhoneGap Date Time Picker Plugin for Apache Cordova >= 3.0.0 (Windows Phone 8)
C#
8
star
20

imageurl-base64

Node package to convert an image from a url to base64
JavaScript
7
star
21

dotject

Dot notation to object
JavaScript
6
star
22

functionaljs-docs

Markdown documentation for functional.js
4
star
23

grunt-pogo

Compile your PogoScript to JavaScript with Grunt
JavaScript
4
star
24

cordova-plugin-date-input

Cordova / PhoneGap Date Input Plugin for Apache Cordova >= 3.0.0
JavaScript
3
star
25

froute

A simple and powerful routing for node with expressive matching
JavaScript
3
star
26

appsassin

Game developed for #HackManchester. "Appsassin" – Travel the world. Meet new people. Kill them.
JavaScript
3
star
27

Real-Simple-Server

Spin up a real simple http server with node
2
star
28

PhoneStub

Facilitates the testing and running of Cordova (PhoneGap) based applications in a desktop or headless browser.
JavaScript
2
star
29

atom-dotject

Dot notation to object for https://atom.io/
CoffeeScript
2
star
30

froute-picker

Picking and matching module for froute
JavaScript
2
star
31

Mobile-Starter

Mobile Starter Template for the Wednesday Widget Workshop (WWW)
2
star
32

health-heatmap

2
star
33

grunt-pause

Allow pausing between grunt tasks
JavaScript
2
star
34

mumford

I will wait, I will wait for you
JavaScript
2
star
35

nativescript-app-rss-reader

RSS Reader demo app built with NativeScript
JavaScript
2
star
36

The-28-Minute-App

Dev Led Training Code
1
star
37

includes

Include html files within html files with Node.js
JavaScript
1
star
38

christmas-ribbon

Christmas ribbon css for the top right of a webpage
1
star
39

Retina

Mobile OCR App for NICE Evidence (WWW)
JavaScript
1
star
40

blurchat-site

BlurChat website
CSS
1
star
41

shake.js

Shake gesture detection in PhoneGap / Cordova (migrated from gist 4078996)
JavaScript
1
star