Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // Add code to print out the key hash
  2. try {
  3. PackageInfo info = getPackageManager().getPackageInfo(
  4. "com.example",
  5. PackageManager.GET_SIGNATURES);
  6. for (Signature signature : info.signatures) {
  7. MessageDigest md = MessageDigest.getInstance("SHA");
  8. md.update(signature.toByteArray());
  9. Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
  10. }
  11. } catch (NameNotFoundException e) {
  12.  
  13. } catch (NoSuchAlgorithmException e) {
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement