Google Play Games Services gpgs.snapshots questions

No one ? Ghost Forum :frowning:

jgaldeanol, in Game details on Google’s developer portal, do you have “Saved Games” option turned on?
f26f27b519a34c9e81cd4125e2cfe99f.png

of course !

jgaldeanol, another silly question, have you logged in in your app? gpgs.init() and gpgs.login()?
What gpgs.isConnected() returns in your code when you try to open a snapshot?

Lerg, firdt of all thanks so much to help me. It is not silly questions dont worry.

And yes, i Connect with gpgs plugin to Google Play Game, and i have configure leaderboard and achievements as well and all work fine.

But no the snapshots, I have seen an API option for my game inside Google develop console. Do I have to configure any thing by this way?

Thanks!

jgaldeanol, I’ve just tested it on my device and everything went fine. If the rest is working, snapshots should too.
Upload your code somewhere so I can look at it.

local snapshot function loadSavedGamesGPGS() print("START open ...") function abrirSnap(event) snapshotId = event.snapshotId snapshot = gpgs.snapshots.getSnapshot(snapshotId) end params = { filename = "save\_slot\_Gold", create = true, conflictPolicy = "manual", abrirSnap } gpgs.snapshots.open(params) print("END open ...") print(" snapshotId: " .. snapshot) end

And this is the device console: 

10-29 09:17:01.509 31466 31487 I Corona  : WARNING: licensing.init() was already called for google.

10-29 09:17:01.509 31466 31487 I Corona  : START open …

10-29 09:17:01.510 31466 31487 I Corona  : END open …

10-29 09:17:01.510 31466 31487 I Corona  : ERROR: Runtime error

10-29 09:17:01.510 31466 31487 I Corona  : ?:0: attempt to concatenate upvalue ‘?’ (a nil value)

10-29 09:17:01.510 31466 31487 I Corona  : stack traceback:

10-29 09:17:01.510 31466 31487 I Corona  :      ?: in function ‘loadSavedGamesGPGS’

10-29 09:17:01.510 31466 31487 I Corona  :      ?: in main chunk

10-29 09:17:01.511 31466 31487 I Corona  : systemEvent applicationStart

I am completeley desesperate. I have put on the Saved Game in my Google Develop console but do I need to configure any thing more there ? I think when I use open() do not communicate with the server …

Regards

First of all, global functions are dangerous, they lead to hard to debug errors. Use “local” keyword for them when you can.

Secondly, remove the last print statement, snapshot variable is nil there.

Thirdly, you don’t specify the listener. In your case it should be “listener = abrirSnap” instead of just “abrirSnap” in params table.

Then in the listener you can try to print out snapshot id.

Hi guys,

thanks for all Lerg. I realise what is my problem. I call gpgs.snapshots.open() too fast and gpgs.login is not connected yet. So I let the second instruction more time and, of course, it works.

But now I have another quetion and is : how can i put the optimal time to login first with google play game service and, after this, open the snapshots ? I don’t want to lose time with time.performWithDelay functions.

Thanks a lot !

gpgs.login() also has a listener, which is invoked when the connection is established. Open your snapshot from that listener.

Thank you so much mate !