开发者

Facebook Photo Upload Issue

开发者 https://www.devze.com 2023-04-10 05:09 出处:网络
I want to do Upload the Photo on Facebook from my Android Device but the following error is occured. following is my code for upload photo:-

I want to do Upload the Photo on Facebook from my Android Device but the following error is occured.

Facebook Photo Upload Issue

following is my code for upload photo:-

Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
String encodedImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
Bundle params = new Bundle();
params.putString("photos.upload", encodedImage);

//post on user's wall.
facebook.dialog(this, "photos.upload", params, new DialogListener() {
    @Override
    public void onFacebookError(FacebookError e) {
            // TODO Auto-generated method stub
        System.out.println("Error facebook is:- " + e.toString());
    }

    @Override
    public void onError(DialogError e) {
            // TODO Auto-generated method stub
        System.out.println("Error Dialog is:- " + e.toString());
    }

    @Override
    public void onComplete(Bundle values) {
        // TODO Auto-generated method stub
        System.out.println("Values is:- " + values);
    }

    @Override
    public void onCancel() {
        // TODO Auto-generated method stub
        System.out.println("On Cancel Clicked...");
    }
});

so, What is the Problem in above开发者_如何学Python code? Please Help Me.


Use facebook AsyncRunner class to upload the photo. It will solve your problem. Try POST in place of photos.upload in facebook.dialog method, I may be wrong but try it once.

0

精彩评论

暂无评论...
验证码 换一张
取 消