我正在facebook android应用程序上工作,但我面临一个问题
我使用以下示例
Android/Java - 将简单文本发布到Facebook墙上?
所以问题是一切都在这里工作正常,对话框等等但当它打开屏幕上传我在这里设置的Walla消息
try
{
System.out.println("*** IN TRY ** ");
Bundle parameters = new Bundle();
parameters.putString("message", "this is a test");// the message to post to the wall
facebookClient.dialog(this, "stream.publish", parameters, this);// "stream.publish" is an API call
}
catch (Exception e)
{
// TODO: handle exception
System.out.println(e.getMessage());
}
Run Code Online (Sandbox Code Playgroud)
它没有显示我在对话框中写的消息.是什么问题
任何人都可以指导我..
非常感谢.
消息已被忽略.你可以在这里阅读:https://developers.facebook.com/docs/reference/dialogs/feed/
该字段将在2011年7月12日被忽略.预填充用户将键入的文本字段的消息.为了符合Facebook平台策略,如果用户在工作流程中先前手动生成内容,则您的应用程序可能只设置此字段.大多数应用程序不应该设置它.
使用这个代码,它对我有用:
Bundle parameters = new Bundle();
parameters.putString("message",sharetext.getText().toString());// the message to post to the wall
//facebookClient.dialog(Jams.this, "stream.publish", parameters, this);// "stream.publish" is an API call
facebookClient.request("me/feed", parameters, "POST");
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你..
Edited:
public class FacebookActivity implements DialogListener
{
private Facebook facebookClient;
private LinearLayout facebookButton;
public FacebookActivity(Context context) {
facebookClient = new Facebook();
// replace APP_API_ID with your own
facebookClient.authorize(Jams.this, APP_API_ID,
new String[] {"publish_stream", "read_stream", "offline_access"}, this);
}
@Override
public void onComplete(Bundle values)
{
if (values.isEmpty())
{
//"skip" clicked ?
}
// if facebookClient.authorize(...) was successful, this runs
// this also runs after successful post
// after posting, "post_id" is added to the values bundle
// I use that to differentiate between a call from
// faceBook.authorize(...) and a call from a successful post
// is there a better way of doing this?
if (!values.containsKey("post_id"))
{
try
{
Bundle parameters = new Bundle();
parameters.putString("message",sharetext.getText().toString());// the
message to post to the wall
//facebookClient.dialog(Jams.this, "stream.publish", parameters,
this);// "stream.publish" is an API call
facebookClient.request("me/feed", parameters, "POST");
sharetext.setText("");
Toast.makeText(Jams.this,"Message posted
successfully.",Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
// TODO: handle exception
// System.out.println(e.getMessage());
}
}
}
@Override
public void onError(DialogError e)
{
return;
}
@Override
public void onFacebookError(FacebookError e)
{
return;
}
@Override
public void onCancel()
{
return;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4709 次 |
| 最近记录: |