Okey, I\'ve done all the business, followed all the steps, but still can\'t get it to work. The simple Example app that comes with the Facebook SDK, is working on the emulator a
I tried on windows as per your solution using both export and exportcert but it generates same Hash. Application now works as earlier and not using the the new SSO way.
I debugged android FB SDK ,i found the cause but not exact the solution. Don't know why facebook guys implemented SSO this way.
SSO does not work, if you don't have FB app new update installed on your android phone.
In this case, It routes to the regular dialog interface with user name and password.
3.In details, FB Android SDK to handle SSO, is calling an intent com.facebook.katana.ProxyAuth it return true if it update is available.
Hope this will help.
If the keytool command doesn't work for you, I found a way around that stuff: you can just reverse engineer which key to put as Key Hash in the Facebook Developer section. Within your Activity just print out the Key Hash by doing:
try {
PackageInfo info = getPackageManager().getPackageInfo("[your package name, e.g. com.yourcompany.yourapp]", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("Hash Key:", Base64.encode(md.digest()));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
This worked for me. The MessageDigest class is included in the JDK. The Base64 class not. You can use this one for example.
I had a similar problem. For me, it was resolved when I uninstalled the latest update of the Facebook app and now only have the native Facebook app v1.2. (Means, when I go into the market and search for Facebook, the "Facebook for Android" would be displayed as 'not installed' on my device).
On my Nexus One (Android 2.2.1), when I had the latest Facebook app installed, there was not 'uninstall app' buton, only a 'Uninstall latest updates', which is what I did. In fact, I can't even uninstall the entire Facebook (now v1.2) app for whatever reason, the uninstall button is disabled/greyed out. But in this status, the samples seem to work.
At least, I could get the simple and stream app to work this way.
Edit / Solution:
Ok, I got it working now. I found that I copy/pasted the wrong key hash, due to some weird behaviour of keytool under windows and a wrong command syntax in the ReadMe file of the Facebook SDK.
The parameter to be used should be "keytool -export ...
" and not "keytool -exportcert ...
"; if you do use the second/wrong parameter, keytool would still print out a hash key (withouth asking for any key password though), but the hash is wrong.
Now I got SSO working as well.
This is my call on windows:
keytool -export -alias androiddebugkey -keystore "C:\Documents and Settings\myuser\.android\debug.keystore" | openssl sha1 -binary | openssl enc -a -e