0

I'm trying to use Google Play Games Services, but when calling Games.Achievements.unlock or Games.Leaderboards.submitScore I get errors GoogleApiClient is not connected yet and GoogleApiClient must be connected respectively.

The curious thing is that when using Games.Leaderboards.getLeaderboardIntent works and the scoreboard is displayed. I tried using the methods in onCreate, onResume, and onStart, and it generates the same error. When calling those methods by some button click, it works. But i cant request my user to click a button to unlock some achievement.

In gradle:

implementation 'com.google.android.gms:play-services-games:11.0.0' implementation 'com.google.android.gms:play-services-auth:11.0.0' implementation 'com.google.firebase:firebase-core:11.0.0'

Marceloawq
  • 163
  • 2
  • 8
  • Just a suggestion from your code since I am assuming you have one. Try to check first if the `GoogleApiClient` is connected before doing any action. A simple `if{ //connected }else{ //establish connection}` will do. Also, try to explore this [SO post](https://stackoverflow.com/questions/24474986/android-google-play-games-services-connection-error-java-lang-illegalstateexc). – MαπμQμαπkγVπ.0 Sep 04 '18 at 09:44
  • i did. Still just works in button clicks. – Marceloawq Sep 04 '18 at 12:35

0 Answers0