- Home /
Facebook SDK focus.
Hello,
We are trying to integrate facebook into our Mobile game. We have everything working with the exception of one thing. When sharing posts the facebook wall with FB.Feed we are able to pause everything in the background meaning that while the facbook UI is on screen you can't interact with the game.
However when you press share or cancel we are unable to locate where the facebook scripts are notified that a post has been successful.
What this means is we can pause the game but not resume it. Any help would be appreciated.
Answer by Fir3stormStudio · Apr 16, 2015 at 01:47 AM
So, I found a solution to this if anyone else runs into this issue.
The fix was to use a callback from FBResult. A complete oversight on my behalf when learning about the facbook SDK.
For example I had to set up a function like this.
void LogCallBack(FBResult result)
{
if (result.Error != null)
{
Debug.Log("ERROR IN FEED");
sm.butCover.SetActive (false);
}
else
{
Debug.Log("SUCCESS IN FEED");
sm.butCover.SetActive (false);
}
}
And then at after you call your FB.Feed you use the callback which sends information back regarding the facebook UI (from my understanding)
else
{
sm.butCover.SetActive (true);
FB.Feed (
linkCaption: "", //share with friends at anytime.
picture: "", //http to game icon to be shown on facebook.
linkName: "", //just the name of the link
link: "http://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest"),
callback: LogCallBack
);
So if you press share or cancel it will indicate that the callback was a success.
FYI sm.butCover.SetActive is just a panel that covers the screen which I am turning on or off to block interaction with the game while the FB UI is up on screen.
Your answer
Follow this Question
Related Questions
Facebook share an invite overload error 2 Answers
Facebook SDK Multi-friend-selector 1 Answer
Openssl not found in unity sdk for facebook 6 Answers
Facebook permissions 1 Answer
Multiple Cars not working 1 Answer