2

I've implemented Facebook for my android app following this guide:

https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

My aim is to get the access_token so that i can connect it with my backend server

Current situation:

  • Application is fully functional when Facebook app is not installed. Facebook SSO is invoked and all will proceed as per normal

  • When Facebook app is installed the native Facebook dialog requesting permissions appears and it subsequently has no more further actions.

enter image description here

Any Facebook experts care to enlighten regarding the matter?

kenwjj
  • 341
  • 1
  • 7
  • 21
  • 1
    see my ans : http://stackoverflow.com/questions/15036956/android-facebook-sample-app-doesnt-login-when-fb-app-installed/15037770#15037770 – Shoshi Mar 04 '13 at 07:39

2 Answers2

2

Ok I got it solved!

It is as Shoshi has mentioned in his comment.

Android Facebook sample app doesn't login when FB app installed

The keyhash of the keystore that signed the android app should be added in the Facebook App console.

So in short:

  1. Export Signed App
  2. Get keyhash from keystore. See Facebook Android Generate Key Hash.
  3. Add the hash value to Facebook app

It might take awhile for FB to register the hash value.

Community
  • 1
  • 1
kenwjj
  • 341
  • 1
  • 7
  • 21
0

The problem can be the hash key that you have uploaded and that i got from the code below were different. try this code this code, get the hash code in the console, update it on the facebook console and it would login perfect. I am posting this so that my fellow developer save some time that i have spent in solving this problem.

try {
PackageInfo info = getPackageManager().getPackageInfo(
      "com.facebook.samples.loginhowto", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures){
       MessageDigest md = MessageDigest.getInstance("SHA");
       md.update(signature.toByteArray());
       Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Nitesh Verma
  • 1,795
  • 4
  • 27
  • 46