Android Fql 查询异常

标签 android facebook

我是 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/

相关文章:

java - android studio 中 facebook api 的 doInBackground() 错误

php - 连接 Facebook 按钮 - 弹出窗口如何工作?

android - 结果不正确 : Formatting ISO-8601 Time And Extract 12 Hour Time

facebook - 将 Facebook Live API 用于我的移动应用程序

android - 以编程方式设置 Android IP、DNS、GATEWAY 设置

android - 应用程序 apk 大小超过 100mb。如何上传到 PlayStore?

android - 读取 Active Wifi 2.4 Ghz RFID 标签 android?

android - Android Studio约束未显示[Android Studio 3.1.3]

android - 如何自定义首选项屏幕主题以使其看起来像那样?

javascript - Facebook 插件无法在内容/模板页面上运行