Android: Google play games services connection error ( java.lang.IllegalStateException: GoogleApiClient must be connected.)

前端 未结 2 2139
梦谈多话
梦谈多话 2020-12-07 01:37

I\'ve programmed a game for android, everything works fine, but now I want my app to have Google play Games services (leaderboards and achievements). I used

2条回答
  •  天命终不由人
    2020-12-07 02:07

    Check the part where you are getting ApiClient i.e. getApiClient(). Write the code below to see if GoogleApiClient is Connected or not.

       GoogleApiClient mGoogleApiClient;
        if(mGoogleApiClient.isConnected()){
         // good
        }else{
         //connect it
         mGoogleApiClient.connect(GoogleApiClient.SIGN_IN_MODE_OPTIONAL);
        }
    

提交回复
热议问题