Created
October 4, 2018 11:46
-
-
Save yujuwon/373877318e79d288eccafa0f6b1a472e to your computer and use it in GitHub Desktop.
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
try { | |
PackageInfo info = getPackageManager().getPackageInfo("com.yjw.android.busanbus", PackageManager.GET_SIGNATURES); | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
String str = Base64.encodeToString(md.digest(), Base64.DEFAULT); | |
Log.d("KeyHash:", str); | |
Toast.makeText(this, str, Toast.LENGTH_LONG).show(); | |
} | |
}catch(NoSuchAlgorithmException e){ | |
e.printStackTrace(); | |
}catch (PackageManager.NameNotFoundException e){ | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment