Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
omarics
Posts: 6
Registered: ‎09-06-2010
My Device: Not Specified
Accepted Solution

Scoreloop, Set User Login

Hello Everyone;

 

I want to change the display/login of the user/player on the Scoreloop server and I used this code:

 

SC_User_h user = SC_Session_GetUser(session);
SC_Error_t err =  SC_User_SetLogin(user, "MyLogin");
err =  SC_UserController_UpdateUser(userController);

 

but it did not change on the server, Although the err value is "0" which means OK.

 

Thank you in advance.

Please use plain text.
BlackBerry Development Advisor (Retired)
whoang
Posts: 71
Registered: ‎11-08-2012
My Device: Blackberry 10 - Dev Alpha B | Blackberry Playbook | Blackberry Torch 9810
My Carrier: BELL Canada

Re: Scoreloop, Set User Login

Hello @omarics,

 

Did you verify if the parameters are being passed correctly to Scoreloop's servers?  

 

How are you changing the display/login for the user and what is being presented or fields on the client end?

 

Any updates on your progress? 

William Hoang

Application Developer Advocate | Developer Relations
BlackBerry


Please use plain text.
New Contributor
omarics
Posts: 6
Registered: ‎09-06-2010
My Device: Not Specified

Re: Scoreloop, Set User Login

Hello William,

thank you,

 

here is the scenario:

 

i call:

SC_Client_CreateUserController(app->client, &app->userController, RequestUserCompletionCallback, app);

 then in RequestUserCompletionCallback i call:

RequestUserCompletionCallback(void *userData, SC_Error_t completionStatus) {
AppData_t *app = (AppData_t *) userData; SC_Session_h session = SC_Client_GetSession(app->client); SC_User_h user = SC_Session_GetUser(session); SC_Error_t err = SC_User_SetLogin(user, "MyName"); err = SC_UserController_UpdateUser(app->userController); // err value is 0 SC_String_h login = SC_User_GetLogin(user); qDebug() << " User's login:" << (login ? SC_String_GetData(login) : "<unknown>"); // prints "MyName"

then when i go to the Scoreloop website in ' Score Management ' section i see the player name still ' Player 1234 '.

and the next time when i debug the application, and before the call of ' SC_User_SetLogin(user, "MyName") '

i found that the login still ' Player xxxx ' which is not updated on the server.

 

so please what you see?

Please use plain text.
BlackBerry Development Advisor (Retired)
whoang
Posts: 71
Registered: ‎11-08-2012
My Device: Blackberry 10 - Dev Alpha B | Blackberry Playbook | Blackberry Torch 9810
My Carrier: BELL Canada

Re: Scoreloop, Set User Login

Hello @omarics,

Are you able to handle or see what the return values are for your Scoreloop server method calls?

eg. Scoreloop should be returning "SC_OK" for SC_Client_CreateUserController() and SC_Client_CreateScoreController()

You may also investigate if the user does exist on Scoreloop's server-side by handling the method "SC_UserController_LoadUser(USER)" and testing for "SC_OK" return result.

The "SC_UserController_GetValidationErrors()" may help provide more information/context on the USER as there are a range of return values (eg. SC_USERNAME_FORMAT_INVALID or SC_USERNAME_TOO_SHORT ..etc)

Hope that helps!

Also you may try passing in a variable that contains String type "MyName" into SC_User_SetLogin() instead of the name itself directly. Call c_str() on the variable within the method parameter.

William Hoang

Application Developer Advocate | Developer Relations
BlackBerry


Please use plain text.
New Contributor
omarics
Posts: 6
Registered: ‎09-06-2010
My Device: Not Specified

Re: Scoreless, Set User Login

Hello William;

 

When I called "SC_User_SetLogin" function inside the callback function it did not work, But when I called it in the same function that I requested the user from, then it works like this:

 

SC_Error_t rc = SC_Client_CreateUserController(client, userController, RequestUserCompletionCallback, app);

 

rc = SC_UserController_LoadUser(userController);

 

SC_User_h user = SC_UserController_GetUser(userController);
rc = SC_User_SetLogin(user, "my name");
rc = SC_UserController_UpdateUser(userController);

 

Anyway, I noticed that the application is connected to the Games app which is installed on the BlackBerry 10 device

which from there the user can update his profile and login name as will.

Please use plain text.