问题
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