GithubHelp home page GithubHelp logo

adimpression / cordova-plugin-social-message Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leecrossley/cordova-plugin-social-message

0.0 2.0 0.0 197 KB

Cordova Social Message Plugin for Apache Cordova >= 3.0.0

Home Page: http://NewsMute.com

cordova-plugin-social-message's Introduction

Social Message Plugin for Apache Cordova

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.

1 step install

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.

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

Currently supporting iOS and Android - check back soon for Windows Phone 8 support.

License

MIT License

cordova-plugin-social-message's People

Contributors

leecrossley avatar

Watchers

James Cloos avatar Ravindranath Akila avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.