본문 바로가기
프로그래밍 놀이터/안드로이드, Java

[android] sign key hash key (sha) print out

by 돼지왕 왕돼지 2017. 6. 7.
반응형

 [android] sign key hash key (sha) print out


https://developers.facebook.com/docs/android/getting-started


try {

PackageInfo info = getPackageManager().getPackageInfo("com.example", PackageManager.GET_SIGNATURES);

    for (Signature signature : info.signatures) {

        MessageDigest md = MessageDigest.getInstance("SHA");

        md.update(signature.toByteArray());

        Log.e("ck", "MMM" + Base64.encodeToString(md.digest(), Base64.DEFAULT));

    }

} catch (PackageManager.NameNotFoundException e) {

// exception handling

} catch (NoSuchAlgorithmException e) {

// exception handling

}




반응형

댓글