wohhie
6/9/2019 - 2:07 AM

Android Keyhash for Facebook

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();
    }
}