I have created the key hash using the following code:
try {
PackageInfo info = getPackageManager().getPackageInfo("com.snada.main.view",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("Key: ", Base64.encodeToString(md.digest(), 0));
}
} catch (NameNotFoundException e) {
Log.e("Test", e.getMessage());
} catch (NoSuchAlgorithmException e) {
Log.e("Test", e.getMessage());
}
It is generated key successfully. I have copied the key into the facebook developer site. But I am unable to login using facebook.
I am calling facebook using
loginButton.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
@Override
public void onUserInfoFetched(GraphUser user) {
//////////////
/*Session session = Session.getActiveSession();
if (session != null){
session.closeAndClearTokenInformation();
session = null;
Log.i("TAG", "cleared session");
}*/
///////////
SigninView.this.user = user;
isUiUpdateCall = true;
updateUI();
// It's possible that we were waiting for this.user to be populated in order to post a
// status update.
handlePendingAction();
}
});