Hello,
I use to deal with prime 31 plugins to do post message on Facebook.
But never used it for extended request over Facebook.
I read some magical words from the prime 31 documentation as “AccessToken” and “graphRequest” but I have no idea how does it works.
Found related discussion on the forum :
http://forum.unity3d.com/threads/60769-Social-Networking-Plugin-(Facebook-and-Twitter)-live!/page26
Did some research over Facebook and I found the function matching with the friends list : https://developers.facebook.com/docs/reference/rest/friends.get/
It looks good to me since we can do a lot of things.
But I am really far to understand how it is supposed to work under Unity with Prime31 plugins.
Didn’t someone ever made a tutorial or exemple as reference?
Thanks a lot guys!
Hi sama van…
I know how to do it on android but not in IOS
To get access token unity, facebook, prime31 :
Facebook.instance.getAppAccessToken(your_app_id, your_app_secret, getTokenString);
getTokenString is a function. here is the content of the function :
void getTokenString(string token)
{
tokenStr = token; // i save this token to global variable
}
graphRequest : i choose the very simple one graph request on getting current login user id
Facebook.instance.graphRequest(“me?fields=id”, getUserID);
getUserID is a function. here is the content of the function :
void getUserID(string error, object result)
{
var ht = result as IDictionary;
if (ht != null)
{
currentID = ht[“id”].ToString(); //save the id to global variable
}
}
If wanna get a friend list, i think prime31 has already provided a function of that, here is the tutorial
Facebook.instance.getFriends(getFriendID);
getFriendID is a function. here is the content of the function :
void getFriendID(string error, object result)
{
var ht = result as IDictionary;
var ListFriend = ht[“data”] as IList;
for (int a = 0; a < ListFriend.Count; a++)
{
//friendName += “ID[” + a + "] = " + ListFriend.ToString() + “\n”;
var DictList = ListFriend[a] as IDictionary;
if (DictList != null)
{
friendName += “ID[” + a + "] = " + DictList[“id”].ToString() + “\n”; //list all the friend id
}
}
}