Hey Folks, I just spent a few days trying to get the Corona Facebook sample app (Scrumptious) up and running and I thought I would share a few lessons learned- I was successful, yay! I know you can find all of this in bits and pieces throughout the coronalabs web site, but I will try to pull it all together and make some corrections/clarifications.
Hopefully this will save some of you time. Also, if you are more experienced and you see some error here, please let me know.
But before we get started, just wanted to share some of my setup info, so you can see whether this applies directly to you. I'm using Windows 7 and Corona SDK build 2013.2100 (currently the latest public build). My phone is a Samsung S3 with Android version 4.3 (make sure you upgrade your Android SDK Platform Tools to 1.0.31 if you just upgraded to 4.3). Also, I do have the latest version of the native Facebook app installed on S3.
1) Copy the Corona Scrumptious samples app (found under Networking) to a new folder (always good to have something to fall back on).
2) Go to https://developers.facebook.com/apps to register as a developer and create a new app. Enter your display name, email and enable Sandbox mode (optional, but I recommend it). Click on (select) Native Android App. Enter your package name (just like you did in the Corona Simulator when you went to Build your apk file and enter this for your class name:
3) The next part (key hashes) was rather tricky for me because there was a fair amount of uncertainty from the instructions I read, but I will try to provide you with some certainty here:
a) Download and install openssl from here:
If you are using 64 bit windows, then use the 64 bit version. I've also seen it recommended to use this version even though it's not the latest (and this worked for me):
Place the openssl folders anywhere you like, but you will need to use their path in a minute
c) Find your Corona Labs debug.keystore, I found mine here:
C:\Program Files (x86)\Corona Labs\Corona SDK\Resources
d) Find your Java keytool.exe, I found mine here:
C:\Program Files (x86)\Java\jre7\bin (I believe that jre6 will work, but jre7 definitely did)
e) Open a CMD window and cd (change directory) to the Corona Resources folder, then run this command line (all one line):
keytool -exportcert -alias androiddebugkey -keystore debug.keystore | "C:\Program Files (x86)\openssl\bin\openssl.exe" sha1 -binary | "C:\Program Files (x86)\openssl\bin\openssl.exe" base64
Replace my path to openssl with yours. IMPORTANT: You will be prompted for a password, use android as the password.
f) The result you get will be the key hash you need for Facebook. Copy the whole thing (mine had an equal sign at the end). If you have an equal sign at the end, then you definitely need it. The whole key hash should be 28 characters in length (including equal sign). Paste this sucker where it says Key Hashes in the Facebook Developer portal in the Native Android app section.
4) Select Facebook Login enabled and Deep Linking enabled.
5) Save changes in the Facebook Developer portal. It should say that this may take some time to propagate to all the servers, so we can do a few other things now.
6) Copy the Facebook app ID. If you are prompted to enter app details, you only have to enter some and you do NOT have to click on "Submit App Detail Page." If you must, enter Display Name, Tagline, Description, Detailed Description, Category and User Support Email then submit changes.
7) Open the Corona Simulator (again, I used public build 2100) and your text editor. Open up the build.settings file and replace the X's with your new Facebook app ID. There are two places where you must do this and they are commented.
8) Open up the loginScreen.lua file and replace the X's with your Facebook App ID near the top of the file. Remember, the app ID needs to be a string, so include double quotes around the app ID. I forgot to do this and that is one of the major reasons I'm writing this for you (cost me about 8 hours of time!). You do not need to enter anything for fbCommand (leave it as nil). You do NOT need to use your Facebook app secret (even though the comments indicate you do).
9) Open up mainScreen.lua and paste your Facebook app ID there to replace nil near the top of the file. Again, remember to use double quotes surrounding the app ID. Again, you do NOT need to provide the Facebook app secret. Search for "corona_scrumptious:eat" and replace with "feed". If you don't do this, your post will not show up. I'm sure someone had some intention for the alternative text, but I could not figure it out and posts were not showing up.
10) Go to the Corona Simulator and Build for Android. Browse to where the Corona debug.keystore is located (for me: C:\Program Files (x86)\Corona Labs\Corona SDK\Resources\debug.keystore). Select the Alias Name as andoriddebugkey. Make sure the package name matches whatever you put in the Facebook developer portal for your app.
11) After you build and install on your device, if you want to monitor things, here are a couple of options:
adb logcat Corona:V *:S or
adb logcat if you want to see a lot more info
If you need to be able to search through the log, then:
adb logcat > corona.txt works nicely
12) After all that, I did get the scrumptious app to run. It presented a login button and after it was pressed, it used my native Facebook app for authentication. I then got the scrumptious menu, made my selections, submitted and the post showed up on Facebook. Yay! You might want to go into the mainScreen.lua file and update the latitude and longitude for the places lookup. When you run the app, you do need to type into the textbox that appears if you want places to show up so you can choose one.
Whew! That was a fun way to spend Christmas, but hopefully now you won't have to spend all the time I did. Happy Holidays!