Forget trying to familiarize those keytool command options. An easier way is to call a method to output the keyhash of the keystore being used in the app.
This is a method from JavaTechIG. Pretty slick.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
public static String getKeyHash(Context context) { PackageInfo packageInfo; String key = null; try { String packageName = context.getApplicationContext().getPackageName(); packageInfo = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES); for (Signature signature : packageInfo.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); key = new String(Base64.encode(md.digest(), 0)); } } catch (Exception e) { e.printStackTrace(); } return key; } |