How to get access to FB share in BB10?

I tried to share on facebook but couldn't share anything. The code I used is:

In Javascript

FB.init({
         appId: 'some id', 
         cookie: true,
            status:true, 
            xfbml:true,
            oauth:true
         });


      function postToFeed() {

        // calling the API ...
        var obj = {
          method: 'feed',
          link: 'http://www.example.com',
          picture: imageToShare,
          name: 'name',
          caption: 'This Link is Shared through the some application.',
          description: ''

        };

        function callback(response) {
          //document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
        }

        FB.ui(obj, callback);
      }

      

In the config file

<access uri="http://connect.facebook.net" />

      

Thanks in advance.

+3


source to share


1 answer


If all you want to do is share something with your Facebook app, you can do that pretty easily with Maps.

I wrote a blog post about this here: http://devblog.blackberry.com/2013/02/twitter-and-facebook-cards/

Basically, you are using the BlackBerry invoke framework to invoke a Card and pass some data to that card.

function invokeFacebook() {
    blackberry.invoke.invoke({
        target: "Facebook",
        action: "bb.action.SHARE",
        type: "text/plain",
        data: "Iā€™m eating tacos with Alex."
    }, onSuccess, onError);
}

      



If you want to share the image, you just replace the 'data' attribute:

uri: 'file://' + pathToFile,

      

Our GitHub repository also has a sample app: https://github.com/ctetreault/BB10-WebWorks-Samples/tree/master/invoke/invoker

+3


source







All Articles