Skip to content

Instantly share code, notes, and snippets.

@yishai-glide
Created August 11, 2015 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yishai-glide/3d318548822b838cf3ae to your computer and use it in GitHub Desktop.
Save yishai-glide/3d318548822b838cf3ae to your computer and use it in GitHub Desktop.
// Add code to print out the key hash
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.facebook.samples.hellofacebook",
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 (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment