Hi to everyone who recently developed my first Android app that goes into facebook and tries to update status. Without a dialog using a graphical API. The code below is the authorization code (which was on the fbook dev website itself), and it worked fine for me all the time, until recently. Now my application is included in my emulator, but when I export the APK file and put it on my phone, it gives me an “authentication error”. Can someone explain this? It just doesn’t show me the login page anymore after I created a new keystore and hashkey and updated this hash on my facebook application developer page, as usual.
I think this is due to keyhash, etc., but I do not understand what is good enough to understand what happened. I do this, I click on export, the application, then create a new keystore (for the first time, otherwise I will use the existing keystore), then I find my hash key using "keytool exportcert", etc., as shown on fbook dev. Then I enter this hash into the application in my facebook account. But sometimes, even if the keystore password is correct, it says that the "keystore format" is different, although I used it before the same application! Then I need to create a new keystore and export again, and it all hurts! Should there be an easier way?
Can someone explain how hashkey works for Facebook apps?
Thanks in advance!
My authentication code:
public void login() { facebook.authorize(this,new String[] { "email", "read_stream", "publish_stream"}, new DialogListener(){ int fbcheck=0; @Override public void onComplete(Bundle values) { fbcheck=1; facebookauthcheck(fbcheck); } @Override public void onFacebookError(FacebookError error) { fbcheck=0; facebookauthcheck(fbcheck); } @Override public void onError(DialogError e) { fbcheck=0; facebookauthcheck(fbcheck); } @Override public void onCancel() { fbcheck=2; facebookauthcheck(fbcheck); } }); } public void facebookauthcheck(int fbcheck) { if (fbcheck == 0) { Toast.makeText(this, "Authentication Error", Toast.LENGTH_LONG).show(); } else if (fbcheck==1) { Toast.makeText(this, "Authenticated", Toast.LENGTH_LONG).show(); } else Toast.makeText(this, "Authentication Cancelled", Toast.LENGTH_LONG).show(); }
source share