Facebook在android中发布检索

时间:2013-01-23 01:50:29

标签: android facebook post feed

我试图通过使用下面给出的代码在我的Android应用程序中检索Facebook的最新帖子。但它只给我我的分享和评论。我希望得到这些以及我在我的状态上发布的消息,但它总是为空。

Bundle params = new Bundle();
params.putString("format", "json");
params.putString("access_token",sp.getString("access_token",null));
String url = "https://graph.facebook.com/me/feed";
String response = Util.openUrl(url, "GET", params);
JSONObject json = Util.parseJson(response);
JSONArray jsonArray = json.optJSONArray("data");

if(jsonArray != null) {
i=0;
String tempName = jsonArray.getJSONObject(i).getString("from");
String tempId = jsonArray.getJSONObject(i).getString("id");
String story = jsonArray.getJSONObject(i).getString("story");
String msg = jsonArray.getJSONObject(i).getString("message");
}

在这里,如果我在我的状态上发布一些文字,那么'msg'也是空的。

请提供您的建议。感谢。

1 个答案:

答案 0 :(得分:0)

您的应用需要拥有" read_stream"您可以访问非公开帖子之前获得许可。请参阅User API reference的“连接”部分,了解其他方法可能需要的其他权限。

您可以先使用Graph API Explorer来试用您的请求。