Execute event when score is shared successfully on Facebook

Hi,

I want to do an event when the player successfully posts on Facebook using facebook.showDialog. How do I do this?

Currently I’m doing this, but it doesn’t seem to work.

local function onComplete(event ) if(GameSettings.save.scoreShared==false) then GameSettings.save.scoreShared=true DataManager.saveTable(GameSettings.save,"gamesettings.json") end end facebook.showDialog( "feed", {caption="Scored Eggs in EggOh!",description="Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Download this game and beat my score if you can!",link=shareLink,},onComplete)

Thanks,

-Tristan

If I remember correctly, only the dialogs listed in the docs take an onComplete call back. That is “friends” and “places”  other uses of the Facebook showDialog() feature should call back the listener you set when you called facebook.login(). 

Rob

Hi,

Thanks for the answer. So now what I want to know is if Facebook will return something that tells me that my app has successfully posted on the players wall. How do I do this? Where in the listener should I put my code? I tried using the Facebook listener I set up during login but still doesn’t work. Here it is:

local function facebookListener2(event) if(event.type=="session") then if(event.phase=="login") then local shareLink=iTunesLink if(system.getInfo("platformName")=="Android") then shareLink=gPsLink end facebook.showDialog( "feed", {caption="Scored Eggs in EggOh!",description="Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Download this game and beat my score if you can!",link=shareLink,}) end elseif(event.phase=="dialog") then print(event.response) onPostScoreComplete() end end

Thanks,

-Tristan

I would recommend you dissect the Facebook sample project in CoronaSDK/SampleCode/Networking/Facebook to see how it handles calling dialogs and getting results back.

Rob

If I remember correctly, only the dialogs listed in the docs take an onComplete call back. That is “friends” and “places”  other uses of the Facebook showDialog() feature should call back the listener you set when you called facebook.login(). 

Rob

Hi,

Thanks for the answer. So now what I want to know is if Facebook will return something that tells me that my app has successfully posted on the players wall. How do I do this? Where in the listener should I put my code? I tried using the Facebook listener I set up during login but still doesn’t work. Here it is:

local function facebookListener2(event) if(event.type=="session") then if(event.phase=="login") then local shareLink=iTunesLink if(system.getInfo("platformName")=="Android") then shareLink=gPsLink end facebook.showDialog( "feed", {caption="Scored Eggs in EggOh!",description="Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Download this game and beat my score if you can!",link=shareLink,}) end elseif(event.phase=="dialog") then print(event.response) onPostScoreComplete() end end

Thanks,

-Tristan

I would recommend you dissect the Facebook sample project in CoronaSDK/SampleCode/Networking/Facebook to see how it handles calling dialogs and getting results back.

Rob