Android Keyhash for Facebook
private void printKeyHash() {
try{
PackageInfo info = getPackageManager().getPackageInfo("com.wohhie.www.drinkshop", PackageManager.GET_SIGNATURES);
for (Signature signature: info.signatures){
MessageDigest messageDigest = MessageDigest.getInstance("SHA");
messageDigest.update(signature.toByteArray());
Log.d("KEYHASH", Base64.encodeToString(messageDigest.digest(), Base64.DEFAULT));
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}