Facebook login button does not work when clicked

I am using this facebook login setup guide for Android. I have my application configured with keyhash, etc. However, when I click on the login button using the facebook button in my application, none of the callbacks start and the stack trace is not logged.

FacebookSdk.sdkInitialize(getApplicationContext()); mCallbackManager = CallbackManager.Factory.create(); mFacebookLoginButton = (LoginButton)findViewById(R.id.login_button); mFacebookLoginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.e("Login Success", loginResult.getAccessToken().getToken()); Log.e("Login Success", "hello"); } @Override public void onCancel() { Log.e("Login Canceled", "Canceled Facebook Login"); } @Override public void onError(FacebookException exception) { Log.e("Login Error", exception.getMessage()); } }); 

I would expect SOMETHING to be registered when a button is clicked. But nothing happens except for the usual logarithms, for example:

 04-12 13:13:21.759 4813-4813/com.example.myapp I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@43e6de80 time:4181940 04-12 13:13:22.629 4813-4813/com.example.myapp I/ViewRootImpl﹕ ViewRoot Touch Event : ACTION_DOWN 04-12 13:13:22.699 4813-4813/com.example.myapp I/ViewRootImpl﹕ ViewRoot Touch Event : ACTION_UP 04-12 13:13:22.719 4813-4813/com.example.myapp I/ActivityManager﹕ Timeline: Activity_launch_request com.example.myapp time:4182907 04-12 13:13:22.829 4813-4813/com.example.myapp I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@43ded488 time:4183019 04-12 13:13:23.329 4813-4813/com.example.myapp I/ActivityManager﹕ Timeline: Activity_idle id: android.os.BinderProxy@43e6de80 time:4183519 

Any idea why none of the callbacks work?

+6
source share
1 answer

Stupid error, I was missing the onActivityResult method:

 @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); mCallbackManager.onActivityResult(requestCode, resultCode, data); } 
+27
source

Source: https://habr.com/ru/post/985020/


All Articles