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
Developer
jaiaca
Posts: 96
Registered: ‎10-06-2012
My Device: Z10
My Carrier: Rogers
Accepted Solution

Scoreloop achievements not saving?

Hi, I've been working with scoreloop and the sample code provided by RIM....I have scores (submit and retreive) working. But Achievements/Awards I'm finding a bit weird.

 

Achieved awards are saved to the local bundle and then you're suppose to synchronize them. I'm not getting any errors back from synchronizing so I'm assuming it's working. Local bundle is updated and things are awarded. But nothing shows up in "Games" hub on the alpha dev (score does)

 

However, if I uninstall the app and then re-install, all of the awards are set back to unachieved. Even after things are synchronized again (for example a new award is won and shows up correctly but not any previous won award before the uninstall don't show up).

 

Sounds like things aren't syncing but no error is returned, so could it be a scoreloop issue not saving?

 

What could i be missing? 

 

To load achievements...

	SC_Error_t rc = SC_Client_CreateAchievementsController(app->client, &app->myAchievementsController, LoadAchievementsCompletionCallback, app);
	if (rc != SC_OK) {
		HandleError(app, rc);
		return;
	}

	/* Get the session from the client. */
	SC_Session_h session = SC_Client_GetSession(app->client);

	/* Get the session user from the session. */
	SC_User_h user = SC_Session_GetUser(session);

	//Load achievements for the local awards bundle
	rc =  SC_AchievementsController_LoadAchievements(app->myAchievementsController, user);

 

To retreive them in callback...

SC_AchievementList_h achievementList = SC_AchievementsController_GetAchievements(app->myAchievementsController);

 To sync a new one...

rc = SC_LocalAchievementsController_SetAchievedValueForAwardIdentifier(app->achievementsController, awardIdentifier, &achieved);
		if (rc != SC_OK) {
			SC_LocalAchievementsController_Release(app->achievementsController); /* Cleanup Controller */
			HandleError(app, rc);
			return;
		}

		if(Global::instance()->getIsInternetAvailable()) {
			if (SC_LocalAchievementsController_ShouldSynchronize(app->achievementsController) == SC_TRUE) {
				rc = SC_LocalAchievementsController_Synchronize(app->achievementsController);
				if (rc != SC_OK) {
					SC_LocalAchievementsController_Release(app->achievementsController); /* Cleanup Controller */
					HandleError(app, rc);
					return;
				}
				qDebug() << "Synchronizing Achievements...";
			}
		}

 

 

 

Jason I. Carter
Follow me @jasonicarter
Built For BlackBerry - WordsPlus & WordsPlus: Free Edition | word search has never had it so good
www.twocasualcoders.com | never casual on quality
Please use plain text.
Developer
jaiaca
Posts: 96
Registered: ‎10-06-2012
My Device: Z10
My Carrier: Rogers

Re: Scoreloop achievements not saving?

Found what could be part of the issue.....When I set the award to true, it's callback is never actually called.

SC_Client_CreateLocalAchievementsController(app->client, &app->achievementsController, AchieveAwardCompletionCallback, app);
Jason I. Carter
Follow me @jasonicarter
Built For BlackBerry - WordsPlus & WordsPlus: Free Edition | word search has never had it so good
www.twocasualcoders.com | never casual on quality
Please use plain text.
Developer
jaiaca
Posts: 96
Registered: ‎10-06-2012
My Device: Z10
My Carrier: Rogers

Re: Scoreloop achievements not saving?

Found the issue...I was releasing the controller too soon

//SC_LocalAchievementsController_Release(app->achievementsController);
Jason I. Carter
Follow me @jasonicarter
Built For BlackBerry - WordsPlus & WordsPlus: Free Edition | word search has never had it so good
www.twocasualcoders.com | never casual on quality
Please use plain text.