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

  • SEARCH
  • Home
  • 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 8356323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:09:35+00:00 2026-06-09T10:09:35+00:00

I have a problem with facebook user login in my android application. I want

  • 0

I have a problem with facebook user login in my android application. I want users use their facebook account to login my system but when I click login button facebook native app starts and user enters email and password then native app closes and my app starts again. I dont want to use native app for this login proccess i want to open facebook login pop-up only like the other phones that does not have facebook native app.

How can i do this?
thanks

Edit:

I use the methods below for login

protected void loginToFacebook()
{


    if( !mFacebook.isSessionValid() ) {
        Toast.makeText(mActivity, "logining", Toast.LENGTH_SHORT).show();
        mFacebook.authorize(mActivity,permissions, new LoginDialogListener());
    }
    else { 
        try {
            JSONObject json = Util.parseJson(mFacebook.request("me"));
            String facebookID = json.getString("id");
            String firstName = json.getString("first_name");
            String lastName = json.getString("last_name");
            String email = json.getString("email");
            Toast.makeText(mActivity,  mFacebook.getAccessToken()+email+"-" + firstName + " " + lastName + ". No need to re-authorize.", Toast.LENGTH_SHORT).show();

            appState.mFbToken = mFacebook.getAccessToken();
            appState.mFbEmail = email;
            mFacebookListener.onFacebookLoginSelected();

        }
        catch( Exception error ) {
            Toast.makeText( mActivity, error.toString(), Toast.LENGTH_SHORT).show();
        }
    }

}

For listening the response

public final class LoginDialogListener implements DialogListener {
    public void onComplete(Bundle values) {
        try {
            //The user has logged in, so now you can query and use their Facebook info
            JSONObject json = Util.parseJson(mFacebook.request("me"));
            String facebookID = json.getString("id");
            String firstName = json.getString("first_name");
            String lastName = json.getString("last_name");
            String email = json.getString("email");
            Toast.makeText( mActivity, mFacebook.getAccessToken() +email+"-" +  firstName + " " + lastName + "!", Toast.LENGTH_SHORT).show();
            SessionStore.save(mFacebook, mActivity);

            appState.mFbToken = mFacebook.getAccessToken();
            appState.mFbEmail = email;
            mFacebookListener.onFacebookLoginSelected();


        }
        catch( Exception error ) {
            Toast.makeText( mActivity, error.toString(), Toast.LENGTH_SHORT).show();
        }
    }

    public void onFacebookError(FacebookError error) {
        Toast.makeText( mActivity, "Something went wrong. Please try again.", Toast.LENGTH_LONG).show();
    }

    public void onError(DialogError error) {
        Toast.makeText( mActivity, "Something went wrong. Please try again.", Toast.LENGTH_LONG).show();
    }

    public void onCancel() {
        Toast.makeText( mActivity, "Something went wrong. Please try again.", Toast.LENGTH_LONG).show();
    }
}

If native app starts my dialoglistenner does not work but if web based login pop-up starts my listenner works good.

Any Idea?

  • 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-09T10:09:37+00:00Added an answer on June 9, 2026 at 10:09 am

    Please update below code of your application.

    mFacebook.authorize(mActivity, permissions, Facebook.FORCE_DIALOG_AUTH,
                new LoginDialogListener());
    

    instead of

    mFacebook.authorize(mActivity, permissions, new LoginDialogListener());
    

    And see below link for more information

    Facebook Login Issue

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

Sidebar

Related Questions

I'm having a problem with a user logging in: 1) click facebook login button
I have an application that uses the Facebook SDK for Android to login into
I have problem while loading data into html select when users press or click
I need to implement facebook-connect to a website where users already might have their
I have implemented Facebook Connect with ASP.Net 3.5. My problem is when i click
I have some problem to setup application on facebook, ok what is exactly problems?
I'm using facebook connect to let users login my application easy. It works well,
i have integrated facebook in a web system (facebook login and some social plugins
I have the same problem as outlined here Facebook OAuth login for iframe canvas
I'm trying to build Facebook OAuth into my existing Authlogic login system. I have

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.