标题翻译
How can I create a ranking using Google Play Service?
问题
private static final int RC_LEADERBOARD_UI = 9004;
public void siralama(View view) {
// 用于在线排名
try {
Games.getLeaderboardsClient(this, GoogleSignIn.getLastSignedInAccount(this))
.getLeaderboardIntent(getString(R.string.leaderboard_skor_tablosu))
.addOnSuccessListener(new OnSuccessListener<Intent>() {
@Override
public void onSuccess(Intent intent) {
startActivityForResult(intent, RC_LEADERBOARD_UI);
}
});
} catch (Exception e) {
Toast.makeText(getBaseContext(), "Google hesabınızla oturum açmanız gerekmektedir.",
Toast.LENGTH_SHORT).show();
}
}
英文翻译
i have a leaderboard. I want to rank for those who play the game.but when I press the ranking button, I only see my score.I dont see the scores of other users logging in and playing the game.
I have one function for that.I want to rank online.
here are my codes;
private static final int RC_LEADERBOARD_UI = 9004;
public void siralama(View view) {
//for online ranking
try {
Games.getLeaderboardsClient(this, GoogleSignIn.getLastSignedInAccount(this))
.getLeaderboardIntent(getString(R.string.leaderboard_skor_tablosu))
.addOnSuccessListener(new OnSuccessListener<Intent>() {
@Override
public void onSuccess(Intent intent) {
startActivityForResult(intent, RC_LEADERBOARD_UI);
}
});
}catch (Exception e){
Toast.makeText(getBaseContext(), "Google hesabınızla oturum açmanız gerekmektedir." ,
Toast.LENGTH_SHORT ).show();}
}
专注分享java语言的经验与见解,让所有开发者获益!
评论