Android 应用程序中的 Facebook 集成 [英] Facebook Integration in Android Application

查看:38
本文介绍了Android 应用程序中的 Facebook 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 android 应用程序中集成了 facebook.使用 debugkeytool 生成密钥,它在模拟器和真实设备上都可以正常工作.

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

现在我必须发布 apk 文件,并且我已经使用 eclipse android 工具创建了密钥库导出已签名的应用程序包.

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

使用这个密钥库,我为 facebook 生成了新的密钥哈希,并将其设置在 facebook 开发人员网站上.但在使用我自己创建的密钥库签署我的应用程序后,我仍然无法在 facebook 墙上发帖.我已经检查了创建密钥库的所有步骤,它是正确的.

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.

谢谢

推荐答案

我遇到了同样的错误,但是当我通过 PackageManager 检查散列键时,我得到了应用程序的不同散列键并更新它在 facebook 上,它对我有用.

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.

这篇关于Android 应用程序中的 Facebook 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆