Over-sharing with Twitter and Facebook Cards

Web Development

Let’s face it: YOU ARE AWESOME. You’re the most important person in your friends’ and family members’ lives. They’d be completely lost, wandering the streets like zombies, without knowing what you were up to 24/7 on Twitter and Facebook.

Luckily for them, sharing content from your BlackBerry WebWorks app just got super easy.

While browsing through our ever-growing catalogue of Sample Apps on GitHub, I realized we were missing some crucial Invocation samples for Facebook and Twitter! “Blasphemy,” you say?! I agree, so here is some quick info about how you can share data to Facebook and Twitter from your app.

With only a few lines of JavaScript, you can invoke these two lovely cards.

…and here’s the code:

function invokeTwitter() {
    blackberry.invoke.invoke({
        target: "Twitter",
        action: "bb.action.SHARE",
        type: "text/plain",
        data: "In @chadtatro we trust."
    }, onSuccess, onError);
}
function invokeFacebook() {
    blackberry.invoke.invoke({
        target: "Facebook",
        action: "bb.action.SHARE",
        type: "text/plain",
        data: "I’m eating tacos with Alex."
    }, onSuccess, onError);
}

All memes and jokes aside, the invocation framework is incredibly powerful. Integrating it in to your application is another simple way for you to provide that genuine BlackBerry 10 “look and feel” to your users.

For the full sample app, check out our GitHub repository.

If you have any question, concerns, or just want to show your love, you can find me on Twitter at @chadtatro. (http://twitter.com/chadtatro)

About Chad Tetreault

A developer at heart, I’ve been coding in some shape or form since the age of 13. Nowadays I focus on building awesome cross-platform (Android, iOS, BlackBerry) mobile web applications powered by Cordova, JavaScript, and AngularJS.

Join the conversation

Show comments Hide comments
+ -
  • http://devblog.blackberry.com/2013/03/cascades-socialinvocation/ Being Social with Cascades | BlackBerry Developer Blog

    […] already learned that YOU ARE AWESOME and your family and friends need to be kept constantly up-to-date on all your amazing adventures. […]

  • http://devblog.blackberry.com/2013/05/she-said-leveraging-the-power-of-foursquare-in-blackberry-10/ She Said: Leveraging the Power of Foursquare in BlackBerry 10 | BlackBerry Developer Blog

    […] spoken before about how to integrate your Cascades and WebWorks apps with Facebook, Twitter, and LinkedIn on BlackBerry 10. We’ve shared samples with you […]

blog comments powered by Disqus