如何在Android上的特定Facebook粉丝页面上分享图像?

时间:2015-06-24 08:12:42

标签: android facebook image facebook-graph-api android-sharing

我有两个选项可以在facebook上分享图片。一个人可以直接在用户s wall and the other to share image on a facebook fan page that i have created recently by the users. I done share image on user的墙上发布图片。但我不知道如何在脸书页面上分享图片。有什么问题吗?< / p>

1 个答案:

答案 0 :(得分:0)

    private void shareToPage() {
//Getting image intent as bytearray
    byte[] byteArray = getIntent().getByteArrayExtra("image");  
            Bundle bundle = new Bundle();
            bundle.putByteArray("object_attachment", byteArray);
            bundle.putString("message", "some message here");

            GraphRequest graphRequest = new GraphRequest(AccessToken.getCurrentAccessToken(),
                    "/" + pageID + "/photos",
                    bundle,
                    HttpMethod.POST,
                    new GraphRequest.Callback() {

                        @Override
                        public void onCompleted(GraphResponse graphResponse) {
                            Log.d("Page response==>",graphResponse.toString());

                                Toast.makeText(SharePageActivity.this, "Photo uploaded successfully", Toast.LENGTH_LONG).show();
     });
           graphRequest.executeAsync();
     }