Created
August 8, 2019 06:45
-
-
Save buildbro/74cfd62d2c8b17b5520eba5344504af8 to your computer and use it in GitHub Desktop.
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 printKeyHash() { | |
// Add code to print out the key hash | |
try { | |
PackageInfo info = getPackageManager().getPackageInfo("com.buildbrothers.wtmapp", 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 (PackageManager.NameNotFoundException e) { | |
Log.e("KeyHash:", e.toString()); | |
} catch (NoSuchAlgorithmException e) { | |
Log.e("KeyHash:", e.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment