Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had the same issue. </p> <p>One call is coming from UiLifecycleHelper when it invokes the callback:<br></p> <pre><code>UiLifecycleHelper callback onSessionStateChange() </code></pre> <p>The other comes from Activity resuming the LoginFragment.</p> <pre><code>LoginActivity.onResumeFragments() LoginFragment.onResume() onSessionStateChange() </code></pre> <p>In many cases, this is fine, but in your case it's obviously a problem due to the AsyncTask.</p> <p>You can cache the session received in onSessionStateChange() and see if its state and tokenInfo changed, and only then invoke your async task. Checking the combination of session state and tokenInfo should suffice:</p> <pre><code>private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (state.isOpened()) { if (mSession == null || isSessionChanged(session)) { mSession = session; LogUtils.LOGFB(TAG, "Logged in using facebook"); LogUtils.LOGFB(TAG, "Access Token: " + session.getAccessToken()); // Run your AsyncTask } } else if (state.isClosed()) { LogUtils.LOGFB(TAG, "Logged out from facebook"); // Display your non-authenticated UI } } private boolean isSessionChanged(Session session) { // Check if session state changed if (mSession.getState() != session.getState()) return true; // Check if accessToken changed if (mSession.getAccessToken() != null) { if (!mSession.getAccessToken().equals(session.getAccessToken())) return true; } else if (session.getAccessToken() != null) { return true; } // Nothing changed return false; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload