我需要的是Feed 对话框。
例子:
private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("name", "New level!");
params.putString("description", "I have reached level " + lvel!");
params.putString("link", "https://play.google.com/store/apps/details?id=com.myapp");
params.putString("picture", "http://myapp.com/Images/icoon.png");
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(this,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error == null) {
// When the story is posted, echo the success
// and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
//Toast.makeText(getActivity(), "Posted story, id: "+postId, Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
//Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
//Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(getApplicationContext(),
"Error sharing app", Toast.LENGTH_SHORT).show();
}
}
})
.build();
feedDialog.show();
}