I have a strange problem when registering using the LoginManager class. I call LoginManager.getInstance().logInWithReadPermissions(..) from the login fragment with the necessary permissions.
I am debugging as much as I can, and found that the callback request code that returns to the onActivityResult parent activity of this fragment is incorrect. The following code fragment belongs to the LoginManager class, which registers a callback for login with some request code.
... CallbackManagerImpl.registerStaticCallback( CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return LoginManager.this.onActivityResult(resultCode, data); } } ); ...
But when it calls onActivityResult activity, it is not CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode() , but something else, like a double. For example, when I tried to debug and check the values, it was something like this:
CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode () = 64206
requestCode received in class Activity = 129742
and now because of this, when callbackManager tries to call onActivityResult, for example
callbackManager.onActivityResult (requestCode, resultCode, data);
with this requestCode he does not find a logincallback from the map to go forward, and he stops right there. I donβt know why this happens when I use ParseFacebookSDK and when I log in using ParseFacebookUtils.logInWithReadPermissionsInBackground(..) , it works fine. Below are the gradle dependencies.
... compile 'com.facebook.android:facebook-android-sdk:4.7.0' compile('com.parse:parse-android:1.13.0') { exclude group: 'com.parse.bolts', module: 'bolts-tasks' } compile 'com.parse:parsefacebookutils-v4-android: 1.10.3@aar ' ...
If you can help, we will be very grateful. Thanks.
UPDATE:
This worked for me when I tried logging into facebook from the parent activity instead of the fragment, this time returned the correct request code in the onActivityResult activity, and it just worked. This solved my problem, but still want to understand the problem with the fragment, so if you know, share your thoughts. Thanks.