I can\'t figure out how to get the Key Hash required to use the Facebook Android SDK. I figured out that I can use keytool with these commands:
you can use code below to get the Hash key :
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 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) {
Log.e("name not found", e.toString());
} catch (NoSuchAlgorithmException e) {
Log.e("no such an algorithm", e.toString());
}
Reference :
http://limbaniandroid.blogspot.com/2013/04/how-to-get-hash-key-for-integarte.html