Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

At first I thought this was my app but I get the exact same problem when using any of the FB sample apps.

Take the HelloFacebookSample for example, which gives you a login button and after login shows you your pic and enables you to post status updates.

If I don't have the FB app installed on my phone the login button gives me a web view which i login through and the photo appears in the app and i can make posts. However if the FB app is installed on my phone it brings up a dialog saying the app would like to access you public profile etc. I press OK and..... nothing.

I have found many questions that seem similar but the problem was usually using a debug key as opposed to a release key, but I am running from eclipse so the debug key is still appropriate.

Any ideas?

like image 480
Jake Avatar asked Feb 23 '13 04:02

Jake


People also ask

Why is Facebook login unavailable for an app?

If you see the message –> Feature unavailable: Facebook Login is currently unavailable for this app after clicking the Facebook login icon, it's due to Facebook's Data Use Checkup that Facebook introduced recently.

How do I allow Apps to log into Facebook?

Tap in the top right of Facebook. Scroll down and tap Settings. Go to the Permissions section and tap Apps and Websites. Go to Apps, Websites and Games and tap Edit.

Why is Facebook app not working on Android?

Check for app updates Sometimes, having an older version of an application may cause issues. If problems persist, you want to ensure you're running the latest app version. Head to the Google Play Store (or any app store you use) and check for any available updates.


2 Answers

if there is the default Facebook App is installed in your phone or if you are trying to upload your app on Google Play, then you need a different KeyHash. because, when u developed your FB app you have registered your FB app with a key hash which is created by using the default debug.keystore.

so, now u need a different KeyStore to generate the different KeyHash. u need a signed KeyStore, which u can get by the help of this tutorial , after generating new keystore, generate a key hash and register your FB App with this new key hash. this should work. for generating new KeyHash u can follow this link

like image 115
Shoshi Avatar answered Oct 20 '22 09:10

Shoshi


I found the next line that helped me in the above scenario:

mLoginFacebook.setReadPermissions(Arrays.asList("email"));

it comes right after:

mLoginFacebook = (LoginButton) rootView.findViewById(R.id.authButton);
mLoginFacebook.setFragment(this);

solved all my problems.. Cheers

like image 45
nitzanwe Avatar answered Oct 20 '22 11:10

nitzanwe