Hash android changes constantly?

0

Hello,

I started using facebook api this week, so I sent the application to playstore and got the hash in two ways: at the prompt and programmatically, which I found to be more efficient than prompt.

In the first version Hash was one, now I compiled another version and the login failed, problem was the hash so I got the new one generated by the code

  public static void printHashKey(Context context) {
try {
    final PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
    for (android.content.pm.Signature signature : info.signatures) {
        final MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        final String hashKey = new String(Base64.encode(md.digest(), 0));
        Log.i("AppLog", "key:" + hashKey + "=");
    }
} catch (Exception e) {
    Log.e("AppLog", "error:", e);
}

}

The hash works anyway so it always changes, am I missing something along the way?

    
asked by anonymous 17.11.2018 / 23:51

0 answers