Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public static void printHashKey (Context pContext){
  2. try {
  3. PackageInfo info = pContext.getPackageManager().getPackageInfo(pContext.getPackageName(),
  4. PackageManager.GET_SIGNATURES);
  5. for (Signature signature : info.signatures) {
  6. MessageDigest md = MessageDigest.getInstance("SHA");
  7. md.update(signature.toByteArray());
  8. String hashKey = new String(Base64.encode(md.digest(), 0));
  9. }
  10. } catch (PackageManager.NameNotFoundException e) {
  11. e.printStackTrace();
  12. } catch (NoSuchAlgorithmException e) {
  13. e.printStackTrace();
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement