开发者

Sencha Touch and Facebook button

I need to create a button to submit a comment on Face Book wall.

I am using 开发者_StackOverflow社区MVC in Sencha touch and in my controller I use a function as

facebookComment: function()
{
    --------    
    }

This function is to be called when a button is pressed. Can any body please throw some light on how to go about this?


i am using following code to post on friends wall see if it is useful to you or not

            var postParams = {
                method: 'stream.publish' 
            ,   target_id: friend_id
            ,   display: 'popup'
            ,   message: message
            ,   user_message_prompt: "Post message!"
        }
        FB.api(postParams, function(response) { 
                if(response.error_code || !response) { 
                 to handle error    
                } 
        });

or refer this link https://developers.facebook.com/docs/reference/rest/stream.publish/


Well, first you should already be using the Javascript SDK. Then just issue a HTTP POST request to the feed connection of the current user using the FB.api() method with the message field set to your comment:

var body = comment_var;
FB.api('/me/feed', 'post', { message: body }, function(response) {
  if (!response || response.error) {
    alert('Error occured');
  } else {
    alert('Post ID: ' + response.id);
  }
});

Obviously, should be taking care of the user login status (maybe using the method FB.getLoginStatus()).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜