How to save or fetch extra field of leader-Board in custom code?

0 votes
i want to save and get extra field from the leaderboard in custom code but i can't set database name using App42API.setDbName(), is there any other way to this
asked Sep 26, 2014 in App42 Cloud API-BaaS by sankalp66.kumar (35 points)

1 Answer

0 votes
 
Best answer

Hello Sankalp,

Kindly use the below code snippet in your custom code to retrieve the meta info of user.

String key1 = "name";

String value1 = "John";  

Query query = QueryBuilder.build(key1, value1, Operator.EQUALS);

HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();

JSONObject json = new JSONObject();
json.put("dbName", "Your db name");
json.put("collectionName", "Your collection name");
otherMetaHeaders.put("dbCredentials", json.toString());

mScoreBoardService.setQuery("Your collection name", query);  

mScoreBoardService.setOtherMetaHeaders (otherMetaHeaders);

 

Game game = mScoreBoardService.getTopNRankers(gameName, 10);

 

Let us know if it helps.

Thanks,

Himanshu Sharma

 

answered Sep 26, 2014 by hs00105 (2,005 points)
selected Sep 27, 2014 by sankalp66.kumar
thanks, it works.
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
...