简体   繁体   English

“ Request.newMeRequest”和“ new http Request(”)有什么区别

[英]what is the difference between “Request.newMeRequest” and “new http Request(”

I want to get some FB data from my android app. 我想从我的Android应用程序中获取一些FB数据。

I see there are two ways of doing this: 我看到有两种方法可以做到这一点:

A) 一种)

new Request(session,"/me/interests", null, HttpMethod.GET,
                new Request.Callback() {
                    public void onCompleted(Response response) {
                        /* handle the result */
                    }
                }
            ).executeAsync();

B) B)

Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user, Response response) {

is one of them deprecated? 其中之一被弃用了吗?

how do i ask for specific node\\edge (eg "/me/interests") in the second signature? 我如何在第二个签名中要求特定的节点\\边缘(例如“ / me / interests”)?

Does it gives me all the node ready made as long as I asked for the proper permissions? 只要我要求适当的权限,它是否使我准备好了所有节点?

1) As specified in the docs ( https://developers.facebook.com/docs/reference/android/current/class/Request/ ), none of them is deprecated. 1)根据docs( https://developers.facebook.com/docs/reference/android/current/class/Request/ )中的指定,均未弃用。

2) You can't ask for a specific node/edge, because it is already configured to retrieve a users profile. 2)您不能要求特定的节点/边缘,因为它已配置为检索用户配置文件。

3) You get a GraphUser and a Response as a return (in onComplete ). 3)您将获得一个GraphUser和一个Response作为返回(在onComplete )。

Most likely, newMeRequest will call new Request internally. newMeRequest最有可能在内部调用new Request

Request.newMeRequest is simply a wrapper around new Request(session, "/me"). Request.newMeRequest只是新Request(session,“ / me”)的包装。 It's a convenience method. 这是一种方便的方法。

If you want to ask for anything else, you need to construct it yourself, probably using the newGraphPathRequest method - https://developers.facebook.com/docs/reference/android/current/class/Request/#newGraphPathRequest 如果您要提出其他要求,则可能需要使用newGraphPathRequest方法自己构造它-https: //developers.facebook.com/docs/reference/android/current/class/Request/#newGraphPathRequest

So for the "me/interests" example above, you would do something like: 因此,对于上面的“我/兴趣”示例,您将执行以下操作:

Request.newGraphPathRequest(session, "me/interests", new Request.Callback() {...})
  .executeAsync();

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

相关问题 “ SOAPAction:”和“ SOAPAction” HTTP请求属性之间的区别 - Difference between “SOAPAction:” and “SOAPAction” HTTP request property DELETE HTTP 请求参数和请求体的区别 - Difference between DELETE HTTP request parameters and request body UniRest 和 Spring RestTemplate 给出 http 400 错误请求有什么区别? - What is the difference between UniRest and Spring RestTemplate giving an http 400 Bad Request? MimeHeader和tomcat请求中的Header有什么区别? - What's the difference between MimeHeader and Header in tomcat request? 在Spring 3.0 GET请求中,@ PathVariable和@RequestParam之间的区别是什么 - In a Spring 3.0 GET request, what's the difference between a @PathVariable and a @RequestParam 请求的线程和程序的线程有什么区别? - What's difference between request's thread and program's thread? 每个连接的线程与每个请求的线程有什么区别? - What is the difference between thread per connection vs thread per request? session.setAttribute和request.setAttribute之间有什么区别? - What's the difference between session.setAttribute and request.setAttribute? Vert.x和JavaScript的POST请求之间有什么区别? - What is difference between POST-request of Vert.x and JavaScript? HTTP PUT请求的格式是什么? - What is the format of a HTTP PUT request?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM