FacebookCallback # onCancel () is called after logging in once in Facebook Sdk 4.2.0 on Android

I successfully logged in to facebook in an Android app. But now, it’s amazing when I log in alone with facebook, and if I try to log in to facebook using the facebook library 4.2.0, it will call its onCancel () method. Help!

+3
source share
2 answers

I solved this problem by calling: LoginManager.getInstance().logOut(); just before trying to log in.

+4
source

I have not tried the above code, but for me it worked, I wrote some code for cancellation in the same way as in case of success

 @Override public void onCancel() { AccessToken token = AccessToken.getCurrentAccessToken(); if (token != null) { GraphRequest request = GraphRequest.newMeRequest( token, new GraphRequest.GraphJSONObjectCallback() { @Override public void onCompleted( JSONObject object, GraphResponse response) { FBObject = response.getJSONObject(); } }); Bundle parameters = new Bundle(); parameters.putString("fields", "id,name,email,gender, birthday"); request.setParameters(parameters); request.executeAsync(); } 
0
source

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


All Articles