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

Developer Relations at BlackBerry. Team @FilterMama and @TacoQuestApp member. #HTML5. I code in DOS Edit. BBM Channel C00124CF8

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus