Android Facebook after build CoronaSDK 2013.1076

@Rob Miracle

You’re right on how the login happens. But here’s what’s the problem in both cases:

Case 1. When it uses the webView, you can ask whatever permissions you want to, because it behaves like authentication on a browser. It works even with a wrong hashkey.

Case 2. When using the native Facebook app, since versio 3.0.1 of the Android sdk you can’t ask for reading and writing permissions at the same time. You can do that with the web authentication, and that’s why case 1 works. But with the native sdk Facebook won’t handle the permissions and ask user about each one.

That’s why this code :

local function getPermissions(event) if(event.type == "session") then facebook.logout() facebook.login( fbAppID, fbListener, {"publish\_stream"}) end end facebook.login( fbAppID, getPermissions)

Works in Case 2, and Case 1 (but the user has to enter his login details twice)

And that’s why this code only works in Case 1:

--without asking reading/basic permissions prior facebook.login( fbAppID, fbListener, {"publish\_stream"})

Hope this makes everything clear on what’s happening here.

Quick question about generating the hash.  Do I need to have my keystore file available for the command line to use when generating the hash? Or is the hash just generated from whatever the name of my keystore is that I enter?  Does the hash thats created have to be entered anywhere else besides the facebook developer apps page?

keytool -exportcert -alias YOUR_APP_ALIAS -keystore YOUR_KEYSTORE.keystore

That command READS your existing keystore and exports the certificate from it.  The | character is called a pipe, it redirects the output from keytool to openssl where it encrypts the certificate using the SHA1 method and  outputs a binary version.  It’s then piped back through openssl a 2nd time to create a Base64 encoded version of the SHA1 hash.

Short answer is yes, it has to be able to read the keystore your app is compiled against.  This is why you have to change YOUR_APP_ALIAS and YOUR_KEYSTORE to the right names, why the password has to be the same one you built the keystore with in the first place.

Also in that form of the command, it’s specifically looking for the keystore in the current folder.  In the window’s example I linked to above, they used a full path to the keystore.  If you are not in the right folder, you have to include the right path to find it.

@Rob,

Thanks thats what I was wondering.  How does it know where the key store file is?!  That makes sense to have it in the same folder. I’ll give that a try.

You have to know where you saved it.  On Mac’s most instructions tell you to store it in a folder named “android” off of your home directory.  On Windows I would have no idea where it put it.  You can use your Start button and put the name of your keystore in the search box and help locate it that way.