首页 > 解决方案 > 如何将 XP 积分添加到 Google Play 游戏?

问题描述

我添加了两个成就用于测试。我有一个名为longScore1的Long变量。我可以保存分数,但是用户没有获得XP。我的目标是给用户XP。这是我的代码;

  GamesClient gamesClient = Games.getGamesClient(MainActivity.this, GoogleSignIn.getLastSignedInAccount(this));
        gamesClient.setViewForPopups(findViewById(R.id.container_pop_up));

        Games.getAchievementsClient(this, GoogleSignIn.getLastSignedInAccount(this))
                .unlock(getString(R.string.achievement_paaaa));

        longScore1+=80;

标签: androidgoogle-play-servicesachievements

解决方案


XP 点数作为“成就”处理,并且成就必须注册到 google play 控制台。

https://developers.google.com/games/services/common/concepts/achievements#creating_an_achievement

请参考此 API 文档


推荐阅读