Facebook integration in Android app

I have included facebook in the android app. Generate the key using debugkeytool, and it works great both on the emulator and on the real device.

Now I need to make an apk release file, and I created a keystore using the android eclipse tool to export the signed application package.

And using this keystore, I created a new hash of keys for facebook and installed it on the facebook developers site. but still I can not post on facebook wall after signing my application with my own created keystore. I checked all the steps to create a keystore, and rightly so.

please help me in this situation.

thanks

0
source share
1 answer

I got the same error, but when I checked the PackageManager hash key , I got another application hash key and updated it on facebook, and it worked for me.

 PackageInfo info;
    try {
        info = getPackageManager().getPackageInfo("com.example.yourpackagename", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md;
            md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            String something = new String(Base64.encode(md.digest(), 0));
            //String something = new String(Base64.encodeBytes(md.digest()));
            Log.e("hash key", something);
        }
    } catch (NameNotFoundException e1) {
        Log.e("name not found", e1.toString());
    } catch (NoSuchAlgorithmException e) {
        Log.e("no such an algorithm", e.toString());
    } catch (Exception e) {
        Log.e("exception", e.toString());
    }

change the name of your package in code. The hash key will be printed in the log. It can help you.

+8
source

All Articles