Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use for SDK : KeyHash
try {
PackageInfo info = getPackageManager().getPackageInfo("myandroid.package.name", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
DebugLogger.d("==============================");
DebugLogger.d("KeyHash:" + Base64.encodeToString(md.digest(), Base64.DEFAULT));
DebugLogger.d("==============================");
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.