有人真的可以发送真的很简单吗?
我正在使用下一个:
1)在app中进行授权
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
但是,频道Feed中的消息不会出现。 没有.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" />
请帮帮我!
P.S。现在在facebook工作时发送给朋友的饲料(2013年2月之后)?