I have tried
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
And I get a keyhash 1knQ67Fx4PUOYXggSe+mnzqaTL8=.
But google's own documentation suggests an alternative too.
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.facebook.samples.hellofacebook",
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) {
}
But this yields UR02fNgzyMOjpWCxUnjGZ4ctF6Y=. I have doubly verified that and I get these two values consistently with the respective approaches.
Why are they different? And which one should I register at developers.facebook.com? The documentation is not very clear it seems.
Edit:
As Offbeatmammal says I can register multiple keys at facebook site. So that's ok. But I should also specify the keyhash in application manifest file. So additionally asking: which one should I use there in the application? I can of course try it but an answer would be welcome as well.