Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

android - Google Play Games Services achievement activity closing immediately

I'm updating my game to the new Google Play Serviced library, leaderboards and achievements were already working flawlessly, but now when I try to open the achievement activity, it immediately closes without showing any exception in logcat. I'm logged in with my google account, which is correctly configured as a test user.

public void gameServicesGetAchievements() {
    if (gameHelper == null)
        return;

    Intent i = Games.Achievements.getAchievementsIntent(gameHelper.getApiClient());
    ((Activity) ctx).startActivityForResult(i, REQUEST_CODE_ACHIEVEMENTS);
}

The activity opens, but closes immediately before showing the achievements list. This is what I get in logcat

D/GameHelper(30459): GameHelper: onActivityResult: req=9802, resp=RESULT_RECONNECT_REQUIRED
D/GameHelper(30459): GameHelper: onActivityResult: request code not meant for us. Ignoring.

I tried handling the RESULT_RECONNECT_REQUIRED code in my onActivityResult, but nothing changes.

@Override
public void onActivityResult(int request, int response, Intent data) {
    super.onActivityResult(request, response, data);

    GameHelper helper = resolver.getGameServicesHelper();
    if (helper != null) {
        helper.onActivityResult(request, response, data);
    }

    if (response == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) {
        helper.disconnect();
    }
}

The leaderboards activities start correctly and work flawlessly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Found the problem... it wasn't a problem in my app, just the Google Play Games app on my device had some corrupted data or something. I followed the steps here and that fixed it. http://howlukeseesit.blogspot.it/2014/08/fixing-google-play-games.html

  • First navigate to settings > apps and find and tap on Google play games.
  • Next tap uninstall updates, then tap clear data.
  • Next go back to the apps section and find Google Play Services, tap that then tap Manage space and then tap on clear all data.
  • Now all you have to do is go into the Play store and manually update Google Play Games.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...