In one of my apps I need to get data from Facebook… I am doing this:

I have created app ID. It logs in successfully, but after logging out, I log in, and then it gives me:

Screenshot of invalid key hash error Facebook

What is wrong I am doing? I am using the Facebook SDK… I have installed Facebook on my phone… It is running well within an emulator, but that does not have the inbuilt Facebook application installed.

This is my code:

if (FB_APP_ID == null) {
    Builder alertBuilder = new Builder(this);
    alertBuilder.setTitle("Warning");
    alertBuilder.setMessage("A Facebook Applicaton ID must be " +
                            "specified before running this example: see App.java");
    alertBuilder.create().show();
}

// Initialize the dispatcher
Dispatcher dispatcher = new Dispatcher(this);
dispatcher.addHandler("login", LoginHandler.class);
dispatcher.addHandler("stream", StreamHandler.class);
dispatcher.addHandler("logout", LogoutHandler.class);

// If a session already exists, render the stream page
// immediately. Otherwise, render the login page.
Session session = Session.restore(this);
if (session != null) {
    dispatcher.runHandler("stream");
}
else {
    dispatcher.runHandler("login");
}

26 Answers
26

Leave a Reply

Your email address will not be published. Required fields are marked *