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:
Best way is to generate Key-Hash using code:
public static void generateKeyHash(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
"com.example.user2.testapp",
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 (PackageManager.NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}
call this method once and generate key-hash, enjoy