首页 文章

同时发布到Facebook粉丝页面和用户的墙上 . Android的

提问于
浏览
0

我有我的Android应用程序,允许用户在Facebook上分享一些文本的有趣片段 .

在用户的墙上共享工作正常,并使用本教程实现:http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/

我还有我的应用程序的Facebook粉丝页面,我想在该页面上整合所有这些个人共享 . 因此,当一些用户在他们的墙上共享文本时,该程序也会在Facebook粉丝页面上发布这个,因此如果有人对讨论感兴趣,他们可能会喜欢粉丝页面并订阅其他用户所做的所有评论 .

我的问题是我可以在用户的墙上发布或在粉丝页面上发布 . 我怎么能同时做到这两件事?

public void postToWall(){
    Bundle parameters = new Bundle();
        parameters.putString("message", this.messageToPost);
        parameters.putString("description", this.messageDesc);
        parameters.putString("link", this.messageLink);
 // parameters.putString("target_id", FAN_PAGE_ID);

        try {
                facebook.request("me");
             //   String response = facebook.request("me/feed", parameters, "POST");
                String response = facebook.request(FAN_PAGE_ID+"/feed", parameters, "POST");
                Log.d("Tests", "got response: " + response);
                if (response == null || response.equals("") ||
                response.equals("false")) {
                    showToast("Blank response.");
        }
        else {
            showToast("Message posted to your facebook wall!");
        }
        finish();
    } catch (Exception e) {
        showToast("Failed to post to wall!");
        e.printStackTrace();
        finish();
    }
}

该行发布到用户的墙上

String response = facebook.request("me/feed", parameters, "POST");

而这一个粉丝页面

String response = facebook.request(FAN_PAGE_ID+"/feed", parameters, "POST");

我已经设置了我的应用程序的权限,可以使用此帖子在粉丝页面上发布Simple example to post to a Facebook fan page via PHP?

1 回答

  • 1

    我有同样的问题,我只是通过两个asyncfacebookrunner类做了请求 . 所以基本上它们是并行发生的 .

    private AsyncFacebookRunner mAsyncFbRunner; 
    private AsyncFacebookRunner mAsyncFbRunner2;
    
    public void postToWall() {
    
        boolean success = true;
    
        Bundle params = new Bundle();
    
        //this is for posting on the walls
    
        parameters.putString("message", this.messageToPost);
        parameters.putString("description", this.messageDesc);
        parameters.putString("link", this.messageLink);
    
        mAsyncFbRunner.request("me/feed", params,"POST", new WallPostListener(), success);
        mAsyncFbRunner2.request(FAN_PAGE_ID+/"feed", params,"POST", new WallPostListener(), success);
    
    }
    

相关问题