Facebook Integration in Android Application

心已入冬 提交于 2019-11-26 22:25:01

问题


I had integrated facebook in my android application . Generate key using debugkeytool and it works fine on both emulator and real device.

Now i have to make release apk file and i had created keystore using eclipse android tool to export signed application package .

And using this keystore i had generated new key hash for facebook and set it on facebook developers site. but still i am not able to post on facebook wall after signing my app with my own created keystore. I had check all the steps for creating keystore and it is correct.

please help me out of this situation.

Thanks


回答1:


I got the same error but when i checked the hash key by PackageManager i got the different hash key of the application and update 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 your package name in the code. The hash key will be printed in the log. It may help you.



来源:https://stackoverflow.com/questions/16730848/facebook-integration-in-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!