0

I have an app for my University and there i have integrated Facebook SDK so that students can post in Facebook.

Recently i decided to make some more tests because of the new SDK that Facebook released. What i found it was that after the Custom Dialog by Facebook Sdk that appears and gives the user infos about the permissions needed, nothing happens.

That pushed me to search the problem deeper. I opened an Emulator and checked it too, after some errors and minutes i managed to make the SSO work. The same code was supposed to work on my device also, but again the problem described above was happening.

Although i had no luck with it. Then it came to my mind to delete the Facebook app from my Phone and try my app again. The SSO worked fine as in the emulator this time.

So i got stucked with a problem and a result after searching. I am completely sure that there is a problem between the authorization when having the Facebook app installed and my app, but i cant find what.

If anyone else has experienced the same problem please share your thoughts and if anyone knows any solution i would be greatfull!

P.S.: Google didn't help me at all. You are my last chance.

My way to connect with Facebook:

Session session = Session.openActiveSession(act, true,
            new StatusCallback() {
                public void call(final Session session, SessionState state,
                        Exception exception) {
                    if (session.isOpened()) {
                        Log.d("Session is:", " opened");
                        Request.executeMeRequestAsync(session,
                                new Request.GraphUserCallback() {
                                    public void onCompleted(GraphUser user,
                                            Response response) {
                                        if (user != null) {
//my code goes here                                         

                                        }
                                    }
                                });
                    }
                }
            });
4

2 回答 2

1

更新

我终于通过更新keyhash解决了。不知道为什么是这个问题,但现在它工作正常!

于 2013-01-03T19:46:28.383 回答
0

只是为了方便起见,使用此代码查找 ACTUAL keyhash:

PackageInfo info;
try {
info = getPackageManager().getPackageInfo("com.myname.lolo", 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());
}

之后您可以删除此代码。以及所有功劳:Android-Facebook 应用程序的密钥哈希

于 2013-01-11T17:19:48.583 回答