MrStahlfelge / gdx-gamesvcs

Easy integration of gameservices in your libGDX game: Google Play Games, Apple Game Center, Amazon GameCircle and more
Apache License 2.0
113 stars 20 forks source link

GPGS Android: Disconnect from service while saving leads to crash #26

Closed MrStahlfelge closed 6 years ago

MrStahlfelge commented 6 years ago

In very rare cases, app crashes with the following cause:

java.lang.IllegalStateException: com.google.android.gms.games.internal.api.SnapshotsImpl.commitAndClose (SnapshotsImpl.java) or .open$70b7f367 (SnapshotsImpl.java) at de.golfgl.gdxgamesvcs.GpgsClient..saveGameStateSync (GpgsClient.java) at de.golfgl.gdxgamesvcs.GpgsClient$4.doInBackground (GpgsClient.java)

This is probably caused by disconnecting from GPGS while cloud save is still running.

There are two possible approaches to prevent this crash: 1) do not disconnect while cloud save is running 2) catch the exception and return failed cloud save

MrStahlfelge commented 6 years ago

Fixed in v0.2.4 with exception catch like it is done when loading.