Created
April 10, 2017 02:13
-
-
Save hu2di/313deee85693b9276674c8bc20ddc262 to your computer and use it in GitHub Desktop.
Generate Key Hash for Facebook SDK android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void getKeyHash() { | |
try { | |
PackageInfo info = getPackageManager().getPackageInfo( | |
"your Application Id", | |
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 (Exception e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment