1

I am trying to implement LinkedIn login through my android application. I had gone through all the tutorial to create LinkedIn developer console project. But when I run the project I got stuck in key hash issue. I had put debug key ,also I have put release key in LinkedIn developer console with proper app package name but still I am getting this below error.

"either bundle id or package name / hash are invalid, unknown, malformed"

I had searched for this issue but still not getting resolved.

Please help if you can.

Shruti
  • 803
  • 9
  • 26

1 Answers1

0

Recently we are working on linked in integration(Android) and we face the same issue. We tried generating hash using mac terminal but same error. Finally we got code to generate hash and its solve this proble. Just write below method in you project and call it anywhere. It will generate the hash , use this hash in linked in developer portal.

private void generateHashKey() {

    try {
        PackageInfo info = getPackageManager().getPackageInfo("com.mypackagename",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            String hash = Base64.encodeToString(md.digest(), Base64.DEFAULT);
            Log.e("KeyHashAsh:", hash);
            // Toast.makeText(this, "Hash Key"+Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_SHORT).show();
        }
    } catch (PackageManager.NameNotFoundException | NoSuchAlgorithmException e) {
    }

}