GPGS userInitiated - How does it work?

Hi,

I have been playing around with GPGS and trying to write a module to make it easier to implement Game Center and GPGS together (https://github.com/riceburgerlabs/miscUtilities/tree/master/gameNetworking - still a bit of work in progress). 

Anyway, I was playing around with userInitiated and am not quite sure how it is supposed to work.  My app logs in perfectly when I set it to true, but if I set it to false then I get the following error.

 table: 0xc5b68720 { [name] =\> "login" [phase] =\> "logged in" [errorMessage] =\> "sign in required" [errorCode] =\> 4 [isError] =\> true }

This confuses me as I thought the point of “gpgs.login( userInitiated = false )” was to log the user in silently so they don’t see the popup etc?  What is the point of it if they have to be logged in first?  Have I misinterpreted the way it works?

Currently, what I have seems to work (needs more testing);

  1. When the app loads check if a persistent variable (saved in a json file) called GPGSLogged in is true
  2. If true then log in silently “gpgs.login( userInitiated = false )” 
  3. If false then log in and prompt “gpgs.login( userInitiated = true )” and set GPGSLogged to true
  4. If the user logs out the set GPGSLogged to false

This seems to work, but it does mean that the first time the user uses the app they are prompted with the sign in dialog, I would prefer a more silent approach for a better user experience (like the ketchapp apps seem to use).

Craig

This makes sense. You always have to log the user in once with their permission.

Rob

Thanks Rob.

When you phrase it in terms of permissions I guess it makes sense, just not how I expected it to work.  I guess my process is the least obtrusive when it comes to the users experience??

Cheers

This makes sense. You always have to log the user in once with their permission.

Rob

Thanks Rob.

When you phrase it in terms of permissions I guess it makes sense, just not how I expected it to work.  I guess my process is the least obtrusive when it comes to the users experience??

Cheers