playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
971 stars 973 forks source link

Google Play Games Leaderboard is immediatly disappear after submitScore() or submitScoreImmediate() #278

Open bsiyoung opened 6 years ago

bsiyoung commented 6 years ago

Hello guys, I'm struggling with Google Play Games Leaderboards for2 months. It isn't work just after submitScore() or submitScoreImmediate(). And If I clear data of Google Play services app, It is work again. I think settings are not problem. Because after submit score, It worked well. I can open leaderboard smoothly.

Followings are Logcat when I open leaderboard after submit score. Please help me :(

05-21 10:16:01.694 18290-19090/? E/Volley: [24139] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/games/v1/applications/played 05-21 10:16:01.697 18290-27469/? W/GameAgent: Volley error when reporting played com.android.volley.AuthFailureError at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@12673021@12.6.73 (040306-194189626):40) at oom.performRequest(:com.google.android.gms@12673021@12.6.73 (040306-194189626):17) at com.android.volley.NetworkDispatcher.a(:com.google.android.gms@12673021@12.6.73 (040306-194189626):7) at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@12673021@12.6.73 (040306-194189626):2) 05-21 10:16:01.765 18290-19091/? E/Volley: [24140] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/games/v1/leaderboards/scores?language=en-GB 05-21 10:16:01.807 18290-27280/? I/Icing: updateResources: need to parse xan{com.google.android.gm} 05-21 10:16:01.839 18290-27470/? E/MultiDataOperation: There is no linked app associated with this client ID. gsj at gkj.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):54) at fhe.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):55) at fhe.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):128) at fhe.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):515) at fhe.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):297) at ffw.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):617) at gwv.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):5) at guz.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):2) at dra.a(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):10) at dqy.run(:com.google.android.play.games@58530036@5.8.53 (197013620.197013620-000306):1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:762)

`I used these codes for submit score

GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);

    if(account != null) {
        LeaderboardsClient leaderboardsClient = Games.getLeaderboardsClient(this, account);

        leaderboardsClient.submitScore(getString(R.string.leaderboard_max_gold), ladderAnalyse.MaxGold);

        // Or
        //leaderboardsClient.submitScoreImmediate(getString(R.string.leaderboard_max_gold), ladderAnalyse.MaxGold);
    }`

`and

final GoogleApiClient client = new GoogleApiClient.Builder(this) .addApi(Games.API) .addScope(Games.SCOPE_GAMES) .build();

    client.registerConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
        @Override
        public void onConnected(@Nullable Bundle bundle) {
            PendingResult r = Games.Leaderboards.submitScoreImmediate(client,
                    getString(R.string.leaderboard_max_gold),
                    ladderAnalyse.MaxGold);

            ResultCallback callback = new ResultCallback() {
                @Override
                public void onResult(@NonNull Result result) {

                }
            };
            r.setResultCallback(callback);
        }

        @Override
        public void onConnectionSuspended(int i) {

        }
    });`