问题
I am trying to tag one friend in my wall post. But this 'tags' parameter isn't working. How can i tag one/more friends? Pls help me. Thank you in advance.
Bundle params = new Bundle();
params.putString("tags", tagged_friends_id);
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(this, Session.getActiveSession(),params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
if (error == null) {
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(MainActivity.this,"Posted story, id: "+postId, Toast.LENGTH_SHORT).show();
}
else {
// User clicked the Cancel button
Toast.makeText(MainActivity.this, "Publish cancelled", Toast.LENGTH_SHORT).show();
}
}
else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(MainActivity.this, "Publish cancelled", Toast.LENGTH_SHORT).show();
}
else {
// Generic, ex: network error
Toast.makeText(MainActivity.this, "Error posting story", Toast.LENGTH_SHORT).show();
}
}
}).build();
feedDialog.show();
回答1:
As Ming have mentioned, you can not tag friends using the Feed Dialog.
The only way to tag friends in a post, is using the Open Graph Concept- Mention Tagging
回答2:
You can tag multiple friends using the "tags" key itself. But the syntax needs to be bit different. The friend ids must be appended in a string separated by comma. There should not be any spaces between the ids.
For eg:
params.putString("tags", "xxxxx1,xxxxx2");
This worked perfectly for me.
回答3:
See the documentation for the supported parameters to the Feed dialog here:
https://developers.facebook.com/docs/reference/dialogs/feed/
The Feed dialog does not support "tags".
来源:https://stackoverflow.com/questions/19144959/how-to-tag-friends-in-a-wall-post-using-facebbok-sdk-in-android