我的应用程序中包含谷歌播放服务,除了从当前播放器获取所选排行榜的分数外,一切正常。
我有5个排行榜,我制作了一个以SavedTopScoreInSharedPreferences
,SharedPreferences_KEY
, private void CheckScore(final String mID, final int mTopScore, final String mKey){
if(isSignedIn()){
Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,mID,
LeaderboardVariant.TIME_SPAN_ALL_TIME,
LeaderboardVariant.COLLECTION_PUBLIC).setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
@Override
public void onResult( Leaderboards.LoadPlayerScoreResult arg0) {
if(isScoreResultValid(arg0)){
long score = arg0.getScore().getRawScore();
if(mTopScore > score){
Log.i("GsadasdSc","Local Score is bigger: " + mTopScore + " - Score: " + score);
Log.i("GsadasdSc","ID: " + mKey + "\n" + "-----------------" + "\n");
Games.Leaderboards.submitScore(mGoogleApiClient, mID, mTopScore);
} else {
editor.putInt(mKey, (int) score).apply();
Log.i("GsadasdSc","Local Score is smaller: " + mTopScore + " - Score: " + score);
Log.i("GsadasdSc","ID: " + mKey + "\n" + "-----------------" + "\n");
}
} else {
Games.Leaderboards.submitScore(mGoogleApiClient, mID, mTopScore);
Log.i("GsadasdSc","NULL ID: " + mKey + "\n" + "-----------------" + "\n");
}
}
});
}
}
private boolean isScoreResultValid(Leaderboards.LoadPlayerScoreResult scoreResult) {
return scoreResult != null && GamesStatusCodes.STATUS_OK == scoreResult.getStatus().getStatusCode() && scoreResult.getScore() != null;
}
作为参数的方法。
例如:
当用户登录时,我检查排行榜中是否有已保存的分数,如果是,则将其保存在共享偏好中,问题是,有分数并且排行榜显示它,但它返回null,例如前三个排行榜。
我的代码:
onConnected
此代码在覆盖的Local Score is smaller: 0 - Score: 30
ID: Sham
NULL ID: Hama
NULL ID: Homs
方法中实现。
输出:
HAVING
expense.date > 2015
AND (
(person = 'Johnny' OR product = 'Vaccination')
OR (total > 10) )