0
我試圖實現的Facebook登錄到我的Android應用程序如下:https://developers.facebook.com/docs/facebook-login/androidFacebook的登錄不會觸發回調
通過下面的執行,我能Facebook登錄的步驟,登錄成功,但後來的成功回調不執行任何操作:
callbackManager = CallbackManager.Factory.create();
loginButton = (LoginButton) findViewById(R.id.button_facebook_sign_in);
loginButton.setReadPermissions("email");
// Callback registration
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
Toast.makeText(LoginActivity.this, loginResult.getAccessToken().toString(), Toast.LENGTH_SHORT).show();
Log.v("KJA onSuccess", "Facebook Login succeeded");
}
@Override
public void onCancel() {
// App code
Log.v("KJA onCancel", "Cancel called");
}
@Override
public void onError(FacebookException exception) {
// App code
Log.v("KJA onError", exception.toString());
}
});
如何確保回調接收到登錄成功通知?