我正在开发一个Android应用程序,并希望将Facebook纳入其中。我有一个App ID,Facebook库已添加到我的项目中。我想从我的NewsFeed中检索帖子,该帖子说我的一位朋友上传了新照片。我可以通过我的移动Facebook应用程序和我的PC上的网络在我的NewsFeed中看到该帖子,但是当我尝试使用以下相关代码恢复字符串时:
private static final String[] PERMS = new String[] {"user_events", "friends_events", "user_photos", "friends_photos", "friends_activities", "friends_videos",
"email", "publish_stream", "read_stream"};
private Facebook mFacebook;
private AsyncFacebookRunner mAsyncRunner;
.........
mFacebook = new Facebook(APP_ID);
mAsyncRunner = new AsyncFacebookRunner(mFacebook);
.........
mFacebook.authorize(this, PERMS, new DialogListener()
{
.........
}
.........
{
mAsyncRunner.request("me/home", new UserNewsFeedListener(), "newsfeedForPhotos");
}
然后我在UserNewsFeedListener()的onComplete()方法中打印生成的响应字符串。我收到了我在墙上发布的所有帖子以及我朋友在墙上发布的帖子,这些帖子出现在新闻源中,但显示我朋友上传的图片的帖子没有显示在生成的响应字符串中。
我也尝试过使用FQL但是得到了相同的结果。请帮忙。难道我做错了什么?我可以获取此帖子信息,然后用它来获取我朋友的照片吗?
任何帮助将不胜感激。感谢。
答案 0 :(得分:0)
你正在做正确的事,照片帖应该出现。我刚刚使用me / home图形路径在我的示例应用程序上测试了它,它正确显示了我朋友上传的照片:
{
"id": "100001742041368_187606011307466",
"from": {
"name": "Vikas Fbone",
"id": "100001742041368"
},
"picture": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/300204_187605997974134_100001742041368_424627_3637528_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=187605997974134&set=a.121410007927067.19689.100001742041368&type=1",
"name": "Wall Photos",
"icon": "https://s-static.ak.facebook.com/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100001742041368/posts/187606011307466"
},
{
"name": "Like",
"link": "https://www.facebook.com/100001742041368/posts/187606011307466"
}
],
"type": "photo",
"object_id": "187605997974134",
"created_time": "2011-08-29T20:58:24+0000",
"updated_time": "2011-08-29T20:58:24+0000",
"comments": {
"count": 0
}
},
{
"id": "100001742041368_187605864640814",
"from": {
"name": "Vikas Fbone",
"id": "100001742041368"
},
"picture": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/311649_187605844640816_100001742041368_424626_663667_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=187605844640816&set=a.121410007927067.19689.100001742041368&type=1",
"name": "Wall Photos",
"icon": "https://s-static.ak.facebook.com/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/100001742041368/posts/187605864640814"
},
{
"name": "Like",
"link": "https://www.facebook.com/100001742041368/posts/187605864640814"
}
],
"type": "photo",
"object_id": "187605844640816",
"created_time": "2011-08-29T20:58:07+0000",
"updated_time": "2011-08-29T20:58:07+0000",
"comments": {
"count": 0
}
},
你看到同一个朋友的其他帖子了吗?如果没有,他可能会阻止访问Facebook平台,他的任何帖子都不会显示。可以通过访问帐户 - >隐私设置 - >编辑您的设置(位于右下方的应用和网站) - >您看到的应用 - 启用所有平台来启用该平台。