Hey
I am developing an app that will checkin the logged in user to a certain place. Below is my code. Please try to help me so I also can publish the whole working code. A lot of people want to make this work inside Corona SDK.
Handler for the GPS to extract the device GPS coordinates needed in the Facebook call
[lua]currentLatitude = 0
currentLongitude = 0
function locationHandler( event )
currentLatitude = event.latitude
currentLongitude = event.longitude
end[/lua]
Start GPS and send event to above handler
[lua]-- start GPS
Runtime:addEventListener( “location”, locationHandler )[/lua]
Facebook login function and fbAPI holds the Facebook App ID
[lua]function fbLogin()
facebook.login( fbAPI, fblistener, { “publish_stream”,“user_checkins”,“publish_checkins” } )
end[/lua]
Below is the actual Facebook listener
[lua]local function fblistener( event )
if ( “session” == event.type ) then
– upon successful login, request list of friends
if ( “login” == event.phase ) then
– This is the Place ID for busiz 181713458519243
facebook.request(“me/checkins”, “POST”, {place=“181713458519243”, coordinates="{latitude:" … currentLatitude … “,longitude:” … currentLongitude … “}”, message=“Checkade in på Busiz i Nyköping och fick gratis kaffe!”, tags=nil})
end
elseif ( “request” == event.type ) then
– event.response is a JSON object from the FB server
local response = event.response
showAlert( response )
end
end[/lua]
I get back some error code from Facebook #160 which states that the coordinates are missing but I believe they are just formatted wrong. Please help me.
I also get some error from Facebook #10000 stating domain error.
Please help! [import]uid: 22737 topic_id: 14752 reply_id: 314752[/import]