我已經實現了一個應用程序,我的用戶可以發佈在他們的Facebook帳戶。 但是當我登錄爲開發者帳戶,然後它的工作,但是當我使用不同的用戶ID,然後在它顯示一個消息「與Facebook驗證失敗!」不能登錄我的Facebook與Android應用程序集成使用不同的用戶ID
btnPostStatus = (Button) findViewById(R.id.postStatus);
edtPost = (EditText)findViewById(R.id.post_text);
btnPostStatus.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
facebook = new Facebook(APP_ID);
restoreCredentials(facebook);
messagePost = edtPost.getText().toString();
if (!facebook.isSessionValid()) {
loginAndPostToWall();
} else {
postToWall(messagePost);
}
}
});
public void loginAndPostToWall() {
facebook.authorize(this, PERMISSIONS, Facebook.FORCE_DIALOG_AUTH,
new LoginDialogListener());
}
public void postToWall(String message) {
Bundle parameters = new Bundle();
parameters.putString("message", message);
parameters.putString("description", "topic share");
try {
facebook.request("me");
String response = facebook.request("me/feed", parameters, "POST");
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("")
|| response.equals("false")) {
showToast("Blank response.");
} else {
showToast("Message posted to your facebook wall!");
}
} catch (Exception e) {
showToast("Failed to post to wall!");
e.printStackTrace();
}
}
Thnx很多,現在工作。 – Kunu