Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Social message plugin for Apache cordova

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 677
    Comment on it

    Hello Readers,

    Social message plugin permits you to share message, image and url to social media like Facebook, Twitter, Instagram etc. To use this plugin no need reference any javascript library. We simply install a plugin via CLI.

    Installation :

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

    After installation, the architecture of Cordova plugin  will add a socialmessage object automatically when we build.

    Usage :

    • Sharing of text :  We need to pass an object in window.socialmessage.send function with an argument.

    Example :

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

    The above example allows you to share message in all built in activities of device.

    • Specify activity type: This feature supports only iOS platform. To specify the activity type we need add an array to message object shown in below example.

    Example :

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

    In the above example this message share on Facebook and Twitter only.

    • Sharing message with a subject : We can add subject property in message object to specify subject to your message.

    Example :

    var message = {
        subject: "Test Subject",
        text: "This is a test message"
    };
    window.socialmessage.send(message);
    • Sharing message with a url:  Share a url along with message we need to add a url property into message object.

    Example :

    var message = {
        text: "Link test",
        url: "http://google.com"
    };
    window.socialmessage.send(message);
    • Sharing images :  Share an image along with message we need to add image property in message object.

    Example :

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

    Important :

    • This plugin supports Android and iOS platforms.
    • Facebook does not allow to share pre-filled message/text on Android but we can share image/url on Facebook at a time not the both on same time.

    Hope this will help you. :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: