Question

Hi I am developing two android app with Facebook Login features.I am getting the key hash by using this following code given by in Facebook doc

try {
    PackageInfo info = getPackageManager().getPackageInfo(
            "com.mypackage.xyzproject", 
            PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
} catch (NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}

I am getting the key hash like 2R9ySOpkkkqSwQW9JuO97YV2mnk= for both the android app.So i am confused whether i will put the same key hash for both the app in Facebook developer account or i am getting the wrong key hash.

My next question is, may i have to generate different key hash for release in play store.

Was it helpful?

Solution

Please use this for generation key hash :

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

NOTE: You have to install openssl

I hope this will help you
Thank you.

EDIT:

If you want to use your keystore then use following :

keytool -exportcert -alias "<your app's alias>" -keystore "Path of Keystore" | openssl sha1 -binary | openssl base64

Try this.

OTHER TIPS

Yes you have to generate 2 key hashes, because you do not sign in with debug.keystore. for the development purpose you need to generate a key hash from your debug.keystore, and to upload it to Google Play you need to generate a keyhash from your release.keystore. then put both hashes in FB app settings

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top