GamesClient not connecting. Error: “Call connect() and wait for onConnected() to be called.”

前端 未结 2 934
自闭症患者
自闭症患者 2021-01-13 18:43

I am trying to use GamesClient to use the leaderboards of the Google Play Game Services. Right now I have it so when the importbutton is clicked,

2条回答
  •  误落风尘
    2021-01-13 19:05

    If you are using BaseGameActivity, don't call GamesClient.connect(). The advantage of using BaseGameActivity is that it handles all the connection boilerplate for you. All you have to do is override onSignInSucceeded and make your API calls from there. Don't make any games API calls before you get onSignInSucceeded.

    Also, remember that when your activity gets an onStop, the games API will be disconnected. After that, when it subsequently gets an onStart, you would again wait for onSignInSucceeded before making any API calls.

提交回复
热议问题