I have successfully integrated the Google Games API in my app, and now I can see my leaderboard and achievements as described here and here respectively.
However, when trying to submit a score using this code:
Games.Leaderboards.submitScore(mGoogleApiClient, getString(R.string.play_console_leaderboard_id), 100);
for some reason the leaderboard stops appearing. Actually it starts loading, and then directly disappears. This post seems to describe the same issue, however there is no solution posted.
I know that it has to do with the submitScore because when I create a new leaderboard, I can successfully open it and see the message that no one has reported any score. Then again, if I try to submit a score, the leaderboard again breaks.
Any hints / suggestions on that? Thanks.
EDIT: I am starting to believe that for some reason it may have to do with the tamper protection from the Play Console. Although even when I tried to disable it, the problem still persists..
EDIT2: Do I have to publish my game so I can test the leaderboards? I know that it sounds weird.
After testing with the submitScoreImmediate, I saw that I got STATUS_CLIENT_RECONNECT_REQUIRED. Based on this post, I figured that I had to create another OAUTH client id, using my debug.keystore.
And this was true; when I created a release certificate-signed APK and tried it, everything worked.
Now, Google mentions here the following:
Note: If you are debugging your game using your debug certificate but have configured games services using your release certificate, you should add a second linked app using the same package name and your debug certificate's SHA1 fingerprint. This will allow you to sign in to the application whether it's signed with the debug or release certificates.
However, if I try to link a 2nd app with the same package, I CANNOT apply another SHA1 fingerprint, since the Approval button does not appear, and thus cannot provide my debug key.
Is there any help on this?
来源:https://stackoverflow.com/questions/37099493/android-games-leaderboard-broken-while-testing