Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Real problems with Facebook...

Author
Message
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 6th Feb 2017 06:49
Hi all, so I'm trying to share a post to Facebook from within my app and while it DOES work, I can't get it to work the way I want it to...

So I have my Facebook share button, and the first time I press it it comes up with the "log in to facebook" page, and that all works fine - it lets me log in - but then it goes back to the app and I have to press the Facebook share button a second time in order to make the post.

Is there a way that I can make all of that happen with ONE press? I don't want to have to make the user go through the Facebook login process when the app starts so that they can do one-tap shares....
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Feb 2017 10:16
Once the user has authorised your app for Facebook, future logins should be automatic.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 7th Feb 2017 07:46
I'm afraid I'm still running into troubles. Here's my function call for Facebook sharing:



When I call this function, the login process happens quickly (shown in the app by the screen going dark and a little loading spinner pop up) and then the game goes back to normal, as if nothing happened. THEN, once I wait 3 or 4 seconds, the Facebook share dialog comes up and it works fine. The only problem with this is, players are probably going to start tapping the share button again during that 3-4 second gap... This then makes the share dialog come up multiple times...

Is there a way to recognise that the Facebook share dialog is still loading in the background? GetResumed doesn't seem to be identifying it correctly...
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 7th Feb 2017 09:09
Log into facebook when the app starts, during the initial loading like most other apps?
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 7th Feb 2017 09:11
I think what's happening, though, is that the FacebookPostOnMyWall is having a long delay of a few seconds before actually bringing up its window, and that's what's causing the issue... GetResumed() is actually going back to a 1 in the space between activating FacebookPostOnMyWall and it actually showing up.

I could be wrong, though. Rick is 100% correct that once they've approved the game with Facebook, the login process doesn't fire again.
I work full-time making games in AGK2 and DBpro. Living the dream!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Feb 2017 12:18
I've only used it once in an app, but I didn't specifically wait for getresumed to = 1 after doing the postonmywall. Your getresumed check should be happening in your main loop as it could be triggered from more than doing the postonmywall. Does that make sense?

Just take this bit out of your sharetofb function:


RickV
TGC Development Director
24
Years of Service
User Offline
Joined: 27th Apr 2000
Location: United Kingdom
Posted: 7th Feb 2017 13:02
Hi,

Here's a new guide about AppGameKit and Facebook;
https://www.appgamekit.com/documentation/guides/facebook.htm

Does that help?

Rick
Development Director
TGC Team
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 7th Feb 2017 23:13
@CJB if I remove that line the app will hang in that loop, even after the user has finished posting to their wall.

@Rick thanks! I hadn't seen that. I'll definitely give it a look-see! It seems as though a lot of these guides are floating around on the website. Are there plans to link them up to the in-software help files at all?
I work full-time making games in AGK2 and DBpro. Living the dream!
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 8th Feb 2017 06:00
Couldn't get it working as desired, but I did manage to kludge a fix by putting up a "please wait" screen for 2 seconds where the user couldn't do anything. That actually fixes it lol
I work full-time making games in AGK2 and DBpro. Living the dream!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Feb 2017 11:01
Quote: "if I remove that line the app will hang in that loop, even after the user has finished posting to their wall."
I meant remove that entire loop, not just the check for getresumed. Let your program continue after the user has pressed the facebook button. When the post dialogue eventually pops up (if at all - depending on network status), then your program will pause which you can capture with your checking of getresumed in your main loop.

I'd personally add a button animation on the facebook button to show it was pressed.

CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 8th Feb 2017 23:56
I'm not sure you're understanding what was happening, CJB. Once I fire the "posttofacebookwall" command, the app resumes fully again and there is a gap of about 2-3 seconds before the dialog pops up. This is confusing to the player and so they keep tapping on the facebook button. This stacks multiple facebook post requests and they then all happen one after the other.

So I put a forced please wait screen in where they can't press anything and it fixes the issue.
I work full-time making games in AGK2 and DBpro. Living the dream!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 9th Feb 2017 10:45
Got it! Yes, that delay between firing the command and facebook doing its thing is a pain. Similar thing happens with GameCentre commands. Click the Leaderboard and there is a delay before the leaderboard appears.

It would be nice to be have some status commands for these features to give us more control... something like GetFBPostOnMyWallStatus(requestID) where requestID is a unique refernce to when you submit the PostOnMyWall command. It should return something like:
0 - No request submitted
1 - Waiting for facebook to respond
2 - Post in progress (although game would be paused at this point)
3 - Post success
4 - post cancelled by user
-1 - error

and similar for all the commands that incur this type of delay.
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 9th Feb 2017 12:49
Oh man, yeah, I agree. That would be SUPER helpful!
I work full-time making games in AGK2 and DBpro. Living the dream!

Login to post a reply

Server time is: 2024-09-29 23:28:03
Your offset time is: 2024-09-29 23:28:03