views:

370

answers:

2

Hello i am using the android code to connect facebook but getting "Facebook Server Error + 104 - Incorrect signature" exception at the place of onLoginSuccess function. code is given bellow ....

public class FacebookConnection extends Activity implements LoginListener {

private FBRocket fbRocket;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // You need to put in your Facebook API key here:
    fbRocket = new FBRocket(this, "test", "e2c8deda78b007466c54f48e6359e02e");


    // Determine whether there exists a previously-saved Facebook:
    if (fbRocket.existsSavedFacebook()) {
        String str =fbRocket.getAPIKey();
        Log.e("Api key", str);
        fbRocket.loadFacebook();


     } else {
        fbRocket.login(R.layout.main);
        String str =fbRocket.getAPIKey();
        Log.e("Api key", str);
    }

}

public void onLoginFail() {
    fbRocket.displayToast("Login failed!");
    fbRocket.login(R.layout.main);
}

public void onLoginSuccess(Facebook facebook) {
    fbRocket.displayToast("Login success!******************");

    // Set the logged-in user's status:
    try {

        facebook.setStatus("I am using Facebook -- it's great!");

        String uid = facebook.getFriendUIDs().get(0); // Just get the uid of the first friend returned...
        fbRocket.displayDialog("Friend's name: " + facebook.getFriend(uid).name); // ... and retrieve this friend's name.

    } catch (ServerErrorException e) {
        // Check if the exception was caused by not being logged-in:
        if (e.notLoggedIn()) {
            // ...if it was, then login again:
            fbRocket.login(R.layout.main);
        } else {
            System.out.println(e);
            e.printStackTrace();
        }
    }
}
A: 

Hi, I've had many problems using FBRocket because of there's not many documentation about it.

Try editing your Facebook app in your Facebook Site as a "Desktop App" not as a "Web app". You have to go to "Advanced" -> Application type

kyosen
A: 

I had the exact same problem, though at a different place. After doing a fair amount of digging, I found that the call to fbRocket.loadFacebook() was the culprit. I can't get that method to work, even if I do a facebook.save() to save the session to disk after a manual login. All I can think is that fbRocket.loadFacebook() does not work properly and you should always use fbRocket.login(). That is what I have to do in my app. I also couldn't get it to work with the sample code on the FBRocket website. Hope that helps.

Chuck

Chuck C.