How can i get rank of facebook user among their friends ?

0 votes

hi,

I found the problem that how i can find facebook user rank.I used getuserrank mathod but but from this i got overall rank not among friends. I implemented the functionality that top 10 facebook ranker will be show on the leaderboard screen and the bottom of the screen we will get current user's rank and score. if the facebook user is in top 10 then i will show the rank if he/she will be not in top 10 then how i will show the rank.

here is the code i have used;

for(int i = 0;i < game.GetScoreList().Count; i++)  
{
 
fbscores.Add(game.GetScoreList()[i].GetValue().ToString());
fbplayer.Add(game.GetScoreList()[i].GetFacebookProfile().GetName());
Debug.Log("userName is : " + game.GetScoreList()[i].GetUserName());  
Debug.Log("score value is : " + game.GetScoreList()[i].GetValue());  
Debug.Log("scoreId is : " + game.GetScoreList()[i].GetScoreId());  
Debug.Log("Created On : " + game.GetScoreList()[i].GetCreatedOn());  
Debug.Log("Facebook id is : " + game.GetScoreList()[i].GetFacebookProfile().GetId());  
Debug.Log("Facebook name is : " + game.GetScoreList()[i].GetFacebookProfile().GetName());  
Debug.Log("Facebook picture is : " + game.GetScoreList()[i].GetFacebookProfile().GetPicture()); 
 
//comparing user's id
if(PlayerPrefs.GetString("FBUserId")==game.GetScoreList()[i].GetFacebookProfile().GetId())
{
rank=(i+1).ToString();
scorevalue=game.GetScoreList()[i].GetValue().ToString();
}
}
 
//to show user's rank
Userrankscore.instance.rank.GetComponent<TextMesh>().text=rank;
Userrankscore.instance.score.GetComponent<TextMesh>().text=scorevalue;
 
asked Jul 14, 2015 in App42 Cloud API-BaaS by Sourav Mishra (10 points)

1 Answer

0 votes

Hi Sourav,

If the user is not in top ten rankers than you can retrieve user rank by calling getUserRanking API.

Let me know if it helps.

Thanks

Vishnu Garg

answered Jul 14, 2015 by Vishnu Garg (674 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...