简体   繁体   中英

How to add XP points to Google Play Games?

I added two achievements for test purposes.I have a Long variable whose name is longScore1.I can save the score, but the user does not gain XP.My goal is to give users XP. Here my codes;

  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;

XP Points are handled as "Achievements", and Achievement has to be registered to the google play console.

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

Please refer to this API document

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM