I'm using Android and facebook-connect to have a simple app which posts to the user's wall. The authentication system appears to work fine if the official Facebook app is not installed - it opens a webview, the user logs in and the app works from then on. However, if the user has the official app installed, the authentication code opens a white screen with the blue facebook banner at the top, with a loading popup dialog. This runs for about a second and then it goes straight back to my app. However, no permissions or login screen was ever shown, as is in the examples. Nor did the app ever receive an access token. Does anyone know what is wrong? My login code follows:
public void authFb(){
if(!facebook.isSessionValid()) {
facebook.authorize(this, new String[] {"publish_stream", "offline_access"}, new DialogListener() {
@Override
public void onComplete(Bundle values) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putString("access_token", facebook.getAccessToken());
editor.putLong("access_expires", facebook.getAccessExpires());
editor.commit();
}
@Override
public void onFacebookError(FacebookError error) {}
@Override
public void onError(DialogError e) {}
@Override
public void onCancel() {}
});
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
}
The 'facebook' variable is just a Facebook(HASH) object.