Extended permission for to post message not working on android

Hi Liam,

Did you ever find resolution to this? I am running into the exact same issue myself. 

Thanks,

Scott

Liam,

See this post. It may shed some light on your issue as well.

https://forums.coronalabs.com/topic/65107-posting-on-facebook-friends-timelinewall-with-v4/

Scott

Hi everyone,

Here’s the last response to the case that Liam had filed, Casenum 46607: GAME INVITE THROUGH FACEBOOK ON IOS, posted here for everyone’s convenience.

"From a comment on this Facebook bug: https://developers.facebook.com/bugs/254702704912992/ it looks like they now require you to provide iPhone and iPad Store IDs in the Facebook Developer portal for Game Requests to be received on the other side.

In the Facebook Dev Portal, you can find fields to enter these store IDs in Settings -> Basic -> iOS.

 

From our own testing, this store ID provided doesn’t even have to be the one associated with your bundle ID. We did a test using the store ID for our Corona Cannon sample and were able to confirm that the Game Request went through."

There are still questions as to whether the requestee has to be a registered test account for your Facebook app however.

Hi All,

Apologise for the delay in responding. 

The above pretty much cover it sorry, I’ve just not had chance though to fully test it to properly confirm as the game its for is not on the actual store at the moment which looks like another part of the condition.

If you simply enter in the app id from iTunes connect it tells you it can’t find it on the store and then when sending invites, again no invite is actually sent.

Once the game is live though (its very close to been live now), I’ll confirm for def that it working ok, though by the sounds of things i definitely think it will.

Cheer all.

Hi Liam,

Am I safe to assume that “publi sh_actions” is a typo, and the code you’re running requests “publish_actions” permission?

Hi Ajay, Thanks you for the message, apologise its a typo in the message. Yeah the code for the app is using the correct version, no space after the i. Kind Regards Liam

Hi All,

Also as well as the problem I’ve encountered with the Android version mentioned above, I can’t seem to get game invites to work on Facebook for either IOS or Android. I make the showDialog requests, it presents me with a list of friends, I select a friend and click send but no notification is sent through to the friend. I’m not getting a event.response or event.error to help with the problem. Does Game Invite work with Facebook v4 or has any encounter a similar issue which they managed to resolve?

Many thanks

Liam

Liam,

If you are using the Facebook friends picker (facebook.showDialog(“friends”, listener)) try looking in “event.data”. I think it returns a list of the users that were chosen. I don’t think there is anything in “event.response”. Also, I think it will have an “event.name” of “friends” but no “event.type”. That is what I am seeing.

Scott

Hi Scott,

Thank you for the message, I’m actually using game request at the moment. Here the code:

  function attributes.facebookListener(event)         if ( "dialog" == event.type ) then             local name = tostring(event.response);             local errorMsg = tostring(event.isError);             native.showAlert( "Friend", "Error check: "..errorMsg.." Response for game invite :"..name, { "OK" });         end   end   facebook.setFBConnectListener(attributes.facebookListener);           attributes.gameInvite = { message = "You should download this game!",filter = "APP\_NON\_USERS",title = " Water Jetters VS Megalodon"}; facebook.showDialog("requests", attributes.gameInvite);

Basically after selecting the friend and hitting send the alert notification comes up with the event.isError, in each instance this has returned as “true” which means there was no problems with the request. Then it comes up with the url of me and the recipient, however the recipent never receives any game invite message.

I’ve check the recipents setting to see if they can receive game invites and they can, I’ve checked and made sure my app is set as game under Category under Settings in the Facebook developer portal. I’m just at a loss as to the reason the invite is not been received, its puzzling?

Kind Regards

Liam   

Sorry, I haven’t used the “requests” function yet but plan to soon. Have you tried looking at the contents of the entire “event” table that is returned in your Facebook listener? That may give you a clue. I use “print_r” from the Corona community code. It is very helpful. It is recursive in that it navigates through all sub-tables no matter how deep they go.

function attributes.facebookListener(event) print\_r(event) if ( "dialog" == event.type ) then local name = tostring(event.response); local errorMsg = tostring(event.isError); native.showAlert( "Friend", "Error check: "..errorMsg.." Response for game invite :"..name, { "OK" }); end end

Hi All,

Thanks you for the email gsglawson. Unfortunately I don’t think I will be able to use print_r in this case. Facebook v4 doesn’t work on the simulator so I can’t make use of the console. There is a very similar way to check for errors by braking down the jason table returned when Facebook calls are made but it seems that we can only do that for  Facebook request methods, showDialog only returns a url which isn’t as helpful. At the moment though the alert is saying that isError is returning false so there is no problem, it then gives me the url of the recipient and of the game requesting to send the invite.

I did wonder if the game still been in development might be the cause? To test this I added another tester account to my Facebook developer account and tried sending a game invite between the two separate tester accounts but still the same problem. The isError returns false and the url at present doesn’t seem to offer an explanation to why the recipient receives nothing.

Could Facebook be considering it as spam and automatically ignoring the invite? What would cause Facebook to consider it to be spam if that is what happening to the invite? It a mystery at the moment to me because it telling all okay but the invite not been received.

Here the actual message sent and then check of the event after

  function attributes.facebookListener(event)         if ( "dialog" == event.type ) then             local response = tostring(event.response);             local errorMsg = tostring(event.isError);             native.showAlert( "Friend", "Error check: "..errorMsg.." Response for game invite :"..response, { "OK" });         end   end   facebook.setFBConnectListener(attributes.facebookListener);           attributes.gameInvite = { message = "You should download this game!",filter = "APP\_NON\_USERS",title = " Water Jetters VS Megalodon"}; facebook.showDialog("requests", attributes.gameInvite);

You are correct, nothing in the console for Facebook while running on the simulator, however, Facebook does return lots of information in  the event table that you do not see.

If it were me, I would go ahead and build the app with the “print_r” function in the code then load this build onto a device (iOS or Android). Then connect my device to my computer to view the results. The Xcode console will show you the results for iOS devices while “adb logcat Corona:v *:s” will do the same for Android devices. I think you will find your answer if you can see the “event” table in its entirety. That is the only way I have been able to figure out issues with Facebook. It is slow and painful to have to create a build after every minor change but until the Facebook plugin can run on the simulator it is all we have.

Hi  gsglawson,

 

Thanks you for the email gsglawson. I’m not familar with linking a app running on a device to the Xcode console?My Xcode knowledge is a little limited sorry gsglawson. I do however use Xcode to load the app onto my iOS phone after a build so the device being used is connected to the computer and the app shows up in Xcode devices if that is of any help towards getting things  set up to use the console? 

 

Many thanks

 

Liam

in Xcode, click on “Window” then “Devices”. Click on your device on the left. If you do not see the output for your device in the bottom right portion of the screen then look for the icon below. Click that icon to open up the console for that device. All your Corona “print” commands along with everything else should be displayed.

icon.png

Hi gsglawson,

Thank you for your email.

I managed to use the Xcode console for the print_r, it came back with the following: 

Jun 29 14:38:04 Pythagoras-2 SafariViewService[797] <Error>: Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>: # ERROR EVENT PRINT CHECK FOR FACEBOOK 

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>: table: 0x1412a6370 {

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>:   [type] => “dialog”

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>:   [name] => “fbconnect”

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>:   [didComplete] => true

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>:   [isError] => false

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>:   [response] => "fbconnect://success?RequestID=13*************7&Recipient=15*************0&Recipient=(

   15*************0

)"

Jun 29 14:38:04 Pythagoras-2 Water Jetters[1711] <Warning>: }

Jun 29 14:38:11 Pythagoras-2 SafariViewService[797] <Error>: Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

Jun 29 14:39:06 Pythagoras-2 syncdefaultsd[1702] <Notice>: (Note ) marked “com.me.keyvalueservice” topic as “enabled” on <APSConnection: 0x144d12e00>

Jun 29 14:39:08 Pythagoras-2 SpringBoard[58] <Warning>: [MPUSystemMediaControls] Disabling lock screen media controls updates for screen turning off.

Jun 29 14:39:08 Pythagoras-2 backboardd[60] <Notice>: [HID] [MT] 

Some of what its returned I’m not entirely sure what the impact or implications are, it has returned a warning [1711] in the print but it does seem to confirm it was sent. I could be wrong though, I also notice it mention something about a service been unavailable?

Jun 29 14:38:04 Pythagoras-2 SafariViewService[797] <Error>: com.apple.WebKit.WebContent: 113: Could not find specified service

It mentions this twice, once before the print_r  and once after. Not sure if they are related, it still seems a bit of a mystery?

Kind Regards

Liam

Below are examples of the event table for my facebook.login command and a facebook.request( “me/friends” ) command I will see if I can setup a test of facebook.showDialog(“requests”, xxx) on my side and see what I get.

------- facebook.login ----------

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: print_r

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: table: 0x1b0c26a0 {

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [type] => “session”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [name] => “fbconnect”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [expiration] => 1472403789

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [phase] => “login”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [token] => “EAAGyQZBFZBZC3IBABtF9YMFGIm9oxreIrTxTrGUlGN1mgGli9znrAAQ3QFySkwQrZCHzw2O7DdmZC66Y6mHZAR8tIAQZBoKrGP4DK2jyATg3nbTpT3m0d3Kq2ZCZB6cS2TC9j8TvIIafLQUvmtZA8BrjTG6GL8Ho7FONGpTeuQdb26y5w9z4eeiwa3ykiG4ZACYQiUZD”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [isError] => false

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [response] => “”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: }

----- facebook.request(“me/friends”) -----

un 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: print_r

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: table: 0x1b0adde0 {

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [isError] => false

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [type] => “request”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [name] => “fbconnect”

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>:   [response] => "{“data”:[{“id”:“10153442260098321”,“name”:“Jennifer Leigh Johnson”},{“id”:“10207439306958476”,“name”:“Thomas Kroger”},{“id”:“1192029117475968”,“name”:“Tammy Conner Freeman”}],“paging”:{“cursors”:{“after”:“QVFIUjR3dUxJTEozRjBuYTYzVDQ4SGdpaXBGcTBfWXhscnczNnhGTkNvZAk9Fa016RTg1MnBIM1V6NHZASOGhXdzdqTzh0MnFGRFgxTnpQTDhrWVUyQlMxRENB”,“before”:“QVFIUklpTFVubFpkRjFWYmRlS04yRFdaWmtVMkZAmQlFtT3gybVptTkYydEdJQlpMb012VWdtb01wZAFBCSXljeXZAoWTYZD”}},“summary”:{“total_count”:400}}"

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: }

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: request

Jun 29 13:03:09 NRC-1st-Floor-Bridge Crackerjack Baseball[2186] <Warning>: event.response = , {“data”:[{“id”:“10153442260098321”,“name”:“Jennifer Leigh Johnson”},{“id”:“10207439306958476”,“name”:“Thomas Kroger”},{“id”:“1192029117475968”,“name”:“Tammy Conner Freeman”}],“paging”:{“cursors”:{“after”:“QVFIUjR3dUxJTEozRjBuYTYzVDQ4SGdpaXBGcTBfWXhscnczNnhGTkNvZAk9Fa016RTg1MnBIM1V6NHZASOGhXdzdqTzh0MnFGRFgxTnpQTDhrWVUyQlMxRENB”,“before”:“QVFIUklpTFVubFpkRjFWYmRlS04yRFdaWmtVMkZAmQlFtT3gybVptTkYydEdJQlpMb012VWdtb01wZAFBCSXljeXZAoWTYZD”}},“summary”:{“total_count”:400}}

Ok, the following code seems to work for me. I get logged in and I am presented with a list of friends who have my app installed. I can choose one, hit “send” and they received the FB message. I also changed the filter to “APP_NON_USERS” and was presented with a list of all my friends who do not have my app installed. However, I did not try sending any of them a message since I did not want to Spam them. 

local facebook = require( "plugin.facebook.v4" ) local util = require("Utility") function facebookListener( event ) print("facebookListener") util:print\_r(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then accessToken = event.token if accessToken == nil then local alert = native.showAlert( "Notification", "Facebook error. Please check your Facebook credentials.", { "OK" } ) else facebook.showDialog( "requests", { message = "You should download this game!", filter = "APP\_USERS" }) end end elseif ( "request" == event.type ) then print( "request" ) elseif ( "dialog" == event.type ) then print( "dialog" ) elseif ( "friends" == event.name ) then print("friends") else print("none of the above", event.type) end end print("start facebook login") facebook.login( facebookListener, {"public\_profile","email","user\_friends"} )

EDIT: Hold the phones! I asked my buddy to send me a screen shot of the message and there wasn’t one there! I think he saw the FB notification light up from someone else and assumed it was from me. I have tried sending to my test account and have the same results as you. It appears to send, there are no errors but I never receive the game request. Unless someone from Corona’s staff thinks otherwise, I think you have found a bug. I would submit a bug report.

Hi gsglawson,

Thank you for the email and for checking that for me. I’ve submitted a bug report to see if they can shed some light on the problem. The fact it doing it for both of us definitely makes it more likely to be a bug issue rather then an implementation issue unfortunately. If they come back with a solution i’ll post it up on here so everyone thats followed the feed knows what the final out come is. Thanks all

Kind Regards

Liam 

Do you have the Case ID for the bug? Can you post it here?

Thanks

Rob

Hi Rob,

The case number is 46607, the title I gave it was GAME INVITE THROUGH FACEBOOK ON IOS.

Thanks Rob.

Kind Regards

Liam