在将视频发布到android中的facebook时,从graphRequest获取null

时间:2017-07-18 05:15:25

标签: android facebook video share

我在登录Facebook后获得了Access令牌。但我无法从图表响应中获得响应。我正在尝试从我的应用发布视频这是我的代码。请允许任何人帮我解决此问题。

private void postvideo(byte[] VideoBytes, String filePath)
{
    String url;
    url = "/me/videos";
    AccessToken token_new = AccessToken.getCurrentAccessToken();


    if (token_new != null) {
        Bundle param = new Bundle();
        param.putByteArray("video." + getFileExt(filePath), VideoBytes);
        param.putString("description", "sample video");


        new GraphRequest(token_new,url, param, HttpMethod.POST, new GraphRequest.Callback() {

            public void onCompleted(GraphResponse response) {
                Log.e("New Post", "Res =" + response.toString());
                Toast.makeText(activity, "response."+response, Toast.LENGTH_SHORT).show();



                if (response != null && response.getJSONObject() != null && response.getJSONObject().has("id")) {
                    Log.e("New Post", "Success");
                    Toast.makeText(activity, "Video posted successfully.", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(activity, "Error in posting Video."+response, Toast.LENGTH_SHORT).show();
                }
               /* setResult(Activity.RESULT_OK, new Intent());
                finish();*/
            }
        }).executeAsync();
    }


}

这是我得到的回应

{响应:responseCode:400,graphObject:null,错误:{HttpStatus:400,errorCode:100,errorType:OAuthException,errorMessage:(#100)无权发布视频}

0 个答案:

没有答案