friends list with Buddy management mixing Facebook and app42 users

0 votes
Hello
 
We have a problem with the userNames/buddyNames to keep friends list. 
 
When we create an App42 user, we register the facebook ID as userName, in order to have unique IDs always.
And then, when someone is going to add a friend logged with facebook, is strange that the user needs to write the facebook ID to find it...
 
At the moment we are using the facebook SDK to show the facebook players names, but now we need to implement de Buddy Management System.
 
Any ideas/ways to solve this? 
 
The idea is that all users can be treated equally, but that users can log in facebook without app42 username/pass. 
 
Thank you! :)
asked Aug 20, 2014 in App42 Cloud API-BaaS by etorkigames (25 points)
recategorized Oct 26, 2014 by sushil

1 Answer

0 votes
 
Best answer
Hello Etorki,
 
In such case, you can link user additional information like his name, profile picture etc while creating the App42 user with Facebook id. And use that additional information while you are adding friend as a buddy. 
 
Please find the below code snippet for saving the additional information of user along with user creation:
 
String userName = "Facebook Ids";
String pwd = "********";
String emailId = "nick@shephertz.co.in";
String dbName = "<Your_DataBase_Name>"; 
String collectionName = "<Your_Collection_Name>"; 
Dictionary<string, object> jsonDoc = new Dictionary<string, object> ();
jsonDoc.Add("name","John");
App42API.SetDbName(dbName);  
userService.AddJSONObject(collectionName, jsonDoc);    
App42Log.SetDebug(true); //Print output in your editor console
userService.CreateUser(userName, pwd, emailId, new UnityCallBack()); 
public class UnityCallBack : App42CallBack
{
public void OnSuccess(object response)
{
User user = (User) response;
App42Log.Console("userName is " + user.GetUserName());
App42Log.Console("emailId is " + user.GetEmail());
for(int i=0; i<user.GetJsonDocList().Count; i++)
{
App42Log.Console("updated at = "+ user.GetJsonDocList()[i].GetUpdatedAt());
App42Log.Console("created at = "+ user.GetJsonDocList()[i].GetCreatedAt());
App42Log.Console("doc id is = "+ user.GetJsonDocList()[i].GetDocId());
App42Log.Console("json doc  is = "+ user.GetJsonDocList()[i].GetJsonDoc()); 
}
public void OnException(Exception e)
{
App42Log.Console("Exception : " + e);
}
}
 
Also, follow this blog in which you find that how you can fetch these details using Storage service as well.
Let us know if it helps.
 
Thanks
answered Aug 21, 2014 by hs00105 (2,005 points)
selected Aug 21, 2014 by etorkigames
Ok, thank you. I will try this and write the result when its done.
To link a Facebook ID with an app42 user so other people can find him by name, another JSON is necessary?

For example to search for a friend I would have to do:

1. Enter a name
2. Find a document with the entered name as a key (to find the JSON)
3. In case of found it, use the information to locate the app42 account

It's the way? It's the process that you mean?

Thank you.
Yes, you are right. Let us know if you have more question for us regarding this query.
Thanks.
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
...