我想使用 Graph API 从用户 ID 获取名称,我已经从 SELECT 查询中获得了用户 ID
https://graph.facebook.com/"+id+"?fields=name
我不知道如何调用 http/url 查询并检索数据?
最佳答案
由于您使用的是 Android SDK,因此您可以像这样调用 Graph API-
Bundle params = new Bundle();
params.putString("fields", "name");
final String requestId = {actor-id};
Request request = new Request(session, requestId, params, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
GraphObject graphObject = response.getGraphObject();
FacebookRequestError error = response.getError();
if (graphObject != null) {
if (graphObject.getProperty("id") != null) {
String name = (String)graphObject.getProperty("name");
}
}
}
});
Request.executeAndWait(request);
关于java - android facebook java使用Graph API获取用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22896784/