Facebook SDK feed own Timeline only, not on friend's News Feed

自闭症网瘾萝莉.ら 提交于 2019-12-11 10:08:25

问题


I have some problems understanding Facebooks API. I managed to send feeds (with a "link" and "picture") to my own Time Line, but I want them to appear on my friend's News Feed. Only without using "link" and "picture" it does appear on my friend's News Feed. I am using facebook-android-sdk and facebook-ios-sdk. Here the Android example:

Bundle params = new Bundle();
params.putString("name", "Some name");
params.putString("caption", "Some caption"); 
params.putString("link", "http://www.some-link.com");
params.putString("picture", "http://www.some-link.com/pic.png");
facebook.dialog(this, "feed", params, new FacebookDialogListener(FacebookDialogListener.DIALOG_FEED));

So how can I make a user of my app publish on his friend's News Feed with a "link" and "picture"? Please don't tell me it can't be done, because on my own News Feed I get posts with images from games regularly. How do they do this? Maybe after I posted to my own profile using "link" and "picture", can I share the object through the Facebook API? I get a POST_ID in return to "feed". Can I do something with the POST_ID to make it appear in my friend's News Feed?


回答1:


You can definitely use the Facebook dialog to post to a friend's timeline. Note that posting via the /feed way is going soon but you can still use the dialog.

To post to a friend's timeline, you would add another parameter, "to" and pass the friend id to it:

params.putString("to", "<FRIEND_ID>");
facebook.dialog(this, "feed", params, 
    new FacebookDialogListener(FacebookDialogListener.DIALOG_FEED));



回答2:


@Andrej i am not sure about in android but in iPhone you can do this buy using Graph Path @"user_fb_ID/feed" like this -

[self.facebook requestWithGraphPath:@"123456789/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

I think it will be same there in android also. First of all you need to take out your fb friend's fbID. Here params is a NSDictionary object which has some info for keys like @"message",@"link",@"image",@"name",@"description".



来源:https://stackoverflow.com/questions/13126136/facebook-sdk-feed-own-timeline-only-not-on-friends-news-feed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!