如何使用Google Play服务创建排名?

huangapple 未分类评论47阅读模式
标题翻译

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.
如何使用Google Play服务创建排名?

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&lt;Intent&gt;() {
                    @Override
                    public void onSuccess(Intent intent) {
                        startActivityForResult(intent, RC_LEADERBOARD_UI);
                    }
                });
        }catch (Exception e){
    Toast.makeText(getBaseContext(), &quot;Google hesabınızla oturum a&#231;manız gerekmektedir.&quot; , 
    Toast.LENGTH_SHORT ).show();}
    }

huangapple
  • 本文由 发表于 2020年3月16日 22:29:16
  • 转载请务必保留本文链接:https://java.coder-hub.com/60707800.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定