【发布时间】:2013-03-06 16:24:36
【问题描述】:
有人可以发送 REALLY working NOW simple 吗?
我用下一个:
1) 在应用中进行授权
2) 然后按下按钮 publishFeedDialog();
private void publishFeedDialog() {
Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for And0roid makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android");
params.putString("picture", "");
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(activity,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
Log.e("TAG",values.toString());
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(activity,
"Posted story, id: "+postId,
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(activity.getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(activity.getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(activity.getApplicationContext(),
"Error posting story",
Toast.LENGTH_SHORT).show();
}
}
})
.setFrom("")
.setTo(userId)
.build();
feedDialog.show();
}
当我发送消息时,我看到我的朋友当前已从 Id 中识别出来。
我收到类似的东西:
Webview loading URL: https://m.facebook.com/dialog/feed
Redirect URL: fbconnect://success?post_id=1266196038_167455066740536
但是没有出现朋友提要中的消息。 没有 .setTo(userId) 的代码照常发送给我。
授权我使用
List<String> permission = new ArrayList<String>();
permission.add("publish_actions");
permission.add("publish_stream");
并在清单中写入 app_id。
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/app_id" />
请帮帮我!
附:现在(2013 年 2 月之后)是否可以在 facebook 上发送给朋友的提要?
【问题讨论】:
-
picture的网址在哪里? -
你也应该避免
.setFrom("") -
它不会改变任何东西,相信我。我之前尝试不使用“.setFrom”(所有者消息=id 只有我的 auth fb 帐户)& 有图片但结果 = 什么都没有。 =))
-
对 Facebook SDK 的
WebDialog类进行了更改吗?上面代码中图片的链接在哪里?
标签: android facebook feed facebook-android-sdk friend