Reputation: 86
The login page for my Android app is looping back when a user tries to login via Facebook. This bug is due to the Facebook sdk requesting permissions. Unfortunately, the permissions are only requested when the app is downloaded from the Google Play store. How can I go about debugging this issue?
Thanks
Upvotes: 0
Views: 61
Reputation: 256
I think you haven't added the key hash of your app in the Facebook console when you generated your Play Store version (which use a different application signing and thus a different key hash).
Add this code to your Main Activity onCreate() method :
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
"com.facebook.samples.hellofacebook",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Generate the play store version of your app and run it on your device.
You should see your key hash in the logcat logs. Simply add the key hash in the Facebook console (Settings > Basic > Key hash), wait a few minutes ant it should now work.
Remove the code from your main activity.
Upvotes: 1