誰かが本当に今すぐ簡単に動作するように送信できますか?
私は次に使用しています:
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" />
お願い助けて!
PS Facebook で友人のフィードに送信する機能は現在 (2013 年 2 月以降) ですか?