situation:

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

 

solution: 開啟Facebook 應用程式開發頁面,將新產生的HashKey填入,儲存即可。

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


將下面code 貼到檔案中,在onCreate()中呼叫printHashKey() method.

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) {

        }

    }

 

如圖:
{###_merci0212/4/1641334545.jpg_###}




reference:http://stackoverflow.com/questions/14486377/android-facebook-api-exception-remote-app-id-does-not-match-stored-id

arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()