Skip to content

Instantly share code, notes, and snippets.

@alexshr
Last active June 2, 2017 19:56
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 alexshr/a1703a28c5742b5a1996deeab0bf2ad3 to your computer and use it in GitHub Desktop.
Save alexshr/a1703a28c5742b5a1996deeab0bf2ad3 to your computer and use it in GitHub Desktop.
Call it in Activity.onCreate to see facebook debug key hash
/**
* Call it in Activity.onCreate to see facebook debug key hash
*
* @param activity
*/
public static void logFbKeyHash(Activity activity) {
try {
PackageInfo info = activity.getPackageManager().getPackageInfo(
activity.getPackageName(),
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) {
Log.e("logFbKeyHash", "", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment