Facebook API / Android : Wall Post publish with image attachment not working

后端 未结 2 707
误落风尘
误落风尘 2021-01-24 13:30

I have the following code.

It works and posts the message-part but the attachment part does\'nt work. I suspect it has to do with passing a JSON as a string.

Fac

2条回答
  •  时光取名叫无心
    2021-01-24 14:15

    Bundle params = new Bundle();
                       // params.putString("multipart/form-data", imgurl);
                        params.putByteArray("multipart/form-data",byteArray);
    
                        params.putString("caption", txtcaption.getText().toString());
                        /* make the API call */
                        new GraphRequest(
                                AccessToken.getCurrentAccessToken(),
                                "/me/photos",
                                params,
                                HttpMethod.POST,
                                new GraphRequest.Callback() {
                                    public void onCompleted(GraphResponse response) {
                                        /* handle the result */
                                        Log.e("responseImagedata---", response.toString());
    
                                    }
                                }
                        ).executeAsync();
    

提交回复
热议问题