奇怪的是我正在使用正确的代码与预定义的内容进行对话。但它不起作用:(如果我错了,请指导我,谢谢
代码:
Bundle params = new Bundle();
params.putString("message", "Predef Message");
Facebook facebook = new Facebook("APP_ID");
facebook.dialog(this, "feed", params, new DialogListener(){
@Override
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
}
@Override
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
}
@Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
@Override
public void onCancel() {
return;
}});
答案 0 :(得分:0)
我发现我们无法预定要在墙上发布的消息,请检查此https://developers.facebook.com/docs/reference/androidsdk/dialog/它需要用户互动
在墙上发布消息,共享链接或任何其他需要用户交互的消息。因此,解决方法是共享链接并向其添加描述:)
答案 1 :(得分:0)
试试这个对我有用
public void postfb() {
Log.i("PostFB", "POST FB ENTERED..!!");
Facebook facebook;
// facebook = new Facebook(InfrqncyApplication.APP_ID);
facebook = new Facebook(APP_ID);
// replace APP_API_ID with your own
facebook.authorize(getActivity(), new String[] { "publish_stream",
"offline_access" }, null);
Bundle params = new Bundle();
params.putString("link", imagePostPath);
params.putString("name", etxtTitle.getText().toString().trim());
// params.putString("caption","Via Sharesi.es");
params.putString("description", etxtDescription.getText().toString());
params.putString("picture", imagePostPath);
facebook.dialog(getActivity(), "stream.publish", params,
new DialogListener() {
@Override
public void onComplete(Bundle values) {
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(getActivity(),
"Posted sucessfully !", Toast.LENGTH_SHORT)
.show();
AddPost();
} else {
Log.d("FB Sample App", "Canceled by User");
}
}
@Override
public void onFacebookError(FacebookError error) {
AddPost();
Log.e("fb", "fb error" + error);
}
@Override
public void onError(DialogError e) {
AddPost();
Log.e("fb", "fb dialog error" + e.getLocalizedMessage());
}
@Override
public void onCancel() {
AddPost();
}
});
}