我是 Facebook SDK 的新手。我想从 facebook 获取 PostID 和 Message。这是我的安卓代码。
private void Fql() {
String fqlQuery = "SELECT post_id, message FROM stream WHERE source_id='100008169074385' ";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session, "/fql", params, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
MessageBox(response.toString());
}
});
Request.executeBatchAsync(request);
}
但是代码给了我一个异常(exception):“请求此资源需要访问 token ”。 请任何人给我一些解决方案
最佳答案
这可能对你有帮助。
private void Fql() {
String fql = "SELECT link_id, title, summary, url from link WHERE owner = 'YourID'";
Bundle parameters = new Bundle();
parameters.putString("query", fql);
parameters.putString("method", "fql.query");
Session session = Session.getActiveSession();
parameters.putString("access_token", session.getAccessToken());
String response = null;
try {
response = fb.request(parameters);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MessageBox(response);
}
关于Android Fql 查询异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23590646/