Last active
March 22, 2018 02:31
-
-
Save nvtuan305/3aa001cbdcd27cec00a9ab938d92e0d9 to your computer and use it in GitHub Desktop.
Get hash key for app on facebook developers page
This file contains hidden or 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 getHashKey() { | |
try { | |
PackageInfo info = getPackageManager().getPackageInfo("your.package", PackageManager.GET_SIGNATURES); | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
Log.d("Facebook Hash key: ", Base64.encodeToString(md.digest(), Base64.DEFAULT)); | |
} | |
} catch (PackageManager.NameNotFoundException e) { | |
} catch (NoSuchAlgorithmException e) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment