0

i integrated facebook sdk to my app and all thing is ok in debug mode i could login and get all data from facebook in debug mode but in signed mode i couldnt find the new hashkey , i followed many tutorials but i didnot find the answer these are metheds i followed:

1-try
    {
        PackageInfo info = getPackageManager().getPackageInfo("com.Rapp.app", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures)
        {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
    }
    catch (PackageManager.NameNotFoundException e)
    {

    }
    catch (NoSuchAlgorithmException e)
    {

    }


 2-
       keytool -exportcert -alias androiddebugkey -keystore              
      ~/.android/signedkey.keystore > key.out
       cat key.out | openssl sha1 -binary > key.bin
       cat key.bin | openssl base64
Mina Farid
  • 5,041
  • 4
  • 39
  • 46
  • When you sign your apk, you have the release keystore which can help you get the release key (hash) to add to your Facebook Developer account. Have you submitted your app for review on Facebook? – Eenvincible Jul 17 '16 at 14:00
  • @Eenvincible i have not submit it to facebook !! what is the relation to get signed hash key ? – Mina Farid Jul 17 '16 at 14:12
  • Well, first, if you don't submit, your facebook features won't work when you publish the app – Eenvincible Jul 17 '16 at 16:57
  • Check out my automatic tool here http://stackoverflow.com/a/17732453/2226605. generate a release keystore and drop it in. – Shahar Jul 20 '16 at 09:07

1 Answers1

0

If you have the jks file, then execute this command :

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64

where:

YOUR_RELEASE_KEY_PATH : PATH to your .jks file

and

YOUR_RELEASE_KEY_ALIAS : ALIAS NAME you used for making the release APK.

Stanislav Mekhonoshin
  • 4,276
  • 2
  • 20
  • 25
Sujay Kumar
  • 520
  • 8
  • 19