简体   繁体   English

获取我发布的照片​​的ID,并获取照片的编号?

[英]Get the id of the photo I posted and get the photo's number of like?

I try to get the photo ID to request how many like of it ! 我尝试获取带照片的证件,要求提供多少张照片! But I don't know how to do it ! 但是我不知道该怎么做! pls help me ! 请帮助我 ! This is how I post my photo ! 这就是我发布照片的方式!

 private void postPhoto() {
        if (hasPublishPermission()) {
            Bitmap image = cg.toBitmap(800, 800);
            Request request = Request.newUploadPhotoRequest(Session.getActiveSession(), image, new Request.Callback() {
                @Override
                public void onCompleted(Response response) 
                {   
                    showPublishResult(getString(R.string.photo_post), response.getError());
                }
            });
            request.executeAsync();
        } else {
            pendingAction = PendingAction.POST_PHOTO;
        }
    }

and how to get the number of like of it ( when we have the id of this photo ) . 以及如何获得喜欢的数量(当我们有照片的ID时)。 Thank you ! 谢谢 !

If you post a photo successfully, the Graph API will include an Object ID in the response, like 如果您成功发布照片,则Graph API将在响应中包含一个对象ID,例如

{ id: 1234567 }

Now, you can query the likes via 现在,您可以通过以下方式查询喜欢的人

GET /1234567/likes

Then, you have to count the likes by iterating over the result array, or use an FQL query instead: 然后,您必须通过遍历结果数组来计算点赞次数,或者改为使用FQL查询:

GET /fql?q=SELECT+object_id,like_info.like_count+FROM+photo+WHERE+object_id=12345667

There, you'll have the like_count directly. 在那里,您将直接拥有like_count。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM