I am using SDK 3.6 for posting the message and Photo. The below code is giving the response like "Unsupported Methods, Photos.upload "
I referred the below Stackoverflow.
Android post picture to Facebook wall
Is there anything Wrong?. How to upload the Image (not from url), and message together in facebook
private void postPhoto1()
{
if (hasPublishPermission()) {
Bitmap image = BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_launcher);
Session session = Session.getActiveSession();
Bundle postParams = new Bundle();
Byte[] data = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();
postParams.putString("method", "photos.upload");
postParams.putByteArray("picture", data);
Request request = new Request(session, "me/photos", postParams, HttpMethod.POST, new Request.Callback() {
@Override
public void onCompleted(Response response) {
showPublishResult(getString(R.string.successfully_posted_post), response.getGraphObject(), response.getError());
}
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
} else {
pendingAction = PendingAction.POST_PHOTO;
}
}