Trying to create an android app with Facebook integration, I\'ve gotten to the part in the docs where you have to generate a key hash file, it specifies to run the following
The right key can be obtained from the app itself by adding the following code to toast the proper key hash (in case of Facebook SDK 3.0 onwards, this works)
try {
PackageInfo info = getPackageManager().getPackageInfo("com.package.mypackage", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT);
Log.e("MY KEY HASH:", sign);
Toast.makeText(getApplicationContext(),sign, Toast.LENGTH_LONG).show();
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Replace com.package.mypackage with your package name