22 Replies to “How to Integrate Facebook Login In Your Android App using Android Studio”

  1. Yeuni Gilbert

    Good Tutorial,But i have discovered a simple way to generate KeyHash in only one Method.
    Just paste the following method in your Main Activity then can that method,After that run your App get your key hash on Logcat.

    private void printKeyHash() {

    try{

    PackageInfo info=getPackageManager().getPackageInfo("eduka.com.eduka",

    PackageManager.GET_SIGNATURES);//change to your package name

    for(Signature signature:info.signatures){

    MessageDigest md=MessageDigest.getInstance("SHA");

    md.update(signature.toByteArray());

    Log.d("KEYHASH", Base64.encodeToString(md.digest(),Base64.DEFAULT));

    //this is your keyhash
    }

    } catch (PackageManager.NameNotFoundException e) {

    e.printStackTrace();

    } catch (NoSuchAlgorithmException e) {

    e.printStackTrace();

    }

    }

  2. Cristi MC

    Bro, ai have a question. Why i had to write two keys? When I writed "keytool -exportcert -alias androiddebugkey -keystore
    "C:UsersUSERNAME.androiddebug.keystore" | "PATH_TO_OPENSSL_LIBRARYbinopenssl" sha1 -binary | "PATH_TO_OPENSSL_LIBRARYbinopenssl" base64"
    in cmd I received a key, after that I installed the application on the telephon and ai received an error "Invalid key has. The key hash xxxxxxxxxxxxx= does not match any stored key hashes. Configure your app key hashes at https://developers.facebook…….". After i copied xxxxxxxxxx= in Key Hashes the app worked.
    Thank you for video. All the best!

  3. TeSsErAcT GaMiNg

    To all those who are stuck at generating hash function
    Here is a tip :-

    1) for windows users (search below things of google)
    – install Openssl and set up the environment
    – install sdk which generally contains hashkey function and set up the environment

    2) for mac users (search below things of google)
    – install sdk which generally contains hashkey function and set up the environment
    (mac users dont need openssl)

  4. Rohit Singh

    🙄🙄 please use more simplicity for students like us who are eager yo learn but weak in English.
    Your content is good but having few problems is understanding please fix it

Leave a Reply

Your email address will not be published. Required fields are marked *