android - How to limit to max. 1x Score Submission in Google Play Game Services leaderboard API? -


my app using google play game services leaderboard api. far seems fine.

i'm stuck trying figure out how set maximum limit of score submission each player. i'm not talking displaying users 1 best score on leaderboard!!!

this 1 specific leaderboard based on players first time playing score! want let have max. 1 shot score best score possible can. once score has been submitted, there should absolutely no way submit better score!!!

how do that? know crappy way, using boolean value via sharedprefs works if player not reinstalls app or clears app data.

i have no clue how this. hope there magic trick in google play games service can use otherwise need online - uploading , downloading variables servers. hope don't have go way, better solution?

thanks

i think best solution both :) once have submitted score, use local sharedprefs can checked faster pinging server using loadcurrentplayerleaderboardscore()

if (lastsubmittedscore() == null) { // read local prefs, null if not set.     // call server     pendingresult<leaderboards.loadplayerscoreresult> result =         games.leaderboards.loadcurrentplayerleaderboardscore(mgoogleapiclient, leaderboardid,         time_span_all_time, collection_public);      if (result.await().getscore() == null) {         // no score - submit         games.leaderboards.submitscore(mgoogleapiclient,leaderboardid, firstscore);         // write out locally, scored         savelastsubmittedscore(firstscore);     } } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -