I am having an issue that is causing nullPointerException in onActivityResult, when using facebook login.
this is the call to loginWithFacebookSdk. at this point mCallbackManager is initialized:
Backendless.UserService.loginWithFacebookSdk(activity, facebookFieldMappings, permissions,
mCallbackManager, new AsyncCallback<BackendlessUser>() {
then, when getting to onActivity after the user trying to log in with facebook, there is a NullPointerException. I can see in debug mode that mCallbackManager has now become null.@Override
public void onActivityResult( int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}Thank you for your help.
Tal
Since mCallbackManager is defined in your code and we have no access to your activity, I cannot see how it could be null-ed out by us. Have you checked if perhaps it is reset somewhere in your code?
You are right, now I see why the callbackManager becomes null.
for some reason the activity’s onCreate() method is being called after the user approves the facebook login.
so it’s a new activity class, and therefore the variables are empty.
I’ve tried setting android:launchMode=“singleInstance” in the manifest, but it prevented the facebook activity from being opened.
alright! I found the problem!
in Settings->Developer option -> “Do not keep activities” needs to be unchecked.
this is what made the activity act weird