2016-06-29 5 views
0

Facebookの壁に画像を問題なく共有するアプリケーションを作成しましたが、私のFacebookのグループの1つで画像を共有するための解決策が見つかりませんでした。私のFacebookのページの1つに写真を共有

私は今、このコードを使用します。

SharePhoto photo = new SharePhoto.Builder() 
      .setBitmap(selectedImage) 
      .setCaption("tag") 
      .build(); 

    SharePhotoContent content = new SharePhotoContent.Builder() 
      .addPhoto(photo) 
      .build(); 

誰もが私の問題への解決策を提案することはできますか?

答えて

0

最終的に解決策が見つかりました。私はShareApiを使用する代わりに、グラフapi呼び出しを使用します。

Bundle bundle=new Bundle(); 
bundle.putByteArray("object_attachment", byteArray); // object attachment must be either byteArray 
bundle.putString("message","message_to_the_post"); 

GraphRequest graph =new GraphRequest(pageAccessToken, 
    "/<page_id>/photos",// 
    bundle, 
    HttpMethod.POST, 
    new GraphRequest.Callback() { 
     @Override 
     public void onCompleted(GraphResponse graphResponse) 
     { 
      //Do stuff here 
     } 
    }); 

graph.executeAsync(); 
関連する問題