Uri uri = Uri.parse("facebook:/post/hello");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
当我点击按钮时,我想发布在我的Facebook墙上。但上面的代码只是打开了我的墙。我点击按钮时想张贴在墙上。请帮帮我。
答案 0 :(得分:0)
Facebook团队现在推荐使用提要对话框,如果您对Facebook上发布的内容有额外的对话框,则可以使用此方法。但请确保我们已获得所有许可,并获得facebook api许可和sdk。
private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("name", "Product shared from Bee2buy");
params.putString("caption",
appPref.getData("share_title"));
params.putString("link", "http://www.saznaitsols.com/site_uploads/product/"
+ appPref.getData("share_img"));
params.putString("picture",
"http://www.saznaitsols.com/site_uploads/product/"
+ appPref.getData("share_img"));
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(
ShareData.this, currentSession, 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(ShareData.this,
"Posted story, id: " + postId,
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(
ShareData.this
.getApplicationContext(),
"Publish cancelled", Toast.LENGTH_SHORT)
.show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(
ShareData.this.getApplicationContext(),
"Publish cancelled", Toast.LENGTH_SHORT)
.show();
} else {
// Generic, ex: network error
Toast.makeText(
ShareData.this.getApplicationContext(),
"Error posting story", Toast.LENGTH_SHORT)
.show();
}
}
}).build();
feedDialog.show();
}
这可能会有助facebook share on wall