How to check in with facebook?

When my app starts it login to facebook with SSO, then later in my app I have a button that I want to send a checkin message to the users facebook.

Do I have to do a login event for every facebook command I do or is it enough to do it when the app starts?

I call this when my check In button is tapped but it does not work, has anyone used checkins with facebook?

function makeCheckin()  
 local checkinTbl = { place = "1234567890",   
 coordinates = {   
 latitude = 12.1234567,   
 longitude = 32.1234567   
 },   
 message = "Checkin with my cool app!"  
 }  
 facebook.request("me/checkin", "POST", checkinTbl)  
  

[import]uid: 65840 topic_id: 28989 reply_id: 328989[/import]

Not sure whether Corona have opened up FB checkins - I’m not 100% on that, but I’m sure somebody will confirm either way. [import]uid: 33275 topic_id: 28989 reply_id: 116676[/import]

I am interested in how to accomplish this as well. Have a business location based app and to check in where you are to help promote using the app to find those locations would be awesome. [import]uid: 18783 topic_id: 28989 reply_id: 116682[/import]

Just read “Checkin object is deprecated in favor of creating a Post with a location attached”.

So how to do a Post with location attached is the new question?

Do I have to make a facebook.login() every time or is it enough to make a…
(I have my user to login right when the app starts with {“publish_stream”} permission)

local tadaSound = audio.loadSound("tada.caf")  
  
function makePost()  
 local messageTable ={ place = "1234567890",   
 coordinates = {   
 latitude = 12.1234567,   
 longitude = 32.1234567   
 },   
 message = "Checkin with my cool app!"  
 }  
  
 facebook.request("me/feed", "POST", messageTable)  
end  
  
function btnListener(event)  
 if event.phase == "release" then  
 local target = event.target;  
 if target.id == "fbBtn" then  
 audio.play(tadaSound)  
 makePost()  
 end  
 end  
 return true  
end  

[import]uid: 65840 topic_id: 28989 reply_id: 116688[/import]

If it is possible then you shouldn’t need to login on multiple times - login once and then send the appropriate Facebook.request as you’re doing. Just not sure whether Corona’s implementation will allow you to send co-ordinates properly.

You’re going to need to wait on somebody from Corona to confirm this. [import]uid: 33275 topic_id: 28989 reply_id: 116701[/import]

Corona uses the standard Facebook Graph API so you need to read the documentation for the features you want to implement using the Corona facebook.request API.

The Checkin Graph API is here: http://developers.facebook.com/docs/reference/api/checkin/

The Post Graph API is here: http://developers.facebook.com/docs/reference/api/user/#posts

It looks like to use the Post API for checkins, you specify a Facebook Page for the location instead of lat/long coordinates.

You don’t need to logon every time if you know that you are already logged in to Facebook (e.g., you have received a valid token during the last log-on session). If you try to call a Request or showDialog API and you are not logged in, you will receive an error in the FBconnect listener.

The event.token and event. expiration paramaters are returned for a log-on event so you know that everything is valid. (The returned Facebook token is stored and used internally by Corona and not something that you can use directly in your Corona app.) [import]uid: 7559 topic_id: 28989 reply_id: 116769[/import]

Thanks Tom,

With the login session in main.lua and calling the

facebook.request("me/feed", "POST", {message = "Hello Facebook from my cool Corona App"})¨  

the message does not get posted to my facebook, I check for an event.isError in my FB listener but it does not return one when login. However, when I press my button to sent the message I get this in the console:

The operation couldn’t be completed. (facebookErrDomain error 10000.)

heres the entire code for the facebook stuff.

main.lua

function facebookListener(event)  
 if event.isError then  
 native.showAlert("Error", event.response, { "Ok", })  
 print(" FB response: " , event.response)  
 else  
 if event.type == "session" and event.phase == "login" then  
  
 elseif event.type == "request" then  
  
 end  
 end  
end  
  
facebook.login("1234567890", facebookListener, {"publish\_stream"})  
  

myfanpage.lua

local tadaSound = audio.loadSound("tada.caf")  
   
function makePost()  
 local messageTable ={   
 --place = "1234567890",   
 message = "Checkin with my cool app!"  
 }  
  
 facebook.request("me/feed", "POST", messageTable)  
end  
   
function btnListener(event)  
 if event.phase == "release" then  
 local target = event.target;  
 if target.id == "fbBtn" then  
 audio.play(tadaSound)  
 makePost()  
 end  
 end  
 return true  
end  

I don’t see what is wrong since I am signed in with FB SSO? [import]uid: 65840 topic_id: 28989 reply_id: 116819[/import]