I have successfully post a feed in facebook page form the graph api.
try {
resObj.put("message","feed from android");
//resObj.put("object_attachment",bitmap);
} catch (JSONException e) {
e.printStackTrace();
}
GraphRequest request = GraphRequest.newPostRequest(
AccessToken.getCurrentAccessToken(),"363453267193844/photos",resObj,
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse graphResponse) {
Log.i(TAG,"post page response::"+graphResponse);
}
}
);
request.executeAsync();
But, I'm unable to post image into facebook page. The problem is I'm unable to find the key for image attachment in Json data posted in Graph Api.
The failed response from facebook is
{Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 324, errorType: OAuthException, errorMessage: (#324) Requires upload file}}
1.) Make sure you a page access token with
publish_pages
permission that can be used to publish new photos.2.) From the docs . Note that you dont have a "/" before pageid in your call.
3.) Example ==>
Try it like this i.e post byteArrayStream of your photo
Finally, finally, I was able to post an image into facebook page. This is how I did to post an photo.