[英]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.