I’m trying to use facebook.showDialog() with the “apprequests” dialog. On iOS, I get the response so I can count how many people the user invited. Unfortunately, I get no response when I run the same code on Android on my Nexus 7. Here’s my code (I’ve set up SSO in the build.settings):
local facebook = require("facebook") local json = require("json") local fbAppId = "454571631296931" local function printTable(t) for k,v in pairs(t) do print("key = ", k, ", value = ", v) end end local function fbListener(event) print("\*\*\* fbListener event = ", event) if event.response then print("Got event.response = " .. event.response) end if event.type == "session" then print("\*\*\* got session, requesting dialog...") facebook.showDialog("apprequests", {message = "check out this game, not sure what this link will take you though ..."}) elseif event.type == "request" then elseif event.type == "dialog" then print("\*\*\* got dialog! event = ") printTable(event) end end facebook.login(fbAppId, fbListener, {"publish\_stream"})
After I run the code, the dialog shows up. I select one friend and press “Send”.
My output on iOS is:
Jun 24 07:05:18 Daves-iPhone fbtest[1290] \<Warning\>: \*\*\* fbListener event = table: 0x1d599260 Jun 24 07:05:18 Daves-iPhone fbtest[1290] \<Warning\>: Got event.response = Jun 24 07:05:18 Daves-iPhone fbtest[1290] \<Warning\>: \*\*\* got session, requesting dialog... Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: \*\*\* fbListener event = table: 0x1ed3fae0 Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: Got event.response = fbconnect://success?request=565383560171851&to%5B0%5D=2209182 Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: \*\*\* got dialog! event = Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: key = type , value = dialog Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: key = name , value = fbconnect Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: key = didComplete , value = true Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: key = isError , value = false Jun 24 07:05:33 Daves-iPhone fbtest[1290] \<Warning\>: key = response , value = fbconnect://success?request=565383560171851&to%5B0%5D=2209182
The output on Android (Nexus 7) is:
--I/Corona ( 8559): \*\*\* fbListener event = table: 0x68845628 --I/Corona ( 8559): Got event.response = --I/Corona ( 8559): \*\*\* got session, requesting dialog...
It looks like my fbListener is never called upon the completion of the dialog. Is this a bug or am I missing something? Anyone have any ideas on how I could workaround this?
The reason I need to count how many people get invited is because I allow the user to invite friends instead of paying $0.99 to unlock the next set of levels. This is very important to my app as it gives non-paying users a way to access everything in the app but still gives me some benefit (word of mouth marketing).