Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从应用程序中获取照片共享的喜好数_Android_Facebook_Facebook Like_Facebook Android Sdk - Fatal编程技术网

Android 从应用程序中获取照片共享的喜好数

Android 从应用程序中获取照片共享的喜好数,android,facebook,facebook-like,facebook-android-sdk,Android,Facebook,Facebook Like,Facebook Android Sdk,我使用facebook sdk以以下方式共享照片: File file = new File("imagePath"); Request photoRequest = Request.newUploadPhotoRequest(session, file, new Callback() { @Override public void onCompleted(Response response) { if(response.getError

我使用facebook sdk以以下方式共享照片:

File file = new File("imagePath");

Request photoRequest = Request.newUploadPhotoRequest(session, file, new Callback() {            
    @Override
    public void onCompleted(Response response) {
        if(response.getError()==null){
            try {
               String id = response.getGraphObject().getInnerJSONObject().get("id").toString();
              //store id
            } catch (JSONException e1) {
                e1.printStackTrace();
            }
        }
    }           
});
photoRequest.getParameters().putString("message", "xxx");
photoRequest.executeAsync();
Session session = Session.getActiveSession();
Bundle bundle = new Bundle();
bundle.putString("id", id); // this is the id stored before
bundle.putString("fields", "likes");
Request request = new Request(session, "search", bundle, HttpMethod.GET, new Request.Callback() {

    @Override
    public void onCompleted(Response response) {
        try {
            JSONObject obj = response.getGraphObject().getInnerJSONObject();
            //Obj is always -> {"data":[]}
        } catch (Exception e) {
        }
    }
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
Session session = Session.getActiveSession();
Bundle params = new Bundle();
String fql    = "SELECT like_info,src_big FROM photo WHERE object_id=\""+shared.getId()+"\"";
params.putString("q", fql);
Request request = new Request(session, "/fql",params, HttpMethod.GET, new Request.Callback() {      
    @Override
    public void onCompleted(Response response) {
        String message = "Foto cancellata";
        try {
            JSONObject resp = response.getGraphObject().getInnerJSONObject();
            JSONArray  data = resp.getJSONArray("data");
            if(data.length()>0){
                JSONObject like_info = data.getJSONObject(0).getJSONObject("like_info");
                String src           = data.getJSONObject(0).getString("src_big");
                if(!image.exists()){
                    aq.id(shared_image).image(src);
                }                   
                int count = like_info.getInt("like_count");
            }else{
               //PICTURE HAS BEEN DELETED
            }
        } catch (Exception e) {
            e.printStackTrace();
        }       
    }
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
现在我想在身份证上找到喜欢的人。 我试着这样做:

File file = new File("imagePath");

Request photoRequest = Request.newUploadPhotoRequest(session, file, new Callback() {            
    @Override
    public void onCompleted(Response response) {
        if(response.getError()==null){
            try {
               String id = response.getGraphObject().getInnerJSONObject().get("id").toString();
              //store id
            } catch (JSONException e1) {
                e1.printStackTrace();
            }
        }
    }           
});
photoRequest.getParameters().putString("message", "xxx");
photoRequest.executeAsync();
Session session = Session.getActiveSession();
Bundle bundle = new Bundle();
bundle.putString("id", id); // this is the id stored before
bundle.putString("fields", "likes");
Request request = new Request(session, "search", bundle, HttpMethod.GET, new Request.Callback() {

    @Override
    public void onCompleted(Response response) {
        try {
            JSONObject obj = response.getGraphObject().getInnerJSONObject();
            //Obj is always -> {"data":[]}
        } catch (Exception e) {
        }
    }
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
Session session = Session.getActiveSession();
Bundle params = new Bundle();
String fql    = "SELECT like_info,src_big FROM photo WHERE object_id=\""+shared.getId()+"\"";
params.putString("q", fql);
Request request = new Request(session, "/fql",params, HttpMethod.GET, new Request.Callback() {      
    @Override
    public void onCompleted(Response response) {
        String message = "Foto cancellata";
        try {
            JSONObject resp = response.getGraphObject().getInnerJSONObject();
            JSONArray  data = resp.getJSONArray("data");
            if(data.length()>0){
                JSONObject like_info = data.getJSONObject(0).getJSONObject("like_info");
                String src           = data.getJSONObject(0).getString("src_big");
                if(!image.exists()){
                    aq.id(shared_image).image(src);
                }                   
                int count = like_info.getInt("like_count");
            }else{
               //PICTURE HAS BEEN DELETED
            }
        } catch (Exception e) {
            e.printStackTrace();
        }       
    }
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
facebook API得到的总是
{“数据”:[]}

我使用此权限:

session.requestNewPublishPermissions(new NewPermissionsRequest(act, "publish_actions","user_photos","user_status"));
有什么问题吗?? 有人能帮我吗? 谢谢

我是这样解决的:

File file = new File("imagePath");

Request photoRequest = Request.newUploadPhotoRequest(session, file, new Callback() {            
    @Override
    public void onCompleted(Response response) {
        if(response.getError()==null){
            try {
               String id = response.getGraphObject().getInnerJSONObject().get("id").toString();
              //store id
            } catch (JSONException e1) {
                e1.printStackTrace();
            }
        }
    }           
});
photoRequest.getParameters().putString("message", "xxx");
photoRequest.executeAsync();
Session session = Session.getActiveSession();
Bundle bundle = new Bundle();
bundle.putString("id", id); // this is the id stored before
bundle.putString("fields", "likes");
Request request = new Request(session, "search", bundle, HttpMethod.GET, new Request.Callback() {

    @Override
    public void onCompleted(Response response) {
        try {
            JSONObject obj = response.getGraphObject().getInnerJSONObject();
            //Obj is always -> {"data":[]}
        } catch (Exception e) {
        }
    }
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
Session session = Session.getActiveSession();
Bundle params = new Bundle();
String fql    = "SELECT like_info,src_big FROM photo WHERE object_id=\""+shared.getId()+"\"";
params.putString("q", fql);
Request request = new Request(session, "/fql",params, HttpMethod.GET, new Request.Callback() {      
    @Override
    public void onCompleted(Response response) {
        String message = "Foto cancellata";
        try {
            JSONObject resp = response.getGraphObject().getInnerJSONObject();
            JSONArray  data = resp.getJSONArray("data");
            if(data.length()>0){
                JSONObject like_info = data.getJSONObject(0).getJSONObject("like_info");
                String src           = data.getJSONObject(0).getString("src_big");
                if(!image.exists()){
                    aq.id(shared_image).image(src);
                }                   
                int count = like_info.getInt("like_count");
            }else{
               //PICTURE HAS BEEN DELETED
            }
        } catch (Exception e) {
            e.printStackTrace();
        }       
    }
});
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();

这是一个愚蠢的问题,但我想问的是,这篇文章中是否有喜欢的人?我的意思是你要确保我在帖子里有一些喜欢的人。另外,请检查相同的过程,并让我知道结果,所以你是说,如果我在fb上共享图片,我无法获得用户的喜欢,因为fb上的图片没有喜欢?o、 显然。如果没有喜欢的东西,你怎么能从graph api中得到喜欢的东西呢?但是我可以使用cose On将喜欢添加到我共享的照片中。。。