Android Application Login with Facebook is not working with Facebook App installed

login error: there is an error in logging you into this application facebook android
facebook developer
firebase facebook login android
login with facebook button
facebook login issue android
com facebook-android facebook login
facebook login dialog not showing android
login error facebook android

This code is working well when I uninstalled the Facebook App but didn't work with Facebook App installed. I'm using Facebook SDK 4.0.

This is my code

package com.example.nhp04.gqfood;
import com.facebook.AccessToken;
import com.facebook.AccessTokenTracker;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.Profile;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;



public class Login extends AppCompatActivity implements Animation.AnimationListener {

private String info = "";
private LoginButton loginButton;
private CallbackManager callbackManager;
private AccessTokenTracker tracker;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        callbackManager = CallbackManager.Factory.create();
        setContentView(R.layout.activity_login);
loginButton = (LoginButton)findViewById(R.id.login_button);



loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            AccessToken accessToken = loginResult.getAccessToken();
            Profile profile = Profile.getCurrentProfile();
            info = ("User ID: " + 

    loginResult.getAccessToken().getUserId() + "\n" + "Auth Token: " + loginResult.getAccessToken().getToken());
                }

                @Override
                public void onCancel() {
                    info = ("Login attempt canceled.");
                }

                @Override
                public void onError(FacebookException e) {
                    info = ("Login attempt failed.");
                }
            });
            System.out.println(info);
            tracker = new AccessTokenTracker() {
            @Override
            protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken, AccessToken currentAccessToken) {

            }
        };
        tracker.startTracking();
    }
    }

this function for checking login

public boolean isLoggedIn() {
    AccessToken accessToken = AccessToken.getCurrentAccessToken();
    return accessToken != null;
}

this on Resume and on Stop methods

@Override
protected void onResume() {
    super.onResume();
    if (isLoggedIn()){
        Intent home = new Intent(this, home.class);
        startActivity(home);
    }
}

@Override
protected void onStop() {
    super.onStop();
    tracker.stopTracking();
    finish();
}

And this is my onActivityResult

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        Intent home = new Intent(this, home.class);
        startActivity(home);
    } else {
        Toast.makeText(getApplicationContext(), "Unable to login please check your internet connection",Toast.LENGTH_LONG).show();
    }
}

where is your onActivityResult() code. In onActivityResult() you need to use callbackmanager. User below code:

 @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);

}

above will work both in fragment/activity. Make sure you have

1. facebook app installed on your testing device
2. In facebook developer account check whether you have mentioned 
- correct package name : refer your android project manifestfile.xml

- check that have you mentioned correct launcher class
- Check that you have given correct debug/release hash key

3. Cross check your facebook application id and that mentioned in your manifestfile.xml facebook meta data are same

In your code change below

create you callbackmanager after setContentView(...);

change it to below FacebookSdk.sdkInitialize(getApplicationContext()); AppEventsLogger.activateApp(this); setContentView(R.layout.activity_login); callbackManager = CallbackManager.Factory.create();

Remember if this is with you facebook issue then your problem lies within this dont waste time in searching other thing. Also put log in failure method in callback of facebook sdk.

Post comment if you still have problem

Android Application Login with Facebook is not working with , Check out the bottom of step 4: https://developers.facebook.com/docs/getting-​started/facebook-sdk-for-android/3.0/. If you have not entered your  setting>>account setting>>app>>youer App >> remove. after remove youer app it uninstall your app.and reinstall it and check login with facebook is working or not.


you can remove your app in your facebook app. like you can open facebook app in go setting>>account setting>>app>>youer App >> remove . after remove youer app it uninstall your app .and reinstall it and check login with facebook is working or not.

Android facebook login not working with installed Facebook app , 1. Login. Please log in to Facebook to create apps or register as a developer. Log in to The Facebook Login SDK for Android is a component of the Facebook SDK for Android. Check out a list of common problems and how to resolve them. To make sure you’re always using the latest version of the Facebook app, turn on automatic updates for the app. To do so, open the Google Play Store app and search for Facebook. Once you select it,


Please change your facebook sdk version, after you clean and rebuild your application it will work

Android - Facebook Login, You can use one Facebook app ID in multiple Android apps. Just use the same app ID in another app for login, sharing, and so on. For deep linking and opening​  After several automatic updates yesterday, the Facebook app on my Android phone would no longer get past the "f" logo. It just wouldn't load. I already turned my phone on and off, reinstalled the app, deleted app data, but it really would not work.


if you're getting an error message that looks like this: Error

Invalid key hash. The key hash "...5GAvm/gHi..." does not match any stored key hashes. Configure your app key hashes at https://developers.facebook.com/apps/...55.../

then copy the hash key provided in the error message and replace the old one with it and try again with the Facebook app installed on your device

Facebook Android SDK FAQ & Troubleshooting, In this guide you learn how to add facebook login to your app. In your Android Studio Project, in the Java file called App that extends Application that you to install Parse SDK correctly, otherwise, your facebook login may not work properly​. Tutorial on how to add facebook login to your Android App Introduction. This section explains how you can create an app with user registration using Facebook Login and Parse Server core features through Back4App.


Tutorial on how to add facebook login to your Android App, Bug Report If the Facebook app is installed (enabled) on the Android device, the Login button fails to log the user in on some devices. Facebook Login for Android - Quickstart. The Facebook SDK for Android enables people to sign into your app with Facebook Login. When people log into your app with Facebook they can grant permissions to your app so you can retrieve information or perform actions on Facebook on their behalf.


LoginButton fails if FB app is installed [Android] · Issue #635 , Workplace is a communication tool that connects everyone in your company, even if they're working remotely. Use familiar features like Groups, Chat and Video  Try the following steps if an app installed on your phone has any of these problems: Crashing. Won’t open. Won’t respond. Isn’t working properly. If the app that isn’t working is an Instant App, try these troubleshooting steps instead. After each step, restart your phone to see if it fixed the issue.


Workplace from Facebook, If you're having trouble logging in to Pinterest with Facebook, Google, or Apple, Security; Verify that Pinterest is showing under the apps using your Apple ID. On a samsung galaxy (with facebook app installed) after clicking login, it ask for permissions (faceboook_test wants to access bla bla). Clicked ok, it return to the app page with login false. On a Android 4.2.2 emulator (without facebook app installed) clicking on login crashes the app.