I found out what the problem was. I was not asking the right permissions and the graph path was also wrong. The right method is :
public static void PublishToFeedInBackground()
{
final Bundle _postParameter = new Bundle();
_postParameter.putString("name", name);
_postParameter.putString("link", link);
_postParameter.putString("picture", link_to_image);
_postParameter.putString("caption", caption);
_postParameter.putString("description", description);
final List<String> PERMISSIONS = Arrays.asList("publish_stream");
if (Session.getActiveSession() != null)
{
NewPermissionsRequest reauthRequest = new Session.NewPermissionsRequest(this.GetContext(), PERMISSIONS);
Session.getActiveSession().requestNewPublishPermissions(reauthRequest);
}
this.runOnUiThread(new Runnable()
{
@Override
public void run()
{
Request request = new Request(Session.getActiveSession(), "feed", _postParameter, HttpMethod.POST);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
});
}