Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7917873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:18:14+00:00 2026-06-03T15:18:14+00:00

I’m completely flabbergasted by the Facebook SDK for Android–it’s quite challenging to use effectively.

  • 0

I’m completely flabbergasted by the Facebook SDK for Android–it’s quite challenging to use effectively. As I understand it, these are the rules for single sign on:

  • If a user has the Facebook app and logs into a third-party app using the SDK, the Facebook app is logged in as well
  • If the user logs out of the third-party app using the SDK, the Facebook app is still signed in (probably for the best)
  • If the user logs out of the Facebook app, the third-party app using the SDK is unaffected

Is there a way, in an Android app using the Facebook SDK, to check and see if the official Facebook app is NOT signed into the same account the Android app is using, and if that is the case, sign out of the Android app… in other words, if you go into the Facebook app and sign out, then go to the third-party app, it will be logged out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:18:16+00:00Added an answer on June 3, 2026 at 3:18 pm

    Updated answer

    Is there a way, in an Android app using the Facebook SDK, to check and see if the official Facebook app is NOT signed into the same account the Android app is using, and if that is the case, sign out of the Android app…

    If I understand this right, you’re asking if we can:

    • From your app, check if the official android app is installed
    • if it is installed, check if it is signed into same account as your app
    • if the official app is not signed into your account, sign out your app

    Short answer: No, but you can, by writing your own Facebook class

    • Check if the offical FB app isn’t installed OR is in logged out state OR is logged into another account.
    • If either is the case, force your app to show login dialog.

    Long answer:

    Single Single On(SSO) is handled in the Facebook class in the Facebook Android SDK. The Facebook class API doesn’t have methods that let you access or modify the SSO process.

    In the Facebook class, there are four overloaded public authorize methods. Three of them call the fourth:

    public void authorize(Activity activity, String[] permissions,
            int activityCode, final DialogListener listener)
    

    Here, the SSO process starts. It checks for SSO like so:

     // Prefer single sign-on, where available.
        if (activityCode >= 0) {
            singleSignOnStarted = startSingleSignOn(activity, mAppId,
                    permissions, activityCode);
        }
        // Otherwise fall back to traditional dialog.
        if (!singleSignOnStarted) {
            startDialogAuth(activity, permissions);
        }
    

    The private startSingleSignOn method checks if the official Facebook app can manage the Auth process:

    private boolean startSingleSignOn(Activity activity, String applicationId,
            String[] permissions, int activityCode) {
        boolean didSucceed = true;
        Intent intent = new Intent();
    
        intent.setClassName("com.facebook.katana",
                "com.facebook.katana.ProxyAuth");
        intent.putExtra("client_id", applicationId);
        if (permissions.length > 0) {
            intent.putExtra("scope", TextUtils.join(",", permissions));
        }
    
        // Verify that the application whose package name is
        // com.facebook.katana.ProxyAuth
        // has the expected FB app signature.
        if (!validateActivityIntent(activity, intent)) {
            return false;
        }
    
        mAuthActivity = activity;
        mAuthPermissions = permissions;
        mAuthActivityCode = activityCode;
        try {
            activity.startActivityForResult(intent, activityCode);
        } catch (ActivityNotFoundException e) {
            didSucceed = false;
        }
    
        return didSucceed;
    }
    

    The method creates an explicit intent for the class ProxyAuth in the package com.facebook.katana, which is the offical Facebook app’s package.
    The method then calls validateActivityIntent with the intent as a parameter. It returns true if the service intent resolution happens successfully and the FB signatures match.

    We don’t have access to the ProxyAuth class source but based on the observed app behaviour you described in your question and comments, it seems that ProxyAuth only completes the auth process if the user is logged in on the official app to the same account as on your app. This means that there is no way to distingush – from your app – between 1) the offical FB app not being installed 2)the official FB app not being in a logged in state, and 3) it being logged into another account.

    So you can do this:

    • check if FB app is not installed OR is not logged in OR is logged into another account.
    • If either is the case, log out your app.

    But you can’t

    • verify that the official FB is installed AND is in logged out state.
    • verify that the official FB app is installed AND is logged into another account.

    If what you can do as per above meets your needs to trigger a sign-out, you need to write your own custom Facebook class to add the new logic. The Facebook class in the Facebook Android SDK doesn’t extend an abstract class, only Object implicitly, so you need to replicate the Facebook code into your CustomFacebook class and modify it to add code that forces the log-out.

    For reference:

    Old answer

    I’m not sure this answers your question but to force a user log-out with the Facebook Android SDK, use the FORCE_DIALOG_AUTH flag when you call authorize() during auth/login, like so:

    mFacebook.authorize(this, PERMS, mFacebook.FORCE_DIALOG_AUTH, new LoginDialogListener());
    

    where mFacebook is an instance of the SDK’s Facebook class, and LoginDialogListener implements DialogListener.

    If the user logs out, the login dialog will now appear next time the user wants to login or starts your app.

    If you don’t set the FORCE_DIALOG_AUTH flag the user will be ‘automatically’ logged in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.