Android Facebook Api异常 - remote_app_id与存储ID不匹配 [英] Android Facebook Api Exception - remote_app_id does not match stored id

查看:167
本文介绍了Android Facebook Api异常 - remote_app_id与存储ID不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这篇文章的标题中有一个问题。我无法登录

  SessionState currentstate = session.getState(); 

给我一​​个状态 CLOSED_LOGIN_FAILED 。我看了这篇文章, Android Facebook SDK 3.0给出remote_app_id不匹配存储的id登录



我使用密钥工具生成了一个密钥,并将其放在App Dashboard中。但这似乎没有帮助。任何帮助这个赞赏

解决方案

调用以下方法从你的活动的oncreate,它将打印一个哈希键在logcat,添加在Facebook上的应用设置中的哈希字段。再试一次它会工作

  public void printHashKey(){

try {
PackageInfo info = getPackageManager()。getPackageInfo(your.package.name,
PackageManager.GET_SIGNATURES);
(签名签名:info.signatures){
MessageDigest md = MessageDigest.getInstance(SHA);
md.update(signature.toByteArray());
Log.d(TEMPTAGHASH KEY:,
Base64.encodeToString(md.digest(),Base64.DEFAULT));
}
} catch(NameNotFoundException e){

} catch(NoSuchAlgorithmException e){

}

}


I have an issue as said in the title of this post. I am unable to login.

SessionState currentstate =  session.getState();

gives me a state CLOSED_LOGIN_FAILED. I took a look at this post, Android Facebook SDK 3.0 gives "remote_app_id does not match stored id" while logging in

I generated a key using the keytool and put that in the App Dashboard. But that does not seem to help. Any help on this appreciated

解决方案

call this below method from oncreate of your activity , it will print a hash key in logcat, add that into hash field in app setting on Facebook. try again it will work

  public void printHashKey() {

        try {
            PackageInfo info = getPackageManager().getPackageInfo("your.package.name",
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("TEMPTAGHASH KEY:",
                        Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
        } catch (NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }

    }

这篇关于Android Facebook Api异常 - remote_app_id与存储ID不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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