I want to upload both a message and a PNG image to the logged-in user's timeline using facebook sdk in android.
The response rarely succeed, but failed in most cases.
The error response is "Response: responseCode: 408, graphObject: null, error: {HttpStatus: 408, errorCode: -1, errorType: null, errorMessage: null}, isFromCache:false".
Why the 408 error happens?
Here is my code:
private void postMessageAndPhoto() {
Bitmap image = BitmapFactory.decodeResource(this.getResources(), R.drawable.icon);
String message = "Hello. \n https://developers.facebook.com/android";
Bundle postParams = new Bundle();
postParams.putString("message", message);
postParams.putParcelable("picture", image);
Request request = new Request(Session.getActiveSession(), "me/photos", postParams,
HttpMethod.POST, new Request.Callback() {
@Override
public void onCompleted(Response response) {
if (!isFinishing()) {
// do something
}
}
});
request.executeAsync();
}
How should I post a messages and a photos?