提交用户分数时,Google Play游戏API会返回RESULT_RECONNECT_REQUIRED

时间:2016-03-17 02:13:52

标签: android google-play-services google-play-games

我正在使用Google Play游戏的API制作游戏。我已经阅读了排行榜上的文档。我使用相同的代码来更新用户的分数,但它总是返回代码$ sudo apt-get install libssl-dev $ sudo apt-get install libffi-dev $ sudo apt-get install libjpeg-dev $ sudo apt-get install libvirt-dev $ sudo apt-get install libsqlite3-dev $ sudo apt-get install libcurl4-openssl-dev $ sudo apt-get install libxml2-dev libxslt1-dev python-dev 。我已经使用logcat来显示调用的结果:

RESULT_RECONNECT_REQUIRED

以下是代码:

E/GameProgress: Result score CgkIoY-5lt0DEAIQEA: ScoreSubmissionData{PlayerId=128090785697, StatusCode=2, TimesSpan=DAILY, Result=null, TimesSpan=WEEKLY, Result=null, TimesSpan=ALL_TIME, Result=null}

GameHelperClass:

public class GameActivity extends AppCompatActivity {

    private GameHelper mHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game);

        ...

        mHelper = new GameHelper(this, 1);
        mHelper.enableDebugLog(true);
        mHelper.setup(new GameHelper.GameHelperListener() {
            @Override
            public void onSignInFailed() {
                Log.e(TAG, "Sign in failed");
            }

            @Override
            public void onSignInSucceeded() {
                Log.e(TAG, "Sign in Succeded");
                addScores(GameId.LEADERBOARDS.TEN_THOUSAND);
            }
        });
    }

    private void addScores(String leaderBoard) {
        PendingResult<Leaderboards.SubmitScoreResult> result = Games.Leaderboards.submitScoreImmediate(mGoogleApiClient, leaderBoard, 5);
        result.setResultCallback(new ResultCallback<Leaderboards.SubmitScoreResult>() {
            @Override
            public void onResult(@NonNull Leaderboards.SubmitScoreResult submitScoreResult) {
                Log.e(TAG, "Result score " + leaderBoard + ": " + submitScoreResult.getScoreData().toString());
            }
        });
    }
}

我试图更改分数,但没有任何内容,我还检查了排行榜是否设置正确。

0 个答案:

没有答案