Facebook posting on Android

@Rob thank you!

The only suggestion I have at this point is to take the command you’re running to generate the hash key and break it down into it’s three steps.  There are three commands separated by pipe’s ("|"), like:

Command 1 | command 2 | command 3

Run whatever your doing with just the first part and see if you’re getting an error message or some output that is binar.

Then run the first two commands, looking for errors

Make sure you’re buidling Corona SDK with the same keystore you’re using for generating the hash.

Make sure you have the right OpenSSL installed.  There have been several people on windows have installed a different version and it started working for them.

Hi Rob, sorry to ask you with this wrong topic below

local function onSystemEvent( event )
if event.type == “applicationOpen” and event.url then
printURL( event.url )
end
end

dose this work on android yet? and do we have any other way to make thing work like this?

@uysuntray, in the future please either open a new post, or post on appropriate topics.  People will have trouble fining these answers in the future or will be confused about why this problem comes up for a random other issue.  However, there is a filed bug report for this and has been confirmed, however there is no ETA on getting it fixed.

Try GGFacebook its a great library for Facebook.

Glitch is a great library.  If I was developing for iOS.  I used them for android and got the exact same result.  Thanks for the reply though, patso

Hi David.  If you can post without the facebook native app installed, then that pretty much points to the fact that your hashkey is not correct.  I don’t know if you’ve read this tutorial or not, but it should help you solve any authentication issues.

http://coronalabs.com/blog/2013/07/30/understanding-facebook-authentication/

Rob

No. The key hash is correct.  However it looks like its not logging in correctly to Facebook?

I/Corona  (17968): event.name   fbconnect

I/Corona  (17968): event.type:  request

I/Corona  (17968): isError: true

I/Corona  (17968): didComplete: false

any thoughts? I am just using the example code from the api documentation

FWIW, there have been a good 10 threads created in the past 5 days about issues relating to Facebook integration. Most people’s issues have been resolved by checking the Facebook gotchas, and ensuring they are requiring the Facebook plugin in the build.settings file. I don’t know if that’s your problem, but that has been the issue for most folks.

Well technically no, I did not add the Facebook plugin, because I am trying to post using an android device.  Could that really be the issue?

Nope, I suppose not, since you are using Android that shouldn’t be the issue.

I’ve not used social elements in my apps yet (coming soon) so I’m not going to pretend to be an expert. However, there are some good tips in this forum thread. Specifically, ensuring Facebook is logged in on the device in question.

However, it seems like you’re encountering an issue with logging into Facebook itself. Are you using an existing AppID? What does your facebookListener code look like? Are you passing any permissions during login?

Hey I appreciate all the help I can get.  Yeah I created an app ID in Facebook and copied the number into corona.  as far as the listener I am just using the default in the api documentation

local function facebookListener( event )     print( "event.name", event.name )  --"fbconnect"     print( "event.type:", event.type ) --type is either "session", "request", or "dialog"     print( "isError: " .. tostring( event.isError ) )     print( "didComplete: " .. tostring( event.didComplete ) )     --"session" events cover various login/logout events     --"request" events handle calls to various Graph API calls     --"dialog" events are standard popup boxes that can be displayed     if ( "session" == event.type ) then         --options are: "login", "loginFailed", "loginCancelled", or "logout"         if ( "login" == event.phase ) then             local access\_token = event.token             --code for tasks following a successful login         end     elseif ( "request" == event.type ) then         print("facebook request")         if ( not event.isError ) then             local response = json.decode( event.response )             --process response data here         end     elseif ( "dialog" == event.type ) then         print( "dialog", event.response )         --handle dialog results here     end end  

I guess why I seem so aggressive in this forum is that I can open intelliJ throw some garbage code in and start posting to Facebook, I try to do tis in corona and not only do I have to (go here, go there, go here, go there) to find the info. I can’t get it to work.  Again I do appreciate the replies  B)

I’m always happy to help!

I could have sworn I was looking at a bunch of forum posts that in order to test with facebook, you need a previously created appID, rather than one that was just made. Usually I’m good with the forum links, but I can’t find this one.

I understand where you’re coming from. The facebook guide points to appIDs, keystores, key hashes, and issues with the build.settings file for a lot of Android users. I’m not really looking forward to implementing this!

Ok I mis-spoke a little.  The app ID is about two weeks old.  If that is not old enough, man I don’t know…

Found it: http://forums.coronalabs.com/topic/44603-facebook-issues/

I’m sure that’s old enough, but I’d suggest debugging with a pre-existing appID, just to confirm that it actually works.

Facebook is not easy because there are too many things that have to be right on their end, and things have to be right on our end and the behavior changes based on the presence of absence of the native app on the device (and now on iOS if they are using the built in Facebook support.)

I would suggest posting a screen shot of your Facebook app setup screen, your build.settings, the screen shot of the Corona SDK Build screen just before you click on the build button, and the facebook related code in your main.lua and let us see if we can spot something.

Though 99 times out of 100, its a keyhash problem with Facebook clearly stating it in the console log when you run adb logcat

without any other parameters.  One of the biggest frustrations is there are different versions of OpenSSL that can be used to generate the keyhash.

Part of the problem with keyhashes too is the fact that you’re asked to execute a pipeline of commands (there are three chained together) and if any of those outputs an error like an Invalid password, it will still give you what looks like a valid keyhash in the end.  The next problem is people just cut and paste the command line commands and execute them without adjusting them for their system.  For instance if you follow Google’s docs, it has you use a debug keystore from some random folder on your computer.  If you build with a debug keystore that Corona Uses, it’s a different debug keystore and your output keyhash won’t work. 

Rob

Actually I built the app using OSX mavs.  Now when I get the key hash I am using from coronas debug keystore that is found in the corona sdk folder. (Im not in front of my mac atm I will be in a day or two).  should I not be using that keystore?  However, no where in my adb logcat am I getting any key hash problems.  Just what I posted above.

I will get some examples posted up soon.  I would like to get this resolved finally, mainly because my subscription is up and I have been on the fence if I want to renew or not.  This would definitely help in that decision.  I have a real love / hate relationship with this platform.

Personally, I would use a release keystore instead of the Debug one. It’s just one less thing you have to change when you launch your app. 

Can you dump your event.response value?  There may be more information there.

Sorry to jump in, but I released my Google Play version of Feather without the ‘share to Facebook’ feature because I read the same as the OP that it’s not working and I didn’t bother to try to implement something that was supposedly broken. Can someone confirm that it actually is? My app simply posts a high score message and screenshot at the user’s request, and it works for Email/text/Twitter using the “social” plugin or native.showPopup function for the iOS and Android devices. I don’t do any complicated setup on http://developers.facebook.com with the App ID/Secret, etc., just post to Wall and go.

logged in remotely to see what my event.response give me.  I get this:

com.facebook.FacebookException: Session provided to a Request  in un-opened state.