Hi, I am authenticating Facebook using the callback of the AccessTokenTracker class, onCurrentAccessTokenChanged, the problem is that it never runs and I can not access the AccessToken to see the data. I followed the documentation and still after running the method FacebookCallbackManager.onActivityResult (requestCode, resultCode, data); nothing else is executed. The code that I have is within a Fragment and is as follows:
@Override
public void onCreate(Bundle savedInstanceState) {
FacebookSdk.sdkInitialize(this.getContext());
CallbackManager mFacebookCallbackManager = CallbackManager.Factory.create();
AccessTokenTracker mFacebookAccessTokenTracker = new AccessTokenTracker() {
@Override
protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {
// AQUI NO SE EJECUTA NUNCA
}
} };
if (AccessToken.getCurrentAccessToken()!=null)
// NO ENTRA NUNCA
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view;
setHasOptionsMenu(true);
view = inflater.inflate(R.layout.login_layout, container, false);
btnFacebook = (LoginButton)view.findViewById(R.id.sign_conectar_f) ;
btnFacebook.setReadPermissions("public_profile email");
btnFacebook.setFragment(this);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mFacebookCallbackManager.onActivityResult(requestCode, resultCode, data);
}