How to share image on a particular facebook fan page on android?

242 views Asked by At

I have two options to share a image on facebook.One to directly post the image on the users 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 users wall successfully.But i dont know how to share image on a facebook page.Any hep please?

1

There are 1 answers

0
Selvam On
    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();
     }